Sha256: aeb4067a6b44e78a1a9bab19fb01a286d942816533f73f6288f4f658c2126d85

Contents?: true

Size: 446 Bytes

Versions: 5

Compression:

Stored size: 446 Bytes

Contents

class Encrypter
  def self.encrypt(input)
    return nil if input.nil?
    Base64.encode64(self.blowfish.encrypt_string(input))
  end

  def self.decrypt(input)
    return nil if input.nil?
    self.blowfish.decrypt_string(Base64.decode64(input))
  end

  def self.salt
    @@salt || 'common-salt'
  end

  def self.salt=(value)
    @@salt = value
  end

  private

  def self.blowfish
    @@blowfish ||= Crypt::Blowfish.new(self.salt)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
commonthread-rails-0.2.2 lib/commonthread/encrypter.rb
commonthread-rails-0.2.1 lib/commonthread/encrypter.rb
commonthread-rails-0.2.0 lib/commonthread/encrypter.rb
commonthread-rails-0.1.1 lib/commonthread/encrypter.rb
commonthread-rails-0.1.0 lib/commonthread/encrypter.rb