Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Hash = SHA256 ShortByteString
- encodeBase16 :: Hash -> ByteString
- decodeBase16 :: ByteString -> Maybe Hash
- sha256 :: ByteString -> Hash
- sha256strict :: ByteString -> Hash
- sha256sum :: ByteString -> String
- rawHash :: Hash -> ByteString
- mkHash :: ByteString -> Hash
- match :: Maybe Hash -> Maybe Hash -> Bool
- encodeHash :: Hash -> String
- decodeHash :: String -> Maybe Hash
- showHash :: Maybe Hash -> String
- 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 -> Maybe Hash Source #
Take a base16-encoded string and decode it as a Hash. If the string is malformed, yields Nothing.
sha256 :: ByteString -> Hash Source #
Compute a sha256 of a (lazy) ByteString.
sha256strict :: ByteString -> Hash Source #
sha256sum :: ByteString -> String Source #
Same as previous but general purpose.
rawHash :: Hash -> ByteString Source #
mkHash :: ByteString -> Hash Source #
encodeHash :: Hash -> String 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.