-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Apache specific MD5 digest algorighm.
--
@package apache-md5
@version 0.6.1.2
-- | 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.
module Data.Digest.ApacheMD5.Internal
-- | Type alias for more readable type signatures.
type Password = ByteString
-- | 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.
newtype Salt
Salt :: ByteString -> Salt
-- | 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.
apacheMD5 :: (ByteString -> ByteString) -> Password -> Salt -> ByteString
-- | Alphabet used by encode64.
alpha64 :: ByteString
-- | Check if specified 8 bit word is a valid member of alpha64.
isAlpha64 :: Word8 -> Bool
-- | Encode raw MD5 hash in to Base64-like encoding used by Apache
-- htpasswd.
encode64 :: ByteString -> ByteString
-- | Thin Haskell wrapper around OpenSSL's MD5 hash function.
md5BS :: ByteString -> ByteString
-- | Length of MD5 hash in octets.
md5DigestLength :: Int
instance Typeable Salt
instance Eq Salt
instance Ord Salt
instance Read Salt
instance Show Salt
instance Data Salt
instance Generic Salt
instance Datatype D1Salt
instance Constructor C1_0Salt
-- | ApacheMD5 is one of the hash algorithms used by Apache HTTP server for
-- basic authentication. It is Apache specific, but e.g. nginx supports
-- this algorithm since version 1.0.3
-- http://wiki.nginx.org/HttpAuthBasicModule#auth_basic_user_file.
--
-- This is a naive implementation that doesn't aim for high speed, but to
-- be reasonably fast it uses MD5() function from OpenSSL
-- library so during compilation you'll nead to have it installed
-- including header files. Many Linux distributions have separate dev
-- packages for this.
module Data.Digest.ApacheMD5
-- | Taking password and salt this function produces resulting ApacheMD5
-- hash which is already base 64 encoded.
apacheMD5 :: Password -> Salt -> ByteString
-- | Type alias for more readable type signatures.
type Password = ByteString
-- | 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.
data Salt
-- | Smart constructor for Salt. It tests that provided
-- ByteString is not empty and that all its octets are members of
-- alphabet used for base 64 encoding alpha64 and it uses
-- isAlpha64 predicate to do so.
mkSalt :: ByteString -> Maybe Salt
-- | Unpack Salt in to ByteString.
unSalt :: Salt -> ByteString