RC4 Algorithms¶
RC4(Rivest Cipher 4), also called ARC4, is a stream cipher. It is used widely because of its simplicity and remarkable speed. The length of initial key is not greater 256, 1<=key-length<=256. The encryption and decryption use a same RC4 algorithm as long as input same initial key.
Implementation¶
RC4 consist of 2 parts: initialization state, generate key stream and its encryption. Initial state is derived from input key while the key stream is generated by Pseudo-Random Generation Algorithm (PRGA) based on inner state. Inner states is stored in a array with 256 bytes. In each iteration, a byte key is output by PRGA and used to operate bitwise exclusive(XOR) with a byte in plain text. Its input width is 8 bits, so does output width.
Performance (Device: U250)¶
II | CLB | LUT | FF | DSP | BRAM | SRL | URAM | CP(ns) |
---|---|---|---|---|---|---|---|---|
2 | 1612 | 8552 | 6512 | 0 | 1 | 0 | 0 | 3.732 |