Safe Haskell | None |
---|---|
Language | Haskell98 |
Storage.Hashed.Hash
Synopsis
- data Hash
- = SHA256 !ByteString
- | SHA1 !ByteString
- | NoHash
- encodeBase64u :: Hash -> ByteString
- decodeBase64u :: ByteString -> Hash
- encodeBase16 :: Hash -> ByteString
- decodeBase16 :: ByteString -> Hash
- sha256 :: ByteString -> Hash
- rawHash :: Hash -> ByteString
- match :: Hash -> Hash -> Bool
Documentation
Constructors
SHA256 !ByteString | |
SHA1 !ByteString | |
NoHash |
Instances
Eq Hash # | |
Data Hash # | |
Defined in Storage.Hashed.Hash Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Hash -> c Hash # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Hash # dataTypeOf :: Hash -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Hash) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Hash) # gmapT :: (forall b. Data b => b -> b) -> Hash -> Hash # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Hash -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Hash -> r # gmapQ :: (forall d. Data d => d -> u) -> Hash -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Hash -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Hash -> m Hash # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Hash -> m Hash # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Hash -> m Hash # | |
Ord Hash # | |
Read Hash # | |
Show Hash # | |
encodeBase64u :: Hash -> ByteString #
decodeBase64u :: ByteString -> Hash #
Take a base64/url-encoded string and decode it as a Hash. If the string is malformed, yields NoHash.
encodeBase16 :: Hash -> ByteString #
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 #
Take a base16-encoded string and decode it as a Hash. If the string is malformed, yields NoHash.
sha256 :: ByteString -> Hash #
Compute a sha256 of a (lazy) ByteString. However, although this works correctly for any bytestring, it is only efficient if the bytestring only has a sigle chunk.
rawHash :: Hash -> ByteString #