Improved ARC4 (IARC4)


/ Published in: Python
Save to your folder(s)

This code is public domain.

Improved ARC4 (IARC4) contains a number of proposed improvements over naive ARC4:

- Uses KSA from VMPC minus an IV.
- Uses 2 state spaces (RC4A). Splits the key and nonce to produce a key and nonce for each state space. Each subkey and subnonce is XOR'd together to produce a new subkey. **TODO**: They should be hashed, but they are not currently, until I select a hash function with an appropriately sized output, which won't limit the keyspace available to IARC4.
- Takes a nonce alongside the key. The key and nonce must be random and of even, equal length, with 512 bytes per key/nonce suggested.
- Drops the first 8192 (4096 per state space) iterations of the PRNG (RC4-drop8192).
- A KeyExpiredError is raised after 255 iterations of the PRNG, excluding the initial drop. Passing the `expires` option to IARC4 will alter this limit.

This code should not be considered secure. It has not been cryptanalyzed and should not be used in production. This code is strictly experimental.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.