Hash Utilities
Utility functions for hashing in ClueQuest Go SDK
utils.HashPassword()
The HashPassword()
function hashes a given password using the Argon2 algorithm.
Arguments
password
(string): The password to be hashed.
Example
hashedPassword, err := utils.HashPassword("mysecretpassword")
if err != nil {
// handle error
}
utils.ComparePassword()
The ComparePassword()
function compares a hashed password with a plain text password to check if they match.
Arguments
password
(string): The plain text password to compare.encodedHash
(string): The hashed password to compare against.
Example
isValid, err := utils.ComparePassword("mysecretpassword", hashedPassword)
if err != nil {
// handle error
}
if isValid {
// password matches
} else {
// password does not match
}