| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Digest.Pure.MD5
Description
It is suggested you use the 'crypto-api' class-based interface to access the MD5 algorithm. Either rely on type inference or provide an explicit type:
hashFileStrict = liftM hash' . B.readFile hashFileLazyBS = liftM hash . B.readFile
Synopsis
- data MD5Context
- data MD5Digest
- md5InitialContext :: MD5Context
- md5 :: ByteString -> MD5Digest
- md5Update :: MD5Context -> ByteString -> MD5Context
- md5Finalize :: MD5Context -> ByteString -> MD5Digest
- md5DigestBytes :: MD5Digest -> ByteString
- class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d where
- outputLength :: Tagged d BitLength
- blockLength :: Tagged d BitLength
- initialCtx :: ctx
- updateCtx :: ctx -> ByteString -> ctx
- finalize :: ctx -> ByteString -> d
- hash :: ByteString -> d
- hash' :: ByteString -> d
Types
data MD5Context Source #
The type for final results.
Instances
| Binary MD5Context Source # | |
Defined in Data.Digest.Pure.MD5 | |
| Serialize MD5Context Source # | |
Defined in Data.Digest.Pure.MD5 | |
| Hash MD5Context MD5Digest Source # | |
Defined in Data.Digest.Pure.MD5 Methods outputLength :: Tagged MD5Digest BitLength # blockLength :: Tagged MD5Digest BitLength # updateCtx :: MD5Context -> ByteString -> MD5Context # finalize :: MD5Context -> ByteString -> MD5Digest # | |
After finalizing a context, using md5Finalize, a new type is returned to prevent 're-finalizing' the structure.
Instances
| Eq MD5Digest Source # | |
| Ord MD5Digest Source # | |
Defined in Data.Digest.Pure.MD5 | |
| Show MD5Digest Source # | |
| Binary MD5Digest Source # | |
| Serialize MD5Digest Source # | |
Defined in Data.Digest.Pure.MD5 | |
| Hash MD5Context MD5Digest Source # | |
Defined in Data.Digest.Pure.MD5 Methods outputLength :: Tagged MD5Digest BitLength # blockLength :: Tagged MD5Digest BitLength # updateCtx :: MD5Context -> ByteString -> MD5Context # finalize :: MD5Context -> ByteString -> MD5Digest # | |
Static data
md5InitialContext :: MD5Context Source #
The initial context to use when calling md5Update for the first time
Functions
md5 :: ByteString -> MD5Digest Source #
Processes a lazy ByteString and returns the md5 digest.
This is probably what you want. You can use show to produce the standard hex
representation.
md5Update :: MD5Context -> ByteString -> MD5Context Source #
Alters the MD5Context with a partial digest of the data.
The input bytestring MUST be a multiple of the blockSize or bad things can happen (incorrect digest results)!
md5Finalize :: MD5Context -> ByteString -> MD5Digest Source #
Closes an MD5 context, thus producing the digest.
md5DigestBytes :: MD5Digest -> ByteString Source #
The raw bytes of an MD5Digest. It is always 16 bytes long.
You can also use the Binary or Serialize instances to output the raw
bytes. Alternatively you can use show to produce the standard hex
representation.
Crypto-API interface
class (Serialize d, Eq d, Ord d) => Hash ctx d | d -> ctx, ctx -> d where #
Minimal complete definition
Methods
outputLength :: Tagged d BitLength #
blockLength :: Tagged d BitLength #
initialCtx :: ctx #
updateCtx :: ctx -> ByteString -> ctx #
Instances
| Hash MD5Context MD5Digest Source # | |
Defined in Data.Digest.Pure.MD5 Methods outputLength :: Tagged MD5Digest BitLength # blockLength :: Tagged MD5Digest BitLength # updateCtx :: MD5Context -> ByteString -> MD5Context # finalize :: MD5Context -> ByteString -> MD5Digest # | |