content-store-0.1.0: Store and retrieve data from an on-disk store

Copyright(c) 2017 Red Hat Inc.
Safe HaskellNone



Functions for working with digest algorithms as used by the content store



data DigestAlgorithm Source #

A DigestAlgorithm represents one specific hash algorithm.

getDigestAlgorithm :: Text -> Maybe DigestAlgorithm Source #

Given the Text name of a digest algorithm, return a DigestAlgorithm (or Nothing if we don't recognize the DigestAlgorithm's name).

digestSize :: DigestAlgorithm -> Int Source #

The size of the ObjectDigest returned by this DigestAlgorithm.

data DigestContext Source #

Holds the context for a given instance of a DigestAlgorithm.

digestUpdate :: ByteArrayAccess ba => DigestContext -> ba -> DigestContext Source #

Update the DigestContext with one 'ByteString'/'Bytes'/etc item.

digestUpdates :: ByteArrayAccess ba => DigestContext -> [ba] -> DigestContext Source #

Update the DigestContext with many 'ByteString'/'Bytes'/etc. items.

digestFinalize :: DigestContext -> ObjectDigest Source #

Finish the digest, returning an ObjectDigest.

digestByteString :: DigestAlgorithm -> ByteString -> ObjectDigest Source #

Hash a strict ByteString into an ObjectDigest.

toHex :: ObjectDigest -> String Source #

Convert an ObjectDigest to its hex representation. TODO: probably more efficient if we can just coerce the converted Bytes..

fromByteString :: ByteArrayAccess ba => DigestAlgorithm -> ba -> Maybe ObjectDigest Source #

Check and convert a ByteString into an ObjectDigest.