License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <[email protected]> |
Stability | stable |
Portability | Good |
Safe Haskell | None |
Language | Haskell98 |
Crypto.Cipher.RC4
Description
Simple implementation of the RC4 stream cipher. http://en.wikipedia.org/wiki/RC4
Initial FFI implementation by Peter White [email protected]
Reorganized and simplified to have an opaque context.
Synopsis
- data RC4
- newtype Ctx = Ctx ByteString
- initCtx :: ByteString -> Ctx
- generate :: Ctx -> Int -> (Ctx, ByteString)
- combine :: Ctx -> ByteString -> (Ctx, ByteString)
- encrypt :: Ctx -> ByteString -> (Ctx, ByteString)
- decrypt :: Ctx -> ByteString -> (Ctx, ByteString)
Documentation
RC4 Stream cipher
Instances
Byteable RC4 Source # | |
Defined in Crypto.Cipher.RC4 | |
Cipher RC4 Source # | |
Defined in Crypto.Cipher.RC4 Methods cipherInit :: Key RC4 -> RC4 # cipherName :: RC4 -> String # cipherKeySize :: RC4 -> KeySizeSpecifier # | |
StreamCipher RC4 Source # | |
Defined in Crypto.Cipher.RC4 Methods streamCombine :: RC4 -> ByteString -> (ByteString, RC4) # |
deprecated types
The encryption context for RC4
Constructors
Ctx ByteString |
deprecated functions, use crypto-cipher-types StreamCipher function
Arguments
:: ByteString | The key |
-> Ctx | The RC4 context with the key mixed in |
RC4 context initialization.
seed the context with an initial key. the key size need to be adequate otherwise security takes a hit.
generate :: Ctx -> Int -> (Ctx, ByteString) Source #
generate the next len bytes of the rc4 stream without combining it to anything.
Arguments
:: Ctx | rc4 context |
-> ByteString | input |
-> (Ctx, ByteString) | new rc4 context, and the output |
RC4 xor combination of the rc4 stream with an input
encrypt :: Ctx -> ByteString -> (Ctx, ByteString) Source #
Deprecated: use combine instead
decrypt :: Ctx -> ByteString -> (Ctx, ByteString) Source #
Deprecated: use combine instead