crypto-srp-0.1.0.2: SRP authentication primitives
Copyright(c) 2025 Tim Emiola
LicenseBSD3
MaintainerTim Emiola <adetokunbo@emio.la>
Safe HaskellNone
LanguageHaskell2010

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

Supported hash algorithms

data KnownAlgorithm Source #

Enumerates specific hash algorithms supported by this package

Constructors

SHA1 
SHA256 
SHA384 
SHA512 

Instances

Instances details
Show KnownAlgorithm Source # 
Instance details

Defined in Crypto.SRP.Hashing

Eq KnownAlgorithm Source # 
Instance details

Defined in Crypto.SRP.Hashing

Use the KnownAlgorithms for hashing

digestSize :: 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

See premaster secret calculation

calcClientX :: (Text, Text) -> ByteString -> KnownAlgorithm -> ByteString Source #

Compute the hash 'x' as a step in the calculation of the premaster secret

See premaster secret calculation

calcXorHashnHashg :: KnownAlgorithm -> PrimeGroup -> ByteString Source #

Compute an XORed hash describing a PrimeGroup.