Module: Rex::Crypto
- Defined in:
- lib/rex/crypto.rb,
lib/rex/crypto/rc4.rb,
lib/rex/crypto/aes256.rb,
lib/rex/crypto/chacha20.rb,
lib/rex/crypto/key_wrap/nist_sp_800_38f.rb
Defined Under Namespace
Modules: Aes256, KeyDerivation, KeyWrap, Rc4 Classes: Chacha20
Class Method Summary collapse
-
.bytes_to_int(bytes) ⇒ Integer
Returns an integer represented as a byte array.
-
.decrypt_aes256(iv, key, value) ⇒ String
deprecated
Deprecated.
Access via Rex::Crypto::Aes256
-
.encrypt_aes256(iv, key, value) ⇒ String
deprecated
Deprecated.
Access via Rex::Crypto::Aes256
-
.int_to_bytes(num) ⇒ Integer
Returns a byte array represented as a big-endian integer.
-
.rc4(key, value) ⇒ Object
deprecated
Deprecated.
Access via Rex::Crypto::Rc4
Class Method Details
.bytes_to_int(bytes) ⇒ Integer
Returns an integer represented as a byte array. Useful for certain key-related operations.
35 36 37 |
# File 'lib/rex/crypto.rb', line 35 def self.bytes_to_int(bytes) bytes.each_byte.reduce(0) { |acc, byte| (acc << 8) | byte } end |
.decrypt_aes256(iv, key, value) ⇒ String
Deprecated.
Access via Rex::Crypto::Aes256
Returns a decrypted string using AES256-CBC.
18 19 20 |
# File 'lib/rex/crypto.rb', line 18 def self.decrypt_aes256(iv, key, value) Aes256.decrypt_aes256(iv, key, value) end |
.encrypt_aes256(iv, key, value) ⇒ String
Deprecated.
Access via Rex::Crypto::Aes256
Returns an encrypted string using AES256-CBC.
8 9 10 |
# File 'lib/rex/crypto.rb', line 8 def self.encrypt_aes256(iv, key, value) Aes256.encrypt_aes256(iv, key, value) end |
.int_to_bytes(num) ⇒ Integer
Returns a byte array represented as a big-endian integer. Useful for certain key-related operations.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rex/crypto.rb', line 43 def self.int_to_bytes(num) bytes = [] while num > 0 bytes.unshift(num & 0xff) num >>= 8 end bytes.pack("C*") end |