Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data HashAlgo :: Type -> Type where
- class HashAlgorithm a => NamedAlgo a where
- algoToText :: forall t. HashAlgo t -> Text
- textToAlgo :: Text -> Either String (Some HashAlgo)
- mkNamedDigest :: Text -> Text -> Either String (DSum HashAlgo Digest)
- mkStorePathHash :: forall a. HashAlgorithm a => ByteString -> ByteString
- data BaseEncoding
- encodeDigestWith :: BaseEncoding -> Digest a -> Text
- decodeDigestWith :: HashAlgorithm a => BaseEncoding -> Text -> Either String (Digest a)
- algoDigestBuilder :: DSum HashAlgo Digest -> Builder
- digestBuilder :: forall hashAlgo. NamedAlgo hashAlgo => Digest hashAlgo -> Builder
Documentation
data HashAlgo :: Type -> Type where Source #
HashAlgo_MD5 :: HashAlgo MD5 | |
HashAlgo_SHA1 :: HashAlgo SHA1 | |
HashAlgo_SHA256 :: HashAlgo SHA256 | |
HashAlgo_SHA512 :: HashAlgo SHA512 |
class HashAlgorithm a => NamedAlgo a where Source #
A HashAlgorithm
with a canonical name, for serialization
purposes (e.g. SRI hashes)
Instances
NamedAlgo MD5 Source # | |
Defined in System.Nix.Hash | |
NamedAlgo SHA1 Source # | |
Defined in System.Nix.Hash | |
NamedAlgo SHA256 Source # | |
Defined in System.Nix.Hash | |
NamedAlgo SHA512 Source # | |
Defined in System.Nix.Hash |
algoToText :: forall t. HashAlgo t -> Text Source #
Make DSum HashAlgo Digest
based on provided SRI hash name
and its encoded form
mkStorePathHash :: forall a. HashAlgorithm a => ByteString -> ByteString Source #
data BaseEncoding Source #
Constructors to indicate the base encodings
NixBase32 | |
Base16 | ^ Nix has a special map of Base32 encoding Placed first, since it determines Haskell optimizations of pattern matches, & NixBase seems be the most widely used in Nix. |
Base64 |
Instances
encodeDigestWith :: BaseEncoding -> Digest a -> Text Source #
Take BaseEncoding type of the output -> take the Digeest as input -> encode Digest
decodeDigestWith :: HashAlgorithm a => BaseEncoding -> Text -> Either String (Digest a) Source #
Take BaseEncoding type of the input -> take the input itself -> decodeBase into Digest