class CryptoToolchain::BlackBoxes::EcbPrependChosenPlaintextOracle
Constants
- MYSTERY_TEXT
Attributes
key[R]
Public Class Methods
new(key: String.random_bytes(16))
click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_prepend_chosen_plaintext_oracle.rb, line 6 def initialize(key: String.random_bytes(16)) @key = key end
Public Instance Methods
encrypt(plaintext)
click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_prepend_chosen_plaintext_oracle.rb, line 10 def encrypt(plaintext) obfuscate(plaintext).encrypt_ecb(key: key, blocksize: 16) end
Private Instance Methods
obfuscate(str)
click to toggle source
# File lib/crypto_toolchain/black_boxes/ecb_prepend_chosen_plaintext_oracle.rb, line 18 def obfuscate(str) "#{str}#{MYSTERY_TEXT.from_base64}" end