Copyright | (c) 2009, 2010, 2012-2015 Peter Trško |
---|---|
License | BSD3 |
Maintainer | Peter Trško <peter.trsko@gmail.com> |
Stability | Provisional |
Portability | BangPatterns, CPP, DeriveDataTypeable, DeriveGeneric, ForeignFunctionInterface, NoImplicitPrelude |
Safe Haskell | None |
Language | Haskell98 |
Data.Digest.ApacheMD5.Internal
Description
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.
Constructors
Salt ByteString |
ApacheMD5 Hash
Arguments
:: (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 Base64.
This module provides encode64
for producing Apache htpasswd
compatible
Base64 encoding.
Base64-like encoding
Alphabet used by encode64
.
encode64 :: ByteString -> ByteString Source
Encode raw MD5 hash in to Base64-like encoding used by Apache htpasswd
.
OpenSSL Bindings
md5BS :: ByteString -> ByteString Source
Thin Haskell wrapper around OpenSSL's MD5 hash function.
Length of MD5 hash in octets.