Class: CryptoToolchain::BlackBoxes::RSAParityOracle
- Defined in:
- lib/crypto_toolchain/black_boxes/rsa_parity_oracle.rb
Instance Attribute Summary collapse
-
#keypair ⇒ Object
readonly
Returns the value of attribute keypair.
Instance Method Summary collapse
- #execute(ciphertext) ⇒ Object
-
#initialize(keypair) ⇒ RSAParityOracle
constructor
A new instance of RSAParityOracle.
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
#keypair ⇒ Object (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 |