Module: ParamCryptable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/param_cryptable.rb,
lib/param_cryptable/version.rb
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
-
.encrypt(text) ⇒ String
Encrypt any value for use by crypt_params.
Instance Method Summary collapse
-
#encrypt(text) ⇒ String
Encrypt any value for use by crypt_params.
Class Method Details
.encrypt(text) ⇒ String
Encrypt any value for use by crypt_params
18 19 20 21 22 23 24 |
# File 'lib/param_cryptable.rb', line 18 def self.encrypt(text) cipher = OpenSSL::Cipher.new('blowfish').encrypt cipher.key = Rails.application.credentials.param_cryptable_key s = cipher.update(text.to_s) + cipher.final s.unpack1('H*') end |
Instance Method Details
#encrypt(text) ⇒ String
Encrypt any value for use by crypt_params
52 53 54 |
# File 'lib/param_cryptable.rb', line 52 def encrypt(text) ParamCryptable.encrypt(text) end |