rioki / spritzsaber

The spritz sabre is a small and practical implementation of cryptography.
Do What The F*ck You Want To Public License
4 stars 1 forks source link

gcd() buggy #2

Open ghost opened 10 years ago

ghost commented 10 years ago

The gcd() function seems to have an issue. It loops and nevey goes from w to (w+2). Tried to make it compatible with my Java implementation and got stuck on this. Added some printfs to show state, but it's pretty obvious - I think, if not please discard. ("w - ..." is state->w in the gcd loop).

STATE: i=0 j=0 k=0 z=0 a=35 w=1

84:87:85:86:83:01:00:05:81:04:82:09:0b:0c:0e:8d:0f:8b:89:03:07:02:13:8e:12:08:11:18:10:88:0d:80:1e:20..............:c9:ca:cb:cc:cd:ce:cf:d0:d1:d2:d3:d4:d5:d6:d7:d8:d9:da:db:dc:dd:de:df:e0:e1:e2:e3:e4:e5:e6:e7:e8:e9:ea:eb:ec:ed:ee:ef:f0:f1:f2:f3:f4:f5:f6:f7:f8:f9:fa:fb:fc:fd:fe:ff: w | 1 w - 2 w - 3 w - 4 w - 5 ..... w - 255 w - 0 w - 1 ''''''''''''''''''AFTERFIRSTWHIP''''''''''''''''''''' STATE: i=0 j=43 k=60 z=0 a=35 w=1 <================ should be 3! 5d:55:85:e0:e7:03:a4:32:c5:01:ff:f9:61:4e:20:8b:c9:8a:ab:f3:4a:e5:de:3c:1d:0e:9f:a7:ac:31:b6:5b:6a:db:81:99:8e:64:19:89:96:11:e6:c0:bb:46:58:13:6b:6c:28:a3:10:d2:b4:f6:94:54:83:1e:77:ba:ed:ca:ce:53:cb:7b:b1:2c:21:2e:6d:87:44:76:66:f5:14:0c:f4:27:84:e8:57:95:c1:97:0d:00:dc:75:b7:50:93:3b:c2:43:47:fc:d8:24:b0:41:71:b5:dd:3f:c4:c8:16:f0:02:a9:05:7e:82:59:09:1

ghost commented 10 years ago

I changed it to the w+2 variant and it's now compatible to my Java code (https://github.com/coderslagoon/estreamJ).

(modified-spritzsaber output is used in the test cases).