Last active
February 6, 2025 19:29
-
-
Save neontuna/dffd0452d09a0861106c0a46669a3ff0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
normalPassword = BCrypt::Password.create('love') | |
otherPassword = 'hate' | |
> normalPassword == otherPassword | |
=> false | |
userId = SecureRandom.alphanumeric(18) | |
username = SecureRandom.alphanumeric(55) | |
password = 'super-duper-secure-password' | |
combined = "#{userId}:#{username}:#{password}" | |
hash = BCrypt::Password.create(combined) | |
bad_password = 'not-the-same' | |
bad_string = "#{userId}:#{username}:#{bad_password}" | |
> hash == bad_string | |
=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment