Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Hash
- = SHA256 !ByteString
- | NoHash
- encodeBase16 :: Hash -> ByteString
- decodeBase16 :: ByteString -> Hash
- sha256 :: ByteString -> Hash
- sha256sum :: ByteString -> String
- rawHash :: Hash -> ByteString
- match :: Hash -> Hash -> Bool
- sha1PS :: ByteString -> SHA1
- data SHA1 = SHA1 !Word32 !Word32 !Word32 !Word32 !Word32
- showAsHex :: Word32 -> String
- sha1Xor :: SHA1 -> SHA1 -> SHA1
- sha1zero :: SHA1
- sha1short :: SHA1 -> Word32
- sha1Show :: SHA1 -> ByteString
- sha1Read :: ByteString -> Maybe SHA1
Documentation
encodeBase16 :: Hash -> ByteString Source #
Produce a base16 (ascii-hex) encoded string from a hash. This can be turned back into a Hash (see "decodeBase16". This is a loss-less process.
decodeBase16 :: ByteString -> Hash Source #
Take a base16-encoded string and decode it as a Hash. If the string is malformed, yields NoHash.
sha256 :: ByteString -> Hash Source #
Compute a sha256 of a (lazy) ByteString.
sha256sum :: ByteString -> String Source #
Same as previous but general purpose.
rawHash :: Hash -> ByteString Source #
sha1PS :: ByteString -> SHA1 Source #
sha1Show :: SHA1 -> ByteString Source #
sha1Read :: ByteString -> Maybe SHA1 Source #
Parse a SHA1
directly from its B16 encoding, given as a ByteString
,
or return Nothing
. The implementation is quite low-level and optimized
because the current implementation of RepoPatchV3 has to read lots of SHA1
hashes, and profiling showed that this is a bottleneck.