Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Digest' a = Digest' (Digest a)
- zero :: forall hash. HashAlgorithm hash => Digest' hash
- data DoubleHash hash = DoubleHash
- type SHA256d = DoubleHash SHA256
- toBytes :: ByteArrayAccess a => a -> ByteString
- digestPtrToByteString :: forall hash. HashAlgorithm hash => Ptr (Digest hash) -> IO ByteString
Documentation
A newtype wrapper around Digest which comes with the string interpretation Tahoe-LAFS is accustomed to (lowercase base32 rather than lowercase base16), as well as a ToExpr instance for participation in nice diff computation.
Instances
Eq (Digest' a) Source # | |
Ord (Digest' a) Source # | |
Defined in Tahoe.CHK.SHA256d | |
HashAlgorithm hash => Show (Digest' hash) Source # | |
HashAlgorithm hash => IsString (Digest' hash) Source # | |
Defined in Tahoe.CHK.SHA256d fromString :: String -> Digest' hash # | |
ByteArrayAccess (Digest' hash) Source # | |
ToExpr (Digest' a) Source # | |
Defined in Tahoe.CHK.SHA256d |
zero :: forall hash. HashAlgorithm hash => Digest' hash Source #
The all-zero digest value at a specific hash algorithm.
data DoubleHash hash Source #
A hash algorithm which computes its digest using the parameterized hash algorithm and then computes a digest of _that_ digest with the same hash algorithm.
Instances
Data hash => Data (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DoubleHash hash -> c (DoubleHash hash) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (DoubleHash hash) # toConstr :: DoubleHash hash -> Constr # dataTypeOf :: DoubleHash hash -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (DoubleHash hash)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (DoubleHash hash)) # gmapT :: (forall b. Data b => b -> b) -> DoubleHash hash -> DoubleHash hash # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DoubleHash hash -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DoubleHash hash -> r # gmapQ :: (forall d. Data d => d -> u) -> DoubleHash hash -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DoubleHash hash -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DoubleHash hash -> m (DoubleHash hash) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DoubleHash hash -> m (DoubleHash hash) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DoubleHash hash -> m (DoubleHash hash) # | |
Show hash => Show (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d showsPrec :: Int -> DoubleHash hash -> ShowS # show :: DoubleHash hash -> String # showList :: [DoubleHash hash] -> ShowS # | |
HashAlgorithm hash => HashAlgorithm (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d type HashBlockSize (DoubleHash hash) :: Nat # type HashDigestSize (DoubleHash hash) :: Nat # type HashInternalContextSize (DoubleHash hash) :: Nat # hashBlockSize :: DoubleHash hash -> Int # hashDigestSize :: DoubleHash hash -> Int # hashInternalContextSize :: DoubleHash hash -> Int # hashInternalInit :: Ptr (Context (DoubleHash hash)) -> IO () # hashInternalUpdate :: Ptr (Context (DoubleHash hash)) -> Ptr Word8 -> Word32 -> IO () # hashInternalFinalize :: Ptr (Context (DoubleHash hash)) -> Ptr (Digest (DoubleHash hash)) -> IO () # | |
type HashInternalContextSize (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d | |
type HashDigestSize (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d | |
type HashBlockSize (DoubleHash hash) Source # | |
Defined in Tahoe.CHK.SHA256d |
type SHA256d = DoubleHash SHA256 Source #
The double SHA256 hash algorithm.
toBytes :: ByteArrayAccess a => a -> ByteString Source #
Extract the bytes from a value like a Digest
hash`.
digestPtrToByteString :: forall hash. HashAlgorithm hash => Ptr (Digest hash) -> IO ByteString Source #
Read the digest bytes out of a pointer to a Digest. This uses some coerce trickery. I hope it's not too broken.