0 | module Crypto.BCrypt.FFI
 1 |
 2 | %default total
 3 |
 4 | ||| Generate a new bcrypt salt.
 5 | |||
 6 | ||| The supplied cost factor should be between 4 and 31 inclusive.
 7 | |||
 8 | ||| Values outside this range are handled according to the underlying libbcrypt implementation.
 9 | |||
10 | export %foreign "C:idris2_bcrypt_gensalt,bcrypt-idris"
11 | prim__bcryptGenSalt : Bits8 -> PrimIO String
12 |
13 | ||| Hash a password using a newly generated bcrypt salt.
14 | |||
15 | ||| The supplied cost factor should be between 4 and 31 inclusive.
16 | |||
17 | ||| Values outside this range are handled according to the underlying libbcrypt implementation.
18 | |||
19 | export %foreign "C:idris2_bcrypt_hash,bcrypt-idris"
20 | prim__bcryptHash : String -> Bits8 -> PrimIO String
21 |
22 | ||| Hash a password using an existing bcrypt salt or bcrypt hash.
23 | |||
24 | ||| The supplied salt may either be a bcrypt salt or a previously generated bcrypt hash.
25 | |||
26 | ||| When a hash is supplied, its embedded salt is reused.
27 | |||
28 | export %foreign "C:idris2_bcrypt_hash_with_salt,bcrypt-idris"
29 | prim__bcryptHashWithSalt : String -> String -> PrimIO String
30 |
31 | ||| Validate a password against a bcrypt hash.
32 | |||
33 | ||| Returns:
34 | ||| - 1 if the password matches.
35 | ||| - 0 otherwise.
36 | |||
37 | export %foreign "C:idris2_bcrypt_validate,bcrypt-idris"
38 | prim__bcryptValidate : String -> String -> PrimIO Int
39 |