Class: CryptoToolchain::BlackBoxes::RSAParityOracle

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keypair) ⇒ RSAParityOracle

Returns a new instance of RSAParityOracle.



4
5
6
# File 'lib/crypto_toolchain/black_boxes/rsa_parity_oracle.rb', line 4

def initialize(keypair)
  @keypair = keypair
end

Instance Attribute Details

#keypairObject (readonly)

Returns the value of attribute keypair.



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

def keypair
  @keypair
end

Instance Method Details

#execute(ciphertext) ⇒ Object



9
10
11
# File 'lib/crypto_toolchain/black_boxes/rsa_parity_oracle.rb', line 9

def execute(ciphertext)
  keypair.decrypt(ciphertext).to_number & 1
end