Class: CryptoToolchain::Tools::RSABroadcastAttack
- Defined in:
- lib/crypto_toolchain/tools/rsa_broadcast_attack.rb
Defined Under Namespace
Classes: Input
Instance Attribute Summary collapse
-
#e ⇒ Object
readonly
Returns the value of attribute e.
-
#inputs ⇒ Object
readonly
Returns the value of attribute inputs.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(inputs) ⇒ RSABroadcastAttack
constructor
A new instance of RSABroadcastAttack.
Constructor Details
#initialize(inputs) ⇒ RSABroadcastAttack
Returns a new instance of RSABroadcastAttack.
5 6 7 8 |
# File 'lib/crypto_toolchain/tools/rsa_broadcast_attack.rb', line 5 def initialize(inputs) @e = inputs.length @inputs = inputs end |
Instance Attribute Details
#e ⇒ Object (readonly)
Returns the value of attribute e.
9 10 11 |
# File 'lib/crypto_toolchain/tools/rsa_broadcast_attack.rb', line 9 def e @e end |
#inputs ⇒ Object (readonly)
Returns the value of attribute inputs.
9 10 11 |
# File 'lib/crypto_toolchain/tools/rsa_broadcast_attack.rb', line 9 def inputs @inputs end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/crypto_toolchain/tools/rsa_broadcast_attack.rb', line 11 def execute residues = inputs.map(&:ciphertext) mods = inputs.map {|i| i.public_key.n } result = chinese_remainder(residues, mods) result.root(e). to_s(16). from_hex end |