apache-md5- Apache specific MD5 digest algorighm.

Copyright(c) 2009, 2010, 2012-2015 Peter Trško
MaintainerPeter Trško <peter.trsko@gmail.com>
PortabilityBangPatterns, CPP, DeriveDataTypeable, DeriveGeneric, ForeignFunctionInterface, NoImplicitPrelude
Safe HaskellNone




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 Source

Type alias for more readable type signatures.

newtype Salt Source

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.


Salt ByteString 

ApacheMD5 Hash

apacheMD5 Source


:: (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

alpha64 :: ByteString Source

Alphabet used by encode64.

isAlpha64 :: Word8 -> Bool Source

Check if specified 8 bit word is a valid member of alpha64.

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.

md5DigestLength :: Int Source

Length of MD5 hash in octets.