.
This commit is contained in:
parent
44c4faf55e
commit
59c70ffdd0
1 changed files with 17 additions and 17 deletions
34
chacha20.l
34
chacha20.l
|
@ -89,15 +89,18 @@
|
|||
(_set D (_rol32 (_xor (_get D) (_get A)) 8)) # d = rotl32(d ^ a, 8);
|
||||
(_set C (_mod32 (_plus (_get C) (_get D)))) # c += d;
|
||||
(_set B (_rol32 (_xor (_get B) (_get C)) 7)) ) ) # b = rotl32(b ^ c, 7);
|
||||
|
||||
(de chacha20_h (Key Data)
|
||||
(let (C (circ 0 8 16 24) Lst (conc (mapcar char (chop "expand 32-byte k")) Key Data)
|
||||
In
|
||||
(make
|
||||
(do 16
|
||||
(link
|
||||
(apply
|
||||
|
|
||||
(mapcar >> (0 -8 -16 -24) (cut 4 'Lst)) ) ) ) ) )
|
||||
(let
|
||||
(C (circ 0 8 16 24)
|
||||
Lst (conc (mapcar char (chop "expand 32-byte k")) Key Data)
|
||||
In
|
||||
(make
|
||||
(do 16
|
||||
(link
|
||||
(apply
|
||||
|
|
||||
(mapcar >> (0 -8 -16 -24) (cut 4 'Lst)) ) ) ) ) )
|
||||
(for (I . N) In
|
||||
(let C (intern (pack 't (dec I)))
|
||||
(start C)
|
||||
|
@ -114,16 +117,14 @@
|
|||
(_quarter 't3 't4 't9 't14) ) )
|
||||
(prog1
|
||||
(make
|
||||
(for N (make (for I (conc (range 0 3) (range 12 15)) (link (_get (intern (pack 't I))))))
|
||||
(for N
|
||||
(make
|
||||
(for I (conc (range 0 3) (range 12 15))
|
||||
(link (_get (intern (pack 't I)))) ) )
|
||||
(do 4
|
||||
(link (& (>> (pop 'C) N) `(hex "FF"))) )
|
||||
)
|
||||
)
|
||||
(link (& (>> (pop 'C) N) 255)) ) ) )
|
||||
(for I 16
|
||||
(co (intern (pack 't (dec I)))) )
|
||||
)
|
||||
)
|
||||
)
|
||||
(co (intern (pack 't (dec I)))) ) ) ) )
|
||||
(test
|
||||
(23 91 25 239 23 223 133 162 86 90 166 239 136 98 205 220 217 62 240 104 187 99 233 25 243 209 76 21 248 89 40 56)
|
||||
(chacha20_h (range 1 32) (range 1 16)) )
|
||||
|
@ -132,4 +133,3 @@
|
|||
(chacha20_h (need 32 255) (need 16 255)) )
|
||||
(msg 'ok)
|
||||
(bye)
|
||||
|
||||
|
|
Loading…
Reference in a new issue