Last active
December 17, 2015 01:39
-
-
Save jokester/da75e217f1653e125c40 to your computer and use it in GitHub Desktop.
BCrypt uses first 72 bytes instead of 72 chars.
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
irb(main):011:0> pass1 = "あ" * 50 | |
=> "ああああああああああああああああああああああああああああああああああああああああああああああああああ" | |
irb(main):012:0> pass1.size | |
=> 50 | |
irb(main):013:0> pass1.bytes.size | |
=> 150 | |
irb(main):014:0> secret1 = BCrypt::Password.create pass1 | |
=> "$2a$10$HvRPl.mj8fdRidaEtj9qK.8ecHygryxsKEkhBUNbo.GEzHA0UdoYC" | |
irb(main):015:0> pass2 = "あ" * 51 | |
=> "あああああああああああああああああああああああああああああああああああああああああああああああああああ" | |
irb(main):017:0> pass2.bytes.size | |
=> 153 | |
irb(main):018:0> secret1 == pass2 | |
=> true | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment