Class: CryptoToolchain::BlackBoxes::EcbPrependChosenPlaintextOracle

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_toolchain/black_boxes/ecb_prepend_chosen_plaintext_oracle.rb

Constant Summary collapse

MYSTERY_TEXT =
"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK"

Instance Method Summary collapse

Constructor Details

#initialize(key: String.random_bytes(16)) ⇒ EcbPrependChosenPlaintextOracle

Returns a new instance of EcbPrependChosenPlaintextOracle.



6
7
8
# File 'lib/crypto_toolchain/black_boxes/ecb_prepend_chosen_plaintext_oracle.rb', line 6

def initialize(key: String.random_bytes(16))
  @key = key
end

Instance Method Details

#encrypt(plaintext) ⇒ Object



10
11
12
# 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