Module: Rex::Crypto
- Defined in:
- lib/rex/crypto/rc4.rb,
lib/rex/crypto/aes256.rb,
lib/rex/crypto/chacha20.rb
Defined Under Namespace
Classes: Chacha20
Class Method Summary collapse
-
.decrypt_aes256(iv, key, value) ⇒ String
Returns a decrypted string using AES256-CBC.
-
.encrypt_aes256(iv, key, value) ⇒ String
Returns an encrypted string using AES256-CBC.
-
.rc4(key, value) ⇒ Object
Returns a decrypted or encrypted RC4 string.
Class Method Details
.decrypt_aes256(iv, key, value) ⇒ String
Returns a decrypted string using AES256-CBC.
24 25 26 27 28 29 30 |
# File 'lib/rex/crypto/aes256.rb', line 24 def self.decrypt_aes256(iv, key, value) aes = OpenSSL::Cipher::AES256.new(:CBC) aes.decrypt aes.iv = iv aes.key = key aes.update(value) + aes.final end |
.encrypt_aes256(iv, key, value) ⇒ String
Returns an encrypted string using AES256-CBC.
11 12 13 14 15 16 17 |
# File 'lib/rex/crypto/aes256.rb', line 11 def self.encrypt_aes256(iv, key, value) aes = OpenSSL::Cipher::AES256.new(:CBC) aes.encrypt aes.iv = iv aes.key = key aes.update(value) + aes.final end |
.rc4(key, value) ⇒ Object
Returns a decrypted or encrypted RC4 string.
12 13 14 15 16 17 |
# File 'lib/rex/crypto/rc4.rb', line 12 def self.rc4(key, value) rc4 = RC4.new(key) # This can also be used to decrypt rc4.encrypt(value) end |