crypton-2.2.5: Cryptography Primitives
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Crypto.MAC.Poly1305

Description

Poly1305 implementation

Synopsis

Documentation

type Ctx = State Source #

Deprecated: use Poly1305 State instead

Poly1305 State. use State instead of Ctx

data State Source #

Poly1305 State

This type is an instance of ByteArrayAccess for debugging purpose. Internal layout is architecture dependent, may contain uninitialized data fragments, and change in future versions. The bytearray should not be used as input to cryptographic algorithms.

Instances

Instances details
ByteArrayAccess State Source # 
Instance details

Defined in Crypto.MAC.Poly1305

Methods

length :: State -> Int #

withByteArray :: State -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: State -> Ptr p -> IO () #

data Key Source #

A Poly1305 key: thirty-two bytes, and the length is checked here rather than at every use. initialize and auth take one of these and cannot fail, so a caller that holds a key does not carry an error case for a length it already knows is right.

Instances

Instances details
NFData Key Source # 
Instance details

Defined in Crypto.Internal.Poly1305

Methods

rnf :: Key -> () #

Eq Key Source # 
Instance details

Defined in Crypto.Internal.Poly1305

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

ByteArrayAccess Key Source # 
Instance details

Defined in Crypto.Internal.Poly1305

Methods

length :: Key -> Int #

withByteArray :: Key -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: Key -> Ptr p -> IO () #

key :: ByteArrayAccess ba => ba -> CryptoFailable Key Source #

Take thirty-two bytes for a key. A different length is reported as CryptoError_MacKeyInvalid; nothing else about a key can be wrong.

newtype Auth Source #

Poly1305 Auth

Constructors

Auth Bytes 

Instances

Instances details
NFData Auth Source # 
Instance details

Defined in Crypto.MAC.Poly1305

Methods

rnf :: Auth -> () #

Eq Auth Source # 
Instance details

Defined in Crypto.MAC.Poly1305

Methods

(==) :: Auth -> Auth -> Bool #

(/=) :: Auth -> Auth -> Bool #

ByteArrayAccess Auth Source # 
Instance details

Defined in Crypto.MAC.Poly1305

Methods

length :: Auth -> Int #

withByteArray :: Auth -> (Ptr p -> IO a) -> IO a #

copyByteArrayToPtr :: Auth -> Ptr p -> IO () #

Incremental MAC Functions

initialize :: Key -> State Source #

initialize a Poly1305 context

update :: ByteArrayAccess ba => State -> ba -> State Source #

update a context with a bytestring

updates :: ByteArrayAccess ba => State -> [ba] -> State Source #

updates a context with multiples bytestring

finalize :: State -> Auth Source #

finalize the context into a digest bytestring

One-pass MAC function

auth :: ByteArrayAccess ba => Key -> ba -> Auth Source #

One-pass authorization creation