crypton-1.0.1: Cryptography Primitives sink

License | BSD-style
Maintainer | Vincent Hanquez <vincent@snarc.org>
Stability | stable
Portability | good
Safe Haskell | None
Language | Haskell2010

Crypto.Cipher.Salsa

Description

Synopsis

- initialize :: (ByteArrayAccess key, ByteArrayAccess nonce) => Int -> key -> nonce -> State
- combine :: ByteArray ba => State -> ba -> (ba, State)
- generate :: ByteArray ba => State -> Int -> (ba, State)
- newtype State = State ScrubbedBytes

# Documentation

initialize #

Arguments

:: (ByteArrayAccess key, ByteArrayAccess nonce) |
=> Int | number of rounds (8,12,20)
-> key | the key (128 or 256 bits)
-> nonce | the nonce (64 or 96 bits)
-> State | the initial Salsa state

Initialize a new Salsa context with the number of rounds, the key and the nonce associated.

combine #

Arguments

:: ByteArray ba |
=> State | the current Salsa state
-> ba | the source to xor with the generator
-> (ba, State) |

Combine the salsa output and an arbitrary message with a xor, and return the combined output and the new state.

generate #

Arguments

:: ByteArray ba |
=> State | the current Salsa state
-> Int | the length of data to generate
-> (ba, State) |

Generate a number of bytes from the Salsa output directly

newtype State #

Salsa context

Constructors

State ScrubbedBytes |

#### Instances

Instances details

NFData State # |
Instance details Defined in Crypto.Cipher.Salsa Methods rnf :: State -> () #