The ISAAC cipher: Difference between revisions

Content added Content deleted
(J draft)
(J: bugfix)
Line 2,423: Line 2,423:
for_i.i.256 do.
for_i.i.256 do.
aa=. aa xor aa shl 13 _6 2 _16{~4|i
aa=. aa xor aa shl 13 _6 2 _16{~4|i
X=. i{mm
X=. i{mm
mm=: mm I}~ aa=. ub4 aa add mm{~I=. 256| i+128
aa=. aa add mm{~ 256| i+128
mm=: mm i}~ y=. ub4 aa add bb add mm{~ 256| X shl _2
y=. aa add bb add mm{~ 256| X shl _2
randrsl=: randrsl i}~ bb=. ub4 X add mm{~ 256| y shl _10
randrsl=: randrsl i}~ bb=. X add mm{~ 256| y shl _10
end.
end.
randcnt=: 0
randcnt=: 0
Line 2,483: Line 2,483:


Task example:<lang J> ,hfd 3 u:E=: vernam 'a Top Secret secret' [ 1 iSeed 'this is my secret key'
Task example:<lang J> ,hfd 3 u:E=: vernam 'a Top Secret secret' [ 1 iSeed 'this is my secret key'
1c0636190b1260233b35125f1e1d0e2f4c5422
1c0636190b12602359042445702912213c4224
vernam E [ 1 iSeed 'this is my secret key'
vernam E [ 1 iSeed 'this is my secret key'
a Top Secret secret</lang>
a Top Secret secret</lang>