Advertisement
Guest User

Untitled

a guest
May 24th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. require 'bcrypt'
  2.  
  3. my_password = "\0hello is it me you're looking for";
  4. verify = BCrypt::Password.create(my_password)
  5.  
  6. puts my_password.inspect
  7. # This password verifies according to bcrypt
  8. puts verify == my_password ? ' password verified ' : 'password incorrect';
  9. # but also ...
  10. puts verify == '' ? ' But also verifies to a blank string' : 'Hey thats just a blank string';
  11. # or indeed any password that starts with a null byte
  12. puts verify == "\0I can see it you eyes" ? ' Yep password is good' : 'Hey thats different';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement