Safe Haskell | None |
---|---|
Language | Haskell98 |
Hash-based message authentication code (HMAC).
- newtype HMAC a = HMAC {
- unHMAC :: a
- newtype HMACKey = HMACKey {}
- hmacKeyFromString64 :: OctetStream a => a -> HMACKey
- hmacKeyFromString128 :: OctetStream a => a -> HMACKey
- hmacSha1 :: OctetStream a => HMACKey -> a -> HMAC SHA1
- hmacSha256 :: OctetStream a => HMACKey -> a -> HMAC SHA256
- hmacSha512 :: OctetStream a => HMACKey -> a -> HMAC SHA512
- hmacMD5 :: OctetStream a => HMACKey -> a -> HMAC MD5
Documentation
The HMAC key should be an integer between 1
and 2^512-1
(or 2^1024-1
in case of SHA512)
hmacKeyFromString64 :: OctetStream a => a -> HMACKey Source #
Mainly for testing. 64 byte blocksize version.
Note: blocksize is 64 bytes (512 bits) for both SHA1 and SHA256 and even MD5, but 128 bytes (1024 bits) for SHA512
Also it seems that according the spec long keys should be hashed. Even though the hash is half as long (but we use zero padding anyway)
hmacKeyFromString128 :: OctetStream a => a -> HMACKey Source #
Mainly for testing. 128 byte blocksize version
Note: blocksize is 64 bytes (512 bits) for both SHA1 and SHA256 and even MD5, but 128 bytes (1024 bits) for SHA512
Also it seems that according the spec long keys should be hashed. Even though the hash is half as long (but we use zero padding anyway)
hmacSha256 :: OctetStream a => HMACKey -> a -> HMAC SHA256 Source #
hmacSha512 :: OctetStream a => HMACKey -> a -> HMAC SHA512 Source #