class CryptoToolchain::BlackBoxes::EcbCutAndPasteTarget

Attributes

key[R]

Public Class Methods

new(key: String.random_bytes(16)) click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_cut_and_paste_target.rb, line 13
def initialize(key: String.random_bytes(16))
  @key = key
end

Public Instance Methods

decrypt(enc) click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_cut_and_paste_target.rb, line 33
def decrypt(enc)
  enc.
    decrypt_ecb(key: key, blocksize: 16).
    split("&").
    map do |str|
      k, v = str.split("=")
      [k, v || ""]
    end.
    to_h.
    symbolize_keys
end
encrypt(email)
encrypted_profile_for(email) click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_cut_and_paste_target.rb, line 28
def encrypted_profile_for(email)
  profile_for(email).encrypt_ecb(key: key, blocksize: 16)
end
Also aliased as: encrypt
profile_for(email)
Alias for: cookie_for