Class: Utils::EcbDetector
- Inherits:
-
Object
- Object
- Utils::EcbDetector
- Defined in:
- lib/crypto-toolbox/utils/ecb_detector.rb
Instance Method Summary collapse
Instance Method Details
#detect(ciphers) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/crypto-toolbox/utils/ecb_detector.rb', line 9 def detect(ciphers) result = ciphers.map.with_index do|c,i| ecb_mode?(c) ? [i,c] : [] end sanitize_result(result) end |
#is_ecb?(ciphertext) ⇒ Boolean
4 5 6 7 |
# File 'lib/crypto-toolbox/utils/ecb_detector.rb', line 4 def is_ecb?(ciphertext) is_ecb_aligned?(CryptBuffer(ciphertext)) || is_ecb_unaligned?(CryptBuffer(ciphertext)) end |