distribution-nixpkgs-1.1: Types and functions to manipulate the Nixpkgs distribution

Safe HaskellSafe
LanguageHaskell2010

Distribution.Nixpkgs.Hashes

Description

Render SHA message digests in the peculiar base32'ish format used by Nix.

Synopsis

Documentation

printSHA256 :: ByteString -> String Source #

Render a SHA265 message digest into the unusual base32 scheme used by Nix.

>>> printSHA256 (packHex "7459ca5c6e117538122f04caf3dbfc58303028c26c58943430c16ff28a3b1d49")
"0j8x7f5g4vy160s98n3cq8l30c2qzkdz7jh45w93hx8idrfclnbl"

packHex :: String -> ByteString Source #

Parse a hexadecimal hash representation into its binary form suitable for encoding with printSHA256.

>>> packHex "48656c6c6f2c20776f726c642e"
"Hello, world."

Leading zeros can be omitted:

>>> packHex "0"
"\NUL"