-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples: fix (2022-03) #11927
examples: fix (2022-03) #11927
Conversation
Also, there is an error in require "crypto/bcrypt"
password = Crypto::Bcrypt.new "secret", "salt_of_16_chars" Unhandled exception: Invalid salt size (Crypto::Bcrypt::Error)
from crystal/src/crypto/bcrypt.cr:93:5 in 'initialize'
from crystal/src/crypto/bcrypt.cr:91:3 in 'new' |
The second argument needs to be a base64 encoded string that represents a byte slice with size 16. For example: Crypto::Bcrypt.new("secret", "AQIDBAUGBwgJCgsMDQ4PEA==") # => $2a$11$AQIDBAUGBwgJCgsMDQ4PE.jO8j7sDnyP0tyPC/HrVgzzeEvGdmSN2 |
On second thought... maybe we shouldn't provide an actually working salt value in the example. I'm sure there would be people who just copy the example code and never change the salt... |
This reverts commit 71d23f3.
Agreed. I want to correct only the ones that are definitely wrong, so I will leave the others as they are. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Let's catch up examples before Crystal 1.4 😃
Best regards,