| Portability | Good |
|---|---|
| Stability | stable |
| Maintainer | Finn Espen Gundersen <finn@gundersen.net> |
| Safe Haskell | Safe-Inferred |
Crypto.Cipher.RC5
Description
Pure implementation of the RC5 variable size block cipher. http://en.wikipedia.org/wiki/RC5
You need to select a block size and number of rounds. If you are unsure, the most common settings are 64bit blocks with 12 rounds.
This implementation supports all the standard block lengths of 32, 64 & 128 bits. It even includes support for non-standard (not recommended) 16bit blocks.
In addition to being useful when required for e.g. legacy integration, this cipher's option of short block lengths makes it useful for encrypting small data such as database primary keys before display.
Introduced in 1994, RC5 has withstood the tests of time remarkably well.
Documentation
encrypt :: Int -> Int -> [Word8] -> [Word8] -> [Word8]Source
RC5 encryption
Using the given blocksize, number of rounds and key, encrypts the plaintext.
- Valid blocksizes are 16, 32, 64, 128
- Valid rounds are 0 - 256
If in doubt, 32bit blocks and 12 rounds is the most common combination
encrypt 32 12 [1,2,3,4] [0xFE,0x13,0x37,0x00]
Encrypts the plaintext (last) with a blocksize of 32 bits, 12 rounds and key [1,2,3,4]
Maximum key length is 256. A common (and sufficient) length is 16 bytes. The length of the result is divisible by the block size (i.e. 2, 4, 8, 16) On invalid input, the empty list is returned.