Class: CryptoToolchain::BlackBoxes::EcbInterpolateChosenPlaintextOracle

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

Constant Summary collapse

MYSTERY_TEXT =
"Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkgaGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBqdXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUgYnkK"

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of EcbInterpolateChosenPlaintextOracle.



7
8
9
# File 'lib/crypto_toolchain/black_boxes/ecb_interpolate_chosen_plaintext_oracle.rb', line 7

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

Instance Method Details

#encrypt(plaintext) ⇒ Object



11
12
13
# File 'lib/crypto_toolchain/black_boxes/ecb_interpolate_chosen_plaintext_oracle.rb', line 11

def encrypt(plaintext)
  obfuscate(plaintext).encrypt_ecb(key: key, blocksize: 16)
end