| Copyright | (c) 2025 Tim Emiola |
|---|---|
| License | BSD3 |
| Maintainer | Tim Emiola <adetokunbo@emio.la> |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.SRP.Hashing
Description
Provides the KnownAlgorithm abstraction over SHA1, SHA256, SHA384 and SHA512,
together with the SRP-specific hash combinators (calcK, calcClientX,
calcXorHashnHashg) that implement the intermediate steps from
RFC 5054 ยง2.6.
Synopsis
- data KnownAlgorithm
- digestSize :: KnownAlgorithm -> Word32
- hash :: KnownAlgorithm -> ByteString -> ByteString
- hashMany :: KnownAlgorithm -> [ByteString] -> ByteString
- hashText :: KnownAlgorithm -> Text -> ByteString
- calcK :: KnownAlgorithm -> PrimeGroup -> ByteString
- calcClientX :: (Text, Text) -> ByteString -> KnownAlgorithm -> ByteString
- calcXorHashnHashg :: KnownAlgorithm -> PrimeGroup -> ByteString
Supported hash algorithms
data KnownAlgorithm Source #
Enumerates specific hash algorithms supported by this package
Instances
| Show KnownAlgorithm Source # | |
Defined in Crypto.SRP.Hashing Methods showsPrec :: Int -> KnownAlgorithm -> ShowS # show :: KnownAlgorithm -> String # showList :: [KnownAlgorithm] -> ShowS # | |
| Eq KnownAlgorithm Source # | |
Defined in Crypto.SRP.Hashing Methods (==) :: KnownAlgorithm -> KnownAlgorithm -> Bool # (/=) :: KnownAlgorithm -> KnownAlgorithm -> Bool # | |
Use the KnownAlgorithms for hashing
KnownAlgorithmsdigestSize :: KnownAlgorithm -> Word32 Source #
The size of digest computed by a KnownAlgorithm
hash :: KnownAlgorithm -> ByteString -> ByteString Source #
Hash a ByteString using the hash function of a KnownAlgorithm
hashMany :: KnownAlgorithm -> [ByteString] -> ByteString Source #
Hash several ByteStrings using the hash function of a KnownAlgorithm
hashText :: KnownAlgorithm -> Text -> ByteString Source #
Hash a Text value after normalising it to NFKC form
SRP-specific hash calculations
calcK :: KnownAlgorithm -> PrimeGroup -> ByteString Source #
Compute the multiplier 'k' as a step in the calculation of the premaster secret
calcClientX :: (Text, Text) -> ByteString -> KnownAlgorithm -> ByteString Source #
Compute the hash 'x' as a step in the calculation of the premaster secret
calcXorHashnHashg :: KnownAlgorithm -> PrimeGroup -> ByteString Source #
Compute an XORed hash describing a .PrimeGroup