Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Ryan Taylor Long's Profile

GitHub User: rtlong

Site: http://rtlong.com

Comments by Ryan Taylor Long

Avatar

@Jelkster Totally! I've been watching Railscasts since 2007 and I've learned so much from them. I'm happy to be giving back now. Keep up the awesome work, Ryan!

Avatar

I am curious why one may want to use this type of caching over HTTP Caching (with Rack::Cache, for example)...

Avatar

Actually, bcrypt-ruby uses this method to parse the digest string:

def split_hash(h)
  _, v, c, mash = h.split('$')
  return v, c.to_i, h[0, 29].to_str, mash[-31, 31].to_str
end

The return of which is [version, cost, salt, hash]. So:

version: '2a'
cost: 10
salt: '$2a$10$QIFk4ytMIzE03/njtSMFme'
hash: 'dzhTyv8DVMMtWjqnFeW9FcQpBEf.u0.'

It is definitely cool!