UOL CIS Community Forum Forum Index UOL CIS Community Forum
Free discussion boards for UOL CIS Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2007 Coursework 2 discussion thread
Goto page 1, 2  Next
 
Post new topic   Reply to topic    UOL CIS Community Forum Forum Index -> CIS326 Computer Security
View previous topic :: View next topic  
Author Message
william



Joined: 09 Dec 2007
Posts: 28

PostPosted: Sun Dec 09, 2007 11:09 pm    Post subject: 2007 Coursework 2 discussion thread Reply with quote

Please post all questions pertaining to Coursework 2 in this thread.
Back to top
View user's profile Send private message
william



Joined: 09 Dec 2007
Posts: 28

PostPosted: Sun Dec 09, 2007 11:10 pm    Post subject: Reply with quote

1. Big Hint for CW02:
Why is "Euclid's Extended Algorithm for obtaining the modular inverse of b mod a" provided?
Recall for modular multiplication, if m, s and p are given, then
c = (m*s) mod p
If c, s and p are given and you are to calculate the value of m, then you need to solve:
m = (c/s) mod p
=> = (c * (1/s mod p)) mod p
ie. = (c * (multiplicative inverse of s mod p)) mod p

2. Blocking factor:
For El Gamal, even if you use a blocking factor of 1, it is still less susceptible to statistical analysis attacks compared to RSA because of its polyalphabetic and stream-cipher-like behavior where each block is encrypted using a different key. For greater security strength, a greater blocking factor is recommended.

However, we note the following:
a. the plaintext block m must be smaller than p, the prime modulus;
b. if 7-bit ASCII is used as the message alphabet, then each plaintext character value is < 128.

This implies that the modulus prime must be > 128 for a blocking factor of 1. This is fine for the assignment since 1000 < p < 10000.

If you want a blocking factor of 2, then we note that the plaintext block m can now have a maximum value of 127*128+127 = 16383. So the prime must be at least 16384. Since the assignment limits you to 10,000, you cannot use a blocking factor of more than 1.

But for extra credit, I would encourage you to develop an encoding scheme that supports blocking factors of > 1, and use larger primes to test it. If this assignment has been on RSA, you will definitely need to do this.

3. Here is the sample output for CW02 which uses a blocking factors of 2 and 3. It is useless for you to submit this as your assignment since the assignment requires you to use a prime < 10,000, which limits you to a blocking factor of 1. So just use this output to understand better the requirements of the assignment and nothing more.

Code:
> Creating PK keys for Alice... please wait...
Alice's public  key is: El Gamal (P=1277147,G=2,Y=1229726).
Alice's private key is: El Gamal (P=1277147,G=2,S=720338).
> Creating PK keys for Bob... please wait...
Bob's public  key is: El Gamal (P=7215323,G=2,Y=4409270).
Bob's private key is: El Gamal (P=7215323,G=2,S=3479760).
> Parameter initialization completed for all users.


++++++++++++++++++++++++++++++++++++++++++
> Alice is now sending the following message to Bob:
> Bob allows a maximum blocking factor of 3
> Message will require 15 block/s.
> Alice processes the following...
> PLAINTEXT : The quick brown fox jumped over the lazy dog.
> ENCODED   : 1389669 538869 1733099 536946 1833966 537455 1970282 1930992 1667616 1833829 1871988 1716896 1782010 1986660 1831854
> ENCRYPTED : 1757720 3826165 1105998 3135560 6460660 3424710 4796593 4994007 5773836 5930182 3226750 1851776 1591945 6264966 6224275
> PARTIALS  : 6871426 5980503 1510478 3682400 4770951 2280429 58979 4092904 6511151 2668722 4272915 7126676 5785100 2942983 6030388
> Bob processes the following...
> DECRYPTED : 1389669 538869 1733099 536946 1833966 537455 1970282 1930992 1667616 1833829 1871988 1716896 1782010 1986660 1831854
> DECODED   : The quick brown fox jumped over the lazy dog.
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Bob is now sending the following message to Alice:
> Alice allows a maximum blocking factor of 2
> Message will require 23 block/s.
> Bob processes the following...
> PLAINTEXT : The quick brown fox jumped over the lazy dog.
> ENCODED   : 10856 12960 14581 13539 13728 12658 14327 14112 13167 15392 13685 14064 13028 4207 15205 14624 14952 12960 13921 15737 4196 14311 5888
> ENCRYPTED : 800496 1079356 279669 49276 703563 827366 404221 899795 945535 652705 403980 644246 1262775 308911 1078458 363129 1120327 959358 979256 686367 897252 428554 318497
> PARTIALS  : 449146 803924 715578 904824 1137597 1078166 305318 703084 548394 419809 1149542 1265292 1141563 732496 14680 1016840 963721 844360 550773 536220 484530 822834 969947
> Alice processes the following...
> DECRYPTED : 10856 12960 14581 13539 13728 12658 14327 14112 13167 15392 13685 14064 13028 4207 15205 14624 14952 12960 13921 15737 4196 14311 5888
> DECODED   : The quick brown fox jumped over the lazy dog.
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Alice is now sending the following message to Bob:
> Bob allows a maximum blocking factor of 3
> Message will require 21 block/s.
> Alice processes the following...
> PLAINTEXT : Now is the TIME for all good folks to apply PKI to their Lives!
> ENCODED   : 1292279 537843 539240 1658964 1205957 537455 1871969 1783328 1701871 1642598 1832555 1888372 1822817 1849452 1986640 1238176 1914784 1913957 1734944 1258742 1669537
> ENCRYPTED : 4672070 2613149 6297558 5797911 1962751 5618622 516002 6005593 4237692 1137224 7063821 3190504 6464117 7170754 4165971 6929732 2514242 58642 3094671 4386392 1659114
> PARTIALS  : 5357622 4328247 6598931 4419101 1012604 292836 7095690 3921373 4665938 1820322 3122473 1061503 5160498 3043518 2767805 2661034 4356725 6896040 2087348 1762641 6768017
> Bob processes the following...
> DECRYPTED : 1292279 537843 539240 1658964 1205957 537455 1871969 1783328 1701871 1642598 1832555 1888372 1822817 1849452 1986640 1238176 1914784 1913957 1734944 1258742 1669537
> DECODED   : Now is the TIME for all good folks to apply PKI to their Lives!
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Bob is now sending the following message to Alice:
> Alice allows a maximum blocking factor of 2
> Message will require 32 block/s.
> Bob processes the following...
> PLAINTEXT : Now is the TIME for all good folks to apply PKI to their Lives!
> ENCODED   : 10095 15264 13555 4212 13413 4180 9421 8864 13167 14624 12524 13856 13295 14308 4198 14316 13811 4212 14240 12528 14444 15520 10315 9376 14959 4212 13413 13554 4172 13558 13043 4224
> ENCRYPTED : 278726 8437 224816 522126 629533 628257 283387 950042 149994 546933 571707 1148473 828307 396115 975671 188137 208177 374270 1202690 785528 155681 679860 469023 1039193 639304 2958 446834 104911 223350 1138378 329055 1252246
> PARTIALS  : 1017574 84041 960641 505819 560990 929890 611884 453030 850288 883849 304310 1061698 930964 566213 475653 267565 726566 741685 903571 349785 1265129 1179952 1007411 1252273 405010 768160 1217896 340186 227877 674508 183529 453561
> Alice processes the following...
> DECRYPTED : 10095 15264 13555 4212 13413 4180 9421 8864 13167 14624 12524 13856 13295 14308 4198 14316 13811 4212 14240 12528 14444 15520 10315 9376 14959 4212 13413 13554 4172 13558 13043 4224
> DECODED   : Now is the TIME for all good folks to apply PKI to their Lives!
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Alice is now sending the following message to Bob:
> Bob allows a maximum blocking factor of 3
> Message will require 21 block/s.
> Alice processes the following...
> PLAINTEXT : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()
> ENCODED   : 1601891 1651430 1700969 1750508 1800047 1849586 1899125 1948664 1998145 1089988 1139527 1189066 1238605 1288144 1337683 1387222 1436761 1478848 578085 1545002 660608
> ENCRYPTED : 4207314 4476767 7026421 500433 3776759 2351684 4271712 4375475 5841595 5016219 1885153 2891212 4133005 4870482 1077638 3918213 1690133 4196755 5008433 5653517 705630
> PARTIALS  : 717092 3426735 2205768 1076012 6003095 4128445 848178 3707171 5896480 6199001 5878328 692817 5185621 4030784 6585218 4776537 5522957 1053918 1536301 1194641 3369314
> Bob processes the following...
> DECRYPTED : 1601891 1651430 1700969 1750508 1800047 1849586 1899125 1948664 1998145 1089988 1139527 1189066 1238605 1288144 1337683 1387222 1436761 1478848 578085 1545002 660608
> DECODED   : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Bob is now sending the following message to Alice:
> Alice allows a maximum blocking factor of 2
> Message will require 31 block/s.
> Bob processes the following...
> PLAINTEXT : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()
> ENCODED   : 12514 12772 13030 13288 13546 13804 14062 14320 14578 14836 15094 15352 15610 8386 8644 8902 9160 9418 9676 9934 10192 10450 10708 10966 11224 11482 4288 4516 4830 4906 5161
> ENCRYPTED : 923004 895423 953026 290121 940311 1122181 409628 1191514 1047084 54172 1245296 458603 1004185 309290 1237301 156392 155131 306201 577881 361138 951053 326836 422503 1172363 773352 393001 614503 480927 721264 1174837 4792
> PARTIALS  : 404014 205833 1204067 588027 1098584 464120 528298 839521 601103 1102791 908605 606963 918481 1033695 541940 428788 1045051 390113 379619 339264 955466 481354 909891 377342 677879 156986 296652 929223 1174884 975158 893490
> Alice processes the following...
> DECRYPTED : 12514 12772 13030 13288 13546 13804 14062 14320 14578 14836 15094 15352 15610 8386 8644 8902 9160 9418 9676 9934 10192 10450 10708 10966 11224 11482 4288 4516 4830 4906 5161
> DECODED   : abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Alice is now sending the following message to Bob:
> Bob allows a maximum blocking factor of 3
> Message will require 15 block/s.
> Alice processes the following...
> PLAINTEXT : Student Name: James Bond, Student Number: 007
> ENCODED   : 1374837 1651438 1904718 1603301 954442 1603301 1888322 1832804 725075 1915620 1668980 534389 1798501 1875232 792631
> ENCRYPTED : 1301097 4827995 2088659 5729252 5420883 6990123 1654080 2238572 787292 6908785 4681452 4508805 2796498 3289877 985047
> PARTIALS  : 985990 1199990 6994876 2912384 3802933 6869357 3508435 808420 285807 1714928 6905766 4699753 3182833 4162840 6069729
> Bob processes the following...
> DECRYPTED : 1374837 1651438 1904718 1603301 954442 1603301 1888322 1832804 725075 1915620 1668980 534389 1798501 1875232 792631
> DECODED   : Student Name: James Bond, Student Number: 007
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++
> Bob is now sending the following message to Alice:
> Alice allows a maximum blocking factor of 2
> Message will require 23 block/s.
> Bob processes the following...
> PLAINTEXT : Student Name: James Bond, Student Number: 007
> ENCODED   : 10740 15076 13038 14880 10081 14053 7456 9569 14053 14752 8559 14180 5664 10740 15076 13038 14880 10101 14050 13042 7456 6192 7040
> ENCRYPTED : 244261 271773 1275656 556906 1188955 297728 885730 693241 313140 881909 1160043 558393 25916 1009069 928520 903988 641095 24647 1106419 157111 499315 1136918 62687
> PARTIALS  : 644249 876040 1139429 805841 663383 969201 163840 922728 1109032 769757 801594 1218985 269963 1179351 893719 1153910 242308 414647 692970 636700 249924 1250225 77588
> Alice processes the following...
> DECRYPTED : 10740 15076 13038 14880 10081 14053 7456 9569 14053 14752 8559 14180 5664 10740 15076 13038 14880 10101 14050 13042 7456 6192 7040
> DECODED   : Student Name: James Bond, Student Number: 007
> Original message matched received message.  Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>> The test application has found a total of 0 errors in the PK cryptosystem.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Back to top
View user's profile Send private message
william



Joined: 09 Dec 2007
Posts: 28

PostPosted: Fri Jan 25, 2008 9:14 am    Post subject: Re: The value in the generator Reply with quote

layjieN wrote:
I seriously do not understand how come 3 is a generator for prime 17 but 2 isn't a value of prime 17. And also can I use 3 as a value in a generator?


Fermat's theorem states that a^(p-1) mod p = 1 if p is prime.
So, 3^16 mod 17 = 1
and 2^16 mod 17 = 1

If you work out all the positive powers of
3^e mod 17, and
2^f mod 17

using values of e and f from 1 to 16, you will find that the smallest positive value of e for 3^e mod 17 is 16 while the smallest positive value of f for 2^f mod 17 is 8 (ie. 2^8 mod 17 = 1).

This means that 3^e mod 17's exponent is 16 which matches Fermat's theorem, while 2^f mod 17's exponent is 8 which does not match Fermat's theorem.

So 3 is a generator for (mod 17) while 2 is not a generator for (mod 17).
Back to top
View user's profile Send private message
magustan



Joined: 09 Dec 2007
Posts: 5

PostPosted: Wed Mar 05, 2008 1:38 am    Post subject: Reply with quote

Hello Sir, I have completed according to your framework.


at times the program run successfully, but sometimes it doesn't.

Could you please enlighten me or is it normal?

Magus
Back to top
View user's profile Send private message
skyice



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sat Mar 08, 2008 5:45 pm    Post subject: Help with Inverse Mod Reply with quote

Hi William,

Can advice me on how to calculate inverse mod.

8 = (5 * m) mod 19
m = 13

How to get that?

Thanks!
Back to top
View user's profile Send private message
magustan



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 12:35 am    Post subject: Re: Help with Inverse Mod Reply with quote

skyice wrote:
Hi William,

Can advice me on how to calculate inverse mod.

8 = (5 * m) mod 19
m = 13

How to get that?

Thanks!


return (c*findInverse(p,s))%p;

should be something like that I think Smile Hope it helps

Just curious if you manage to finish everything please let me know if your partial key changes with each block or remains the same.

Thanks in advance.
Back to top
View user's profile Send private message
skyice



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 1:34 pm    Post subject: Re: Help with Inverse Mod Reply with quote

magustan wrote:
skyice wrote:
Hi William,

Can advice me on how to calculate inverse mod.

8 = (5 * m) mod 19
m = 13

How to get that?

Thanks!


return (c*findInverse(p,s))%p;

should be something like that I think Smile Hope it helps

Just curious if you manage to finish everything please let me know if your partial key changes with each block or remains the same.

Thanks in advance.


What do you mean by partial key? U mean 'r' and 'c'. i used block size of 1. every character will be encrypted with a r and c of its own.

Hai... can teach me how to manual calculate inverse? i mean, how we get 'm'.

8 = (5 * m) mod 19
m = 13 ???

m = XXX mod^-1 19??? or something else?
Back to top
View user's profile Send private message
magustan



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 2:43 pm    Post subject: Re: Help with Inverse Mod Reply with quote

skyice wrote:
magustan wrote:
skyice wrote:
Hi William,

Can advice me on how to calculate inverse mod.

8 = (5 * m) mod 19
m = 13

How to get that?

Thanks!


return (c*findInverse(p,s))%p;

should be something like that I think Smile Hope it helps

Just curious if you manage to finish everything please let me know if your partial key changes with each block or remains the same.

Thanks in advance.


What do you mean by partial key? U mean 'r' and 'c'. i used block size of 1. every character will be encrypted with a r and c of its own.

Hai... can teach me how to manual calculate inverse? i mean, how we get 'm'.

8 = (5 * m) mod 19
m = 13 ???

m = XXX mod^-1 19??? or something else?


yes partial key refers to R.

m = (c*findInverse(p,s))%p (Java Code) I was lazy so I just return the computed value without assigning it to a variable m.
Back to top
View user's profile Send private message
magustan



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 2:44 pm    Post subject: Reply with quote

++++++++++++++++++++++++++++++++++++++++++
> Bob is now sending the following message to Alice:
> Alice allows a maximum blocking factor of 1
> Message will require 54 block/s.
> Bob processes the following...
> PLAINTEXT : Student Name: Tan Hwi Keng, Student Number: U050265703
> ENCODED : 83 116 117 100 101 110 116 32 78 97 109 101 58 32 84 97 110 32 72 119 105 32 75 101 110 103 44 32 83 116 117 100 101 110 116 32 78 117 109 98 101 114 58 32 85 48 53 48 50 54 53 55 48 51
> ENCRYPTED : 839 632 3345 2092 1066 3049 632 819 2230 1431 336 1066 316 819 3552 1431 3049 819 908 1293 701 819 1569 1066 3049 2753 3463 819 839 632 3345 2092 1066 3049 632 819 2230 3345 336 405 1066 2684 316 819 2526 3098 1707 3098 1046 681 1707 3394 3098 20
> PARTIALS : 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713 2713
> Alice processes the following...
> DECRYPTED : 83 116 117 100 101 110 116 32 78 97 109 101 58 32 84 97 110 32 72 119 105 32 75 101 110 103 44 32 83 116 117 100 101 110 116 32 78 117 109 98 101 114 58 32 85 48 53 48 50 54 53 55 48 51
> DECODED : Student Name: Tan Hwi Keng, Student Number: U050265703
> Original message matched received message. Public key crytosystem works.

++++++++++++++++++++++++++++++++++++++++++

lol you see my partial key doesn't change =X
Back to top
View user's profile Send private message
skyice



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 9:38 pm    Post subject: Reply with quote

the partial key is 'k' or 'm'?
Back to top
View user's profile Send private message
skyice



Joined: 09 Dec 2007
Posts: 5

PostPosted: Sun Mar 09, 2008 9:42 pm    Post subject: Reply with quote

but if you look at william's post, his partial key changes...
Back to top
View user's profile Send private message
magustan



Joined: 09 Dec 2007
Posts: 5

PostPosted: Mon Mar 10, 2008 3:14 am    Post subject: Reply with quote

skyice wrote:
but if you look at william's post, his partial key changes...


yes thats why I am wondering if your partial key changes =x

not many people have finish this assignment to discuss

partial key refers to the value r which is send together with c.

you use r and private key a to derive x..

there after you use x and c to get the m.
Back to top
View user's profile Send private message
skyice



Joined: 09 Dec 2007
Posts: 5

PostPosted: Mon Mar 10, 2008 11:48 am    Post subject: Reply with quote

Hi,

Thanks anyway... i did it. My partial key changes...
Back to top
View user's profile Send private message
Slevin



Joined: 09 Dec 2007
Posts: 3

PostPosted: Thu Mar 20, 2008 8:56 pm    Post subject: Reply with quote

when submit cw02 ah? i havent start doing them leh... Sad
Back to top
View user's profile Send private message
Slevin



Joined: 09 Dec 2007
Posts: 3

PostPosted: Sat Mar 22, 2008 2:24 am    Post subject: Reply with quote

finish liao, so simple. LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    UOL CIS Community Forum Forum Index -> CIS326 Computer Security All times are GMT + 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group