Hi, I am new to both cryptography and sage and I was trying to write a sage code for the TRIVIUM cipher.
>From http://eeweb.poly.edu/faculty/karri/stream_ciphers/trivium.html i got the Test Vector and output key = 0x00000000000000000000 IV = 0x00000000000000000000 stream = 0xFBE0BF265859051B....... But when I run the code with key and IV as zeo vectors I am getting the output stream = 0xdf07fd641a9aa0d8 Can someone post a sage implementation of TRIVIUM cipher Trivium Key and IV setup --------------------------------- The algorithm is initialized by loading an 80-bit key and an 80-bit IV into the 288-bit initial state, and setting all remaining bits to 0, except for s286 , s287 , and s288 . Then, the state is rotated over 4 full cycles, in the same way as explained above, but without generating key stream bits. This is summarized in the pseudo-code below: (s1 , s2 , . . . , s93 ) ← (K1 , . . . , K80 , 0, . . . , 0) (s94 , s95 , . . . , s177 ) ← (IV1 , . . . , IV80 , 0, . . . , 0) (s178 , s279 , . . . , s288 ) ← (0, . . . , 0, 1, 1, 1) for i = 1 to 4 · 288 do t1 ← s66 + s91 · s92 + s93 + s171 t2 ← s162 + s175 · s176 + s177 + s264 t3 ← s243 + s286 · s287 + s288 + s69 (s1 , s2 , . . . , s93 ) ← (t3 , s1 , . . . , s92 ) (s94 , s95 , . . . , s177 ) ← (t1 , s94 , . . . , s176 ) (s178 , s179 , . . . , s288 ) ← (t2 , s178 , . . . , s287 ) end for Trivium Key stream generation --------------------------- The proposed design contains a 288-bit internal state denoted by (s1 , . . . , s288 ). The key stream generation consists of an iterative process which extracts the values of 15 specific state bits and uses them both to update 3 bits of the state and to compute 1 bit of key stream zi . The state bits are then rotated and the process repeats itself until the requested N ≤ 264 bits of key stream have been generated. A complete description is given by the following simple pseudo-code: for i = 1 to N do t1 ← s66 + s93 t2 ← s162 + s177 t3 ← s243 + s288 zi ← t 1 + t 2 + t 3 t1 ← t1 + s91 · s92 + s171 t2 ← t2 + s175 · s176 + s264 t3 ← t3 + s286 · s287 + s69 (s1 , s2 , . . . , s93 ) ← (t3 , s1 , . . . , s92 ) (s94 , s95 , . . . , s177 ) ← (t1 , s94 , . . . , s176 ) (s178 , s179 , . . . , s288 ) ← (t2 , s178 , . . . , s287 ) end for -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
