Module: Lingo::Database::Crypter
Constant Summary collapse
- KEYLEN =
16- CIPHER =
'AES-128-CBC'.freeze
Instance Method Summary collapse
Instance Method Details
#decode(key, val) ⇒ Object
50 51 52 |
# File 'lib/lingo/database/crypter.rb', line 50 def decode(key, val) crypt(:decrypt, key, val, digest(key)).force_encoding(ENCODING) end |
#digest(key) ⇒ Object
42 43 44 |
# File 'lib/lingo/database/crypter.rb', line 42 def digest(key) Digest::SHA1.hexdigest(key) end |
#encode(key, val) ⇒ Object
46 47 48 |
# File 'lib/lingo/database/crypter.rb', line 46 def encode(key, val) [digest = digest(key), crypt(:encrypt, key, val, digest)] end |