| @@ -4,7 +4,7 @@ |
| 4 | 4 | /// import argon2 |
| 5 | 5 | /// |
| 6 | 6 | /// let stored = argon2.hash_password("hunter2", argon2.default_params()) |
| 7 | | −/// argon2.verify("hunter2", stored) // True |
| 7 | +/// argon2.verify("hunter2", stored) // Ok(True) |
| 8 | 8 | /// |
| 9 | 9 | /// Hashing and verifying run on the blocking pool: the calling actor waits, |
| 10 | 10 | /// others keep running. |
| @@ -30,8 +30,10 @@ pub fn hash(password: String, salt: String, params: Params) -> Result<String, St |
| 30 | 30 | hash_raw(password, salt, params.t_cost, params.m_cost_kib, params.parallelism) |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | | −/// Whether `password` matches `encoded`, a string made by `hash`. |
| 34 | | −pub fn verify(password: String, encoded: String) -> Bool / <ffi> { |
| 33 | +/// `Ok(True)` if `password` matches `encoded`, a string made by `hash`, |
| 34 | +/// `Ok(False)` if it does not, or an `Error` if `encoded` is not an |
| 35 | +/// Argon2id hash this package can check (for example, a corrupted one). |
| 36 | +pub fn verify(password: String, encoded: String) -> Result<Bool, String> / <ffi> { |
| 35 | 37 | verify_raw(encoded, password) |
| 36 | 38 | } |
| 37 | 39 | |
| @@ -39,4 +41,4 @@ pub fn verify(password: String, encoded: String) -> Bool / <ffi> { |
| 39 | 41 | fn hash_raw(password: String, salt: String, t_cost: Int, m_cost: Int, parallelism: Int) -> Result<String, String> / <ffi> |
| 40 | 42 | |
| 41 | 43 | @extern(c, "louise_argon2_verify", blocking) |
| 42 | | −fn verify_raw(encoded: String, password: String) -> Bool / <ffi> |
| 44 | +fn verify_raw(encoded: String, password: String) -> Result<Bool, String> / <ffi> |