Contains hashing related functionality such as password hashing, and two iterations of a sha256.
sha256 function that takes data in a string format and returns a
sha256. It will be the same hash as long as the data originally used in the function is the same data. Do not use this for passwords.
const result = Athena.utility.hash.sha256('hello world');
Same as above, but the hash will always be random but not unique. Good for quick temporary random hash strings.
const result = Athena.utility.hash.sha256Random('hello world');
Used to take a plain text password and hash it with pbkdf2 and a salt. Safe to password storage.
const hashedPassword = Athena.utility.hash.hashPassword('mypasswordhere');
A password can be compared by getting the original hash and comparing it against the plain-text provided from the user.
const originalPassword = 'mypasswordhere'; const isValid = Athena.utility.hash.testPassword(originalPassword, hashedPassword);