Skip to content

Commit

Permalink
docs(hsh): 📝 updated source code documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienrousseau committed Nov 5, 2023
1 parent 678f4d0 commit b31e90e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/algorithms/bcrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ pub struct Bcrypt;
impl HashingAlgorithm for Bcrypt {
/// Hashes a given password using the Bcrypt algorithm.
///
/// Given a plaintext `password` and a `salt`, this method returns a hashed representation
/// of the password using the Bcrypt algorithm.
/// This method computes a hashed representation of the plaintext `password` using the Bcrypt algorithm.
/// Note that the `salt` parameter is not used in this implementation, as Bcrypt generates its own salt internally.
///
/// # Parameters
///
/// - `password`: The plaintext password to be hashed.
/// - `salt`: A cryptographic salt to prevent rainbow table attacks.
/// - `_salt`: Unused in this implementation, provided for interface compatibility.
///
/// # Returns
///
Expand Down
4 changes: 4 additions & 0 deletions src/algorithms/scrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl HashingAlgorithm for Scrypt {
/// Returns a `Result` containing the hashed password as a vector of bytes.
/// If hashing fails for some reason, it returns a `String` detailing the error.
fn hash_password(password: &str, salt: &str) -> Result<Vec<u8>, String> {
// The `Params` struct is initialized with specific parameters that define the
// computational cost of the hashing process. The parameters used here are chosen
// to provide a balance between security and performance. Adjust these values based
// on the security requirements and the expected computational capacity.
let params = Params::new(14, 8, 1, 64).map_err(|e| e.to_string())?;
let mut output = [0u8; 64];
scrypt(
Expand Down

0 comments on commit b31e90e

Please sign in to comment.