The crypto extensions provide cryptographic hash and block cipher primitives. These are low-level building blocks — padding, block chaining modes and higher-level constructions are left to the caller. These extensions may or may not be present depending on the platform and configuration of LispBM.
sha256 computes the SHA-256 hash of a byte array. The form of a sha256 expression is (sha256 buf) where buf is a byte array of any length. Returns a 32-byte array containing the hash. Specified in FIPS PUB 180-4.
| Example | Result |
|
|
|
|
|
|
|
|
sha256-str computes the SHA-256 hash of a string. The form of a sha256-str expression is (sha256-str str) where str is a string. The null terminator is not included in the hash. Returns a 32-byte array containing the hash. Specified in FIPS PUB 180-4.
| Example | Result |
|
|
|
|
|
|
aes128-enc encrypts a single 16-byte block using AES-128. The form of an aes128-enc expression is (aes128-enc key data) where key is a 16-byte array and data is a 16-byte array. Returns a 16-byte array containing the encrypted block. This is a raw block cipher — the caller is responsible for padding and any block chaining mode. Specified in FIPS 197.
| Example | Result |
|
|
aes128-dec decrypts a single 16-byte block using AES-128. The form of an aes128-dec expression is (aes128-dec key data) where key is a 16-byte array and data is a 16-byte array. Returns a 16-byte array containing the decrypted block. This is a raw block cipher — the caller is responsible for unpadding and any block chaining mode. Specified in FIPS 197.
| Example | Result |
|
|
aes256-enc encrypts a single 16-byte block using AES-256. The form of an aes256-enc expression is (aes256-enc key data) where key is a 32-byte array and data is a 16-byte array. Returns a 16-byte array containing the encrypted block. This is a raw block cipher — the caller is responsible for padding and any block chaining mode. Specified in FIPS 197.
| Example | Result |
|
|
aes256-dec decrypts a single 16-byte block using AES-256. The form of an aes256-dec expression is (aes256-dec key data) where key is a 32-byte array and data is a 16-byte array. Returns a 16-byte array containing the decrypted block. This is a raw block cipher — the caller is responsible for unpadding and any block chaining mode. Specified in FIPS 197.
| Example | Result |
|
|
bytes-to-hex converts a byte array to a lowercase hexadecimal string. The form of a bytes-to-hex expression is (bytes-to-hex buf) where buf is a byte array. Each byte is represented as exactly two hex digits. Returns a string of length 2 * (buflen buf).
| Example | Result |
|
|
|
|
|
|
hex-to-bytes converts a lowercase or uppercase hexadecimal string to a byte array. The form of a hex-to-bytes expression is (hex-to-bytes str) where str is a string containing an even number of hex digits.
| Example | Result |