Copyright | (c) 2009, 2010, 2012 - 2014 Peter Trško |
---|---|
License | BSD3 |
Maintainer | Peter Trško <peter.trsko@gmail.com> |
Stability | Provisional |
Portability | non-portable (BangPatterns, CPP, DeriveDataTypeable, DeriveGeneric, ForeignFunctionInterface) |
Safe Haskell | None |
Language | Haskell98 |
Internal and unsafe functions used for implementing Apache MD5 hash algorithm.
Try to avoid using this module directly when possible, but there are situations when it might come handy.
- type Password = ByteString
- newtype Salt = Salt ByteString
- apacheMD5 :: (ByteString -> ByteString) -> Password -> Salt -> ByteString
- alpha64 :: ByteString
- isAlpha64 :: Word8 -> Bool
- encode64 :: ByteString -> ByteString
- md5BS :: ByteString -> ByteString
- md5DigestLength :: Int
Types
type Password = ByteString Source
Type alias for more readable type signatures.
Apache MD5 hash salt. When constructing .htpasswd
file it is necessary
for the salt to be consisting of octets from alpha64
"set". This newtype
along with mkSalt
smart constructor are here to ensure such invariant.
ApacheMD5 Hash
:: (ByteString -> ByteString) | MD5 hash function. |
-> Password | |
-> Salt | |
-> ByteString | Apache MD5 Hash |
Raw Apache MD5 implementation that is parametrized by MD5 implementation and doesn't encode result in to base 64.
Base64-like encoding
Alphabet used by encode64
.
encode64 :: ByteString -> ByteString Source
Encode raw MD5 hash in to Base64-like encoding.
OpenSSL Bindings
md5BS :: ByteString -> ByteString Source
Thin Haskell wrapper around OpenSSL's MD5 hash function.
Length of MD5 hash in octets.