Coderwall
Ruby Python JavaScript Front-End Tools iOS
More Tips
Ruby Python JavaScript Front-End Tools iOS PHP Android .NET Java Jobs
Jobs
Sign In or Up
Last Updated: February 25, 2016
·
2.486K
· mrlamroger

Rails with bcrypt-ruby makes encryption ONE LINE

#ruby
#rails
#cipher
#algorithm
#bcrypt
#blowfish
#cryptography
#one
#line

These three magic words: "hassecurepassword"

I'm on chapter 6 of Michael Hartl's Rails tutorial and I am amazed at how easy it is to implement password encryption in rails!

http://ruby.railstutorial.org/chapters/modeling-users#sec-adding_a_secure_password

Of course, the code implementation can be found here:
https://github.com/rails/rails/blob/master/activemodel/lib/active_model/secure_password.rb

bcrypt uses the blowfish encryption algorithm, a symmetric key algorithm.
Heres more info on it:
http://en.wikipedia.org/wiki/Blowfish_%28cipher%29
http://www.ehow.com/info_10011200_blowfish-symmetric-encryption-algorithm.html

#ruby
#rails
#cipher
#algorithm
#bcrypt
#blowfish
#cryptography
#one
#line

Written by Roger Lam

Say Thanks
Respond

Related protips

HTTP Posts in Ruby

166.6K
9

Centered Text And Images In Github Markdown

142.8K
1

Take a photo of yourself every time you commit

112K
29

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Best #Ruby Authors
projectcleverweb
291.1K
#ruby
#javascript
#css
danielwestendorf
165.1K
#ruby
#Javascript
#CoffeeScript
mcansky
141.1K
#ruby
#JavaScript
#Shell
knoopx
113.4K
#ruby
#JavaScript
#CoffeeScript
stevennunez
100.9K
#ruby
#JavaScript
#CoffeeScript
Related Tags
#ruby
#rails
#cipher
#algorithm
#bcrypt
#blowfish
#cryptography
#one
#line
Sponsored by
#native_company#
#native_desc#
#native_cta#
Filed Under

Ruby Development Tips
Ruby on Rails Development Tips
Awesome Job
See All Jobs

Post a job for only $299
Thanks to our sponsor
Sponsored by #native_company# — Learn More
#native_title# #native_desc#
#native_cta#
@coderwall
APM product comparisons Contact Privacy Terms

Copyright 2025

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.