Skip to content

Instantly share code, notes, and snippets.


Mat Byczkowski mbyczkowski

Block or report user

Report or block mbyczkowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mbyczkowski / with_active_support.rb
Last active Mar 31, 2020 — forked from tonytonyjan/rails_42_with_active_support.rb
session cookie decrypter for Rails 4.2+
View with_active_support.rb
require 'cgi'
require 'json'
require 'active_support'
def verify_and_decrypt_session_cookie(cookie, secret_key_base)
cookie = CGI::unescape(cookie)
salt = 'encrypted cookie'
signed_salt = 'signed encrypted cookie'
key_generator =, iterations: 1000)
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len]
You can’t perform that action at this time.