Performs an all-or-nothing transform on a stream of chunks. The data can only be decrypted if every block is present to generate an HMAC for. The list of HMACs is then XOR’d against the final block from the transform, yielding the decryption key for the blocks.
Currently uses the HMAC key for encryption as well (TODO: change this). Reports a hash of the encrypted chunk for storage/retrieval without needing to calculate HMAC until decryption.
Needs a lot of cleanup and some fixes. Makes a lot of assumptions, for instance, that current_block, total_blocks, and data_size only occupy 1 byte apiece. Currently doesn’t strip padding after decoding, and doesn’t convert original integers for current_block, total_blocks, and data_size back from bytes.
(Python) ARC4
No comments yet
This is a pure Python implementation of raw ARC4, sans any improvements. For instance, it could take a nonce, use multiple state spaces (parallelizable), automatically discard the first 4K of the state space(s), use a more complex transformation than a simple swap, limit the # of bytes encrypted per nonce, etc.. The size of the state space is a parameter–the size of the key must not exceed the size of the state space.
Read More »