./redteamer

Functions

Hashing Functions

Functions for Hasing and Crypto.


String Hashing

These functions compute the hash of a given string.

md5

The hash::md5 function computes the MD5 hash of a provided string and encodes it using hexadecimal digits.

hash::md5("admin123")
# Result:
"0192023a7bbd73250516f069df18b500"

sha1

The hash::sha1 function computes the SHA1 hash of a provided string and encodes it using hexadecimal digits.

hash::sha1("admin123")
# Result:
"6367c48dd193d56ea7b0baad25b19455e529f5ee"

sha256

The hash::sha256 function computes the SHA256 hash of a provided string and encodes it using hexadecimal digits.

hash::sha256("admin123")
# Result:
"ef92b778bafe771e89245b89ecbcf1a5c7f1a2b1d1a7a4f5f3a5a4a4a5a4a5a4"

sha512

The hash::sha512 function computes the SHA512 hash of a provided string and encodes it using hexadecimal digits.

hash::sha512("admin123")
# Result:
"204c8c5b7a3b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b1a1b"

bcrypt

The hash::bcrypt function computes a hash of the provided string using the Blowfish cipher, adhering to the Modular Crypt Format.

hash::bcrypt("admin123")
# Result:
"$2a$10$D5grTTzcsqyvAeIAnY/mYOIqliCoG7eAMX0/oFcuD.iErkksEbcAa"

File Hashing

These functions compute the hash of the contents of a given file.

file_md5

The hash::file_md5 function hashes the contents of a specified file using the MD5 algorithm.

hash::file_md5("/path/to/file.txt")
# Result:
"098f6bcd4621d373cade4e832627b4f6"

file_sha1

The hash::file_sha1 function hashes the contents of a specified file using the SHA1 algorithm.

hash::file_sha1("/path/to/file.txt")
# Result:
"40bd001563085fc35165329ea1ff5c5ecbdbbeef"

file_sha256

The hash::file_sha256 function hashes the contents of a specified file using the SHA256 algorithm.

hash::file_sha256("/path/to/file.txt")
# Result:
"9e107d9d372bb6826bd81d3542a419d6"

file_sha512

The hash::file_sha512 function hashes the contents of a specified file using the SHA512 algorithm.

hash::file_sha512("/path/to/file.txt")
# Result:
"1f40fc92da241694750979ee6cf582f2"

Decryption

These functions perform decryption operations.

rsa

The dec::rsa function decrypts an RSA-encrypted ciphertext and returns the corresponding cleartext.

dec::rsa(filebase64("/path/to/ciphertext"), file("privatekey.pem"))
# Result:
"Decrypted message"
Previous
Collection Functions