Copyright | (c) Leo D 2023 |
---|---|
License | BSD-3-Clause |
Maintainer | leo@apotheca.io |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Generate and validate Bcrypt password hashes
Synopsis
- pattern BOTAN_BCRYPT_WORK_FACTOR_FAST :: (Eq a, Num a) => a
- pattern BOTAN_BCRYPT_WORK_FACTOR_GOOD :: (Eq a, Num a) => a
- pattern BOTAN_BCRYPT_WORK_FACTOR_STRONG :: (Eq a, Num a) => a
- botan_bcrypt_generate :: Ptr Word8 -> Ptr CSize -> ConstPtr CChar -> BotanRNG -> CSize -> Word32 -> IO CInt
- botan_bcrypt_is_valid :: ConstPtr CChar -> ConstPtr CChar -> IO CInt
Documentation
pattern BOTAN_BCRYPT_WORK_FACTOR_FAST :: (Eq a, Num a) => a Source #
Should not cause noticable CPU usage
pattern BOTAN_BCRYPT_WORK_FACTOR_GOOD :: (Eq a, Num a) => a Source #
May cause noticable CPU usage
pattern BOTAN_BCRYPT_WORK_FACTOR_STRONG :: (Eq a, Num a) => a Source #
May block for several seconds
botan_bcrypt_generate Source #
:: Ptr Word8 | out: buffer holding the password hash, should be of length 64 bytes |
-> Ptr CSize | out_len: the desired output length in bytes |
-> ConstPtr CChar | password: the password |
-> BotanRNG | rng: a random number generator |
-> CSize | work_factor: how much work to do to slow down guessing attacks |
-> Word32 | flags: should be 0 in current API revision, all other uses are reserved and return BOTAN_FFI_ERROR_BAD_FLAG |
-> IO CInt | 0 on success, a negative value on failure |
Create a password hash using Bcrypt
Output is formatted bcrypt $2a$...
botan_bcrypt_is_valid Source #
:: ConstPtr CChar | pass: the password to check against |
-> ConstPtr CChar | hash: the stored hash to check against |
-> IO CInt | 0 if if this password/hash combination is valid, 1 if the combination is not valid (but otherwise well formed), negative on error |
Check a previously created password hash