<% '======================================================================================================================= ' PASSWORD HELPERS (native G3CRYPTO: bcrypt) '======================================================================================================================= ' Replaces the old PowerShell/SHA-256 shell-out, which cannot run on AxonASP/Linux and put the password on a ' command line. Stored hashes are bcrypt ("$2a$..."), so previously stored SHA-256 hashes will not verify; reset them. Function HashPassword(password) Dim crypto Set crypto = Server.CreateObject("G3CRYPTO") HashPassword = crypto.HashPassword(password) Set crypto = Nothing End Function ' Returns True when username exists in Users and password matches its stored hash. Function CheckPassword(username, password) Dim crypto, rs, storedHash CheckPassword = False Set rs = DAL().Query("SELECT PasswordHash FROM Users WHERE UserName = ?", username) If rs.EOF Then rs.Close Exit Function End If storedHash = "" & rs("PasswordHash") rs.Close Set rs = Nothing Set crypto = Server.CreateObject("G3CRYPTO") CheckPassword = crypto.VerifyPassword(password, storedHash) Set crypto = Nothing End Function %>