Copyright | (C) Seth Paul Hubbard 2023 |
---|---|
License | BSD-3-Clause |
Maintainer | The Haskell Cryptography Group |
Stability | Stable |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data ScryptHash
- scryptHashPassword :: StrictByteString -> IO ScryptHash
- scryptVerifyPassword :: StrictByteString -> ScryptHash -> IO Bool
- scryptHashToByteString :: ScryptHash -> StrictByteString
- scryptHashToText :: ScryptHash -> Text
- asciiTextToScryptHash :: Text -> ScryptHash
- asciiByteStringToScryptHash :: StrictByteString -> ScryptHash
Introduction
This API is used for hashing and verifying passwords using the Scrypt algorithm. This module is provided for interoperability with other applications. If you do not need to use Scrypt specifically, use Sel.Hashing.Password.
data ScryptHash Source #
A hashed password from the Scrypt algorithm.
Since: 0.0.1.0
Instances
Show ScryptHash Source # | Since: 0.0.1.0 |
Defined in Sel.Scrypt showsPrec :: Int -> ScryptHash -> ShowS # show :: ScryptHash -> String # showList :: [ScryptHash] -> ShowS # | |
Eq ScryptHash Source # | Since: 0.0.1.0 |
Defined in Sel.Scrypt (==) :: ScryptHash -> ScryptHash -> Bool # (/=) :: ScryptHash -> ScryptHash -> Bool # | |
Ord ScryptHash Source # | Since: 0.0.1.0 |
Defined in Sel.Scrypt compare :: ScryptHash -> ScryptHash -> Ordering # (<) :: ScryptHash -> ScryptHash -> Bool # (<=) :: ScryptHash -> ScryptHash -> Bool # (>) :: ScryptHash -> ScryptHash -> Bool # (>=) :: ScryptHash -> ScryptHash -> Bool # max :: ScryptHash -> ScryptHash -> ScryptHash # min :: ScryptHash -> ScryptHash -> ScryptHash # | |
Display ScryptHash Source # | Since: 0.0.1.0 |
Defined in Sel.Scrypt displayBuilder :: ScryptHash -> Builder # displayList :: [ScryptHash] -> Builder # displayPrec :: Int -> ScryptHash -> Builder # |
Password Hashing and Verifying.
scryptHashPassword :: StrictByteString -> IO ScryptHash Source #
Hash the password with the Scrypt algorithm and a set of pre-defined parameters.
The hash is encoded in a human-readable format that includes:
- The result of a memory-hard, CPU-intensive hash function applied to the password;
- The automatically generated salt used for the previous computation;
- The other parameters required to verify the password, including the algorithm identifier, its version, opslimit, and memlimit.
Example output: "$7$C6........dLONLMz8YfO.EKvzwOeqWVVLmXg62MC.hL1m1sYtO/$X9eNjVxdD4jHAhOVid3OLzNkpv6ADJSAXygOxXqGHg7NUL"
Since: 0.0.1.0
scryptVerifyPassword :: StrictByteString -> ScryptHash -> IO Bool Source #
Verify a hashed password against a password verification string. This returns True if successful.
Since: 0.0.1.0
Conversion
scryptHashToByteString :: ScryptHash -> StrictByteString Source #
Convert a ScryptHash
to a binary StrictByteString
.
Since: 0.0.1.0
scryptHashToText :: ScryptHash -> Text Source #
Convert a ScryptHash
to a hexadecimal-encoded Text
.
Since: 0.0.1.0
asciiTextToScryptHash :: Text -> ScryptHash Source #
Convert an ASCII-encoded password hash to a ScryptHash
This function does not perform ASCII validation.
Since: 0.0.1.0
asciiByteStringToScryptHash :: StrictByteString -> ScryptHash Source #
Convert an ASCII-encoded password hash to a ScryptHash
This function does not perform ASCII validation.
Since: 0.0.1.0