MARC is a stream cipher that is a modification of RC4/ARC4. MARC claims to improve the weak key schedule of RC4 while improving the key-stream generation speed.
Algorithm
State
- Three unsigned 8-bit values, $i$, $j$ and $k$. All of them are initially set to $0$.
- A 256-element array $S$, containing the values from $0$ to $255$.
- $S_0 = 0$, $S_1 = 1$, $S_2 = 2$ and so on.
Left rotate
The algorithm makes use of an operation called “left-rotate” that operates on three values. Despite the name, it doesn’t have anything to do with bitwise rotations. It just swaps the values around.
Basically what happens after $leftRotate(x, y, z)$ is $x, y, z = y, z, x$.
Key schedule
Test vectors
If you set the key to hex bytes 0123456789abcdef
, you should get the following output.
bc53ac89 a1089065 f84df6bd 516e03e8 e9eef975
fbc9df22 85fd2e60 4f614cf0 295f4d9f 414898f9
2bbf3b1c 556c6324 b4f92008 9c3ce19b fda0cda1
b0517efb 0be1409e 2722ef46 d087933c 9ef6c8e3
fba9993a 5d4485af 85425aa1 6d0879a3 d0bd42f3
2d461198 3e9fe061 9c1449fc 2e988cc5 c07852be
96eb2d4b 9d817046 42485eb9 e08247ac 48b61966
e157ee8f 33def637 882e9670 44d56b5c b1ef24e5
a08c5495 2193f7a1 88d15a52 cdc079ae 4b36a3e5
89320486 11db7738 626c65e8 15d895d7 65baf1cb
13453f3b d1623f53 681381dd 1c8c00b3 eee33250
6cff2fa9 aa55d540 e0853ddc d2df9231 9350ed91
7a581834 cbdb8f15 6ef37e27 87e24358 84b83aa3
61711fa4 7bd5f354 bb186f4e fd34dd66 24c06267
838b3c94 b5f9f0fd 27d40b29 c982aed7 12bd7c0e
0ac341f7 5bc67199 e00cd5e7 3b1e5b8e 3ffafb77
e976fec4 c81829a1 b63f3df5 56b47dc4 f24abfe4
372681c4 129758de 0bd85549 379dae0c 228b9e72
6d1fe0f3 dc92b154 39aabf69 12ca05e0 2ee60326
e8685431 bb2cc3d3 43f25fca af087a7d 0eaed647
References
Zheng, J., & Li, J. (2013). MARC: Modified ARC4. Lecture Notes in Computer Science, 33-44. doi:10.1007/978-3-642-37119-6_3