Module: CryptoToolchain::Tools

Defined in:
lib/crypto_toolchain/tools.rb,
lib/crypto_toolchain/tools/interactive_xor.rb,
lib/crypto_toolchain/tools/aes_ctr_recoverer.rb,
lib/crypto_toolchain/tools/cbc_bitflip_attack.rb,
lib/crypto_toolchain/tools/ctr_bitflip_attack.rb,
lib/crypto_toolchain/tools/determine_blocksize.rb,
lib/crypto_toolchain/tools/rsa_broadcast_attack.rb,
lib/crypto_toolchain/tools/mt_19937_seed_recoverer.rb,
lib/crypto_toolchain/tools/cbc_iv_equals_key_attack.rb,
lib/crypto_toolchain/tools/ecb_cut_and_paste_attack.rb,
lib/crypto_toolchain/tools/rsa_parity_oracle_attack.rb,
lib/crypto_toolchain/tools/cbc_padding_oracle_attack.rb,
lib/crypto_toolchain/tools/rsa_padding_oracle_attack.rb,
lib/crypto_toolchain/tools/md4_length_extension_attack.rb,
lib/crypto_toolchain/tools/sha1_length_extension_attack.rb,
lib/crypto_toolchain/tools/dsa_recover_nonce_from_signatures.rb,
lib/crypto_toolchain/tools/dsa_recover_private_key_from_nonce.rb,
lib/crypto_toolchain/tools/low_exponent_rsa_signature_forgery.rb,
lib/crypto_toolchain/tools/ecb_prepend_chosen_plaintext_attack.rb,
lib/crypto_toolchain/tools/rsa_unpadded_message_recovery_attack.rb,
lib/crypto_toolchain/tools/mt_19937_stream_cipher_seed_recoverer.rb,
lib/crypto_toolchain/tools/ecb_interpolate_chosen_plaintext_attack.rb

Defined Under Namespace

Modules: DetermineBlocksize Classes: AesCtrRecoverer, CbcBitflipAttack, CbcIvEqualsKeyAttack, CbcPaddingOracleAttack, CtrBitflipAttack, DSARecoverNonceFromSignatures, DSARecoverPrivateKeyFromNonce, EcbCutAndPasteAttack, EcbInterpolateChosenPlaintextAttack, EcbPrependChosenPlaintextAttack, InteractiveXor, LowExponentRSASignatureForgery, MD4LengthExtensionAttack, MT19937SeedRecoverer, MT19937StreamCipherSeedRecoverer, RSABroadcastAttack, RSAPaddingOracleAttack, RSAParityOracleAttack, RSAUnpaddedMessageRecoveryAttack, SHA1LengthExtensionAttack

Class Method Summary collapse

Class Method Details

.detect_single_character_xor(bytestring, non_printable: true) ⇒ Object



25
26
27
28
29
30
# File 'lib/crypto_toolchain/tools.rb', line 25

def self.detect_single_character_xor(bytestring, non_printable: true)
  arr = non_printable ? (0..255).map(&:chr).to_a : CryptoToolchain::PRINTABLE_CHARACTERS
  arr.sort_by do |chr|
    (chr.repeat_to(bytestring.length) ^ bytestring).score
  end.last
end