The crypto-shortcuts Reference Manual

This is the crypto-shortcuts Reference Manual, version 2.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 04:57:31 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 crypto-shortcuts

Shorthand functions for common cryptography tasks such as hashing, encrypting, and encoding.

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://Shinmera.github.io/crypto-shortcuts/

Source Control

(GIT https://github.com/Shinmera/crypto-shortcuts.git)

Bug Tracker

https://github.com/Shinmera/crypto-shortcuts/issues

License

zlib

Version

2.0.0

Dependencies
  • ironclad (system).
  • cl-base64 (system).
  • cl-base32 (system).
  • flexi-streams (system).
Source

crypto-shortcuts.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 crypto-shortcuts/crypto-shortcuts.asd

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

ASDF Systems

crypto-shortcuts.


3.1.2 crypto-shortcuts/package.lisp

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Packages

crypto-shortcuts.


3.1.3 crypto-shortcuts/encode.lisp

Dependency

package.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Public Interface

3.1.4 crypto-shortcuts/crypto.lisp

Dependency

encode.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Public Interface

3.1.5 crypto-shortcuts/hashing.lisp

Dependency

crypto.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Public Interface
Internals

3.1.6 crypto-shortcuts/digests.lisp

Dependency

hashing.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Public Interface
Internals

define-digest-wrapper (macro).


3.1.7 crypto-shortcuts/totp.lisp

Dependency

digests.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Public Interface
Internals

3.1.8 crypto-shortcuts/documentation.lisp

Dependency

totp.lisp (file).

Source

crypto-shortcuts.asd.

Parent Component

crypto-shortcuts (system).

Internals

setdocs (macro).


4 Packages

Packages are listed by definition order.


4.1 crypto-shortcuts

Source

package.lisp.

Nicknames
  • org.shirakumo.crypto-shortcuts
  • cryptos
Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: adler32 (string &key to encode iterations)

Turn a string into a ADLER32-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2 (string &key to encode iterations)

Turn a string into a BLAKE2-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2/160 (string &key to encode iterations)

Turn a string into a BLAKE2/160-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2/256 (string &key to encode iterations)

Turn a string into a BLAKE2/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2/384 (string &key to encode iterations)

Turn a string into a BLAKE2/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2s (string &key to encode iterations)

Turn a string into a BLAKE2S-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2s/128 (string &key to encode iterations)

Turn a string into a BLAKE2S/128-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2s/160 (string &key to encode iterations)

Turn a string into a BLAKE2S/160-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: blake2s/224 (string &key to encode iterations)

Turn a string into a BLAKE2S/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: check-rfc-2307-hash (password hash)

Returns T if the PASSWORD matches the HASH encoded in the scheme defined in RFC2307.

See RFC-2307-HASH

Package

crypto-shortcuts.

Source

hashing.lisp.

Function: crc24 (string &key to encode iterations)

Turn a string into a CRC24-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: crc32 (string &key to encode iterations)

Turn a string into a CRC32-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: decode-totp-uri (uri)

Decodes a TOTP parameter URI

Returns a list of the same argument list structure as TOTP-URI.

This URL is according to Google’s Authenticator scheme as described in https://github.com/google/google-authenticator/wiki/Key-Uri-Format

See TOTP-URI

Package

crypto-shortcuts.

Source

totp.lisp.

Function: find-digest (name)
Package

crypto-shortcuts.

Source

digests.lisp.

Function: groestl (string &key to encode iterations)

Turn a string into a GROESTL-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: groestl/224 (string &key to encode iterations)

Turn a string into a GROESTL/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: groestl/256 (string &key to encode iterations)

Turn a string into a GROESTL/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: groestl/384 (string &key to encode iterations)

Turn a string into a GROESTL/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: jh (string &key to encode iterations)

Turn a string into a JH-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: jh/224 (string &key to encode iterations)

Turn a string into a JH/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: jh/256 (string &key to encode iterations)

Turn a string into a JH/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: jh/384 (string &key to encode iterations)

Turn a string into a JH/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: keccak (string &key to encode iterations)

Turn a string into a KECCAK-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: keccak/224 (string &key to encode iterations)

Turn a string into a KECCAK/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: keccak/256 (string &key to encode iterations)

Turn a string into a KECCAK/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: keccak/384 (string &key to encode iterations)

Turn a string into a KECCAK/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: kupyna (string &key to encode iterations)

Turn a string into a KUPYNA-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: kupyna/256 (string &key to encode iterations)

Turn a string into a KUPYNA/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: md2 (string &key to encode iterations)

Turn a string into a MD2-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: md4 (string &key to encode iterations)

Turn a string into a MD4-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: md5 (string &key to encode iterations)

Turn a string into a MD5-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: pbkdf2-hash (password salt &key digest iterations to)

Hasehs PASSWORD with SALT using the PBKDF2 method and the provided DIGEST, repeating the process ITERATION times. The returned hash is encoded using the method specified in TO.

The default DIGEST is SHA512, the iteration is 1000, and TO is HEX.

Four values are returned: hash, salt (as a string), digest, and iterations.

See TO.

Package

crypto-shortcuts.

Source

hashing.lisp.

Function: pbkdf2-key (password salt &rest args &key digest iterations)

Hashes PASSWORD with SALT using the PBKDF2 method and the provided DIGEST, repeating the process ITERATION times.

The default DIGEST is SHA512, and the iteration is 1000.

Four values are returned: hash as an octet-vector, salt (as a string), digest, and iterations.

LEGACY. Use PBKDF2-HASH instead.

Package

crypto-shortcuts.

Source

hashing.lisp.

Function: rfc-2307-hash (password &key method salt iterations)

Hashes PASSWORD with METHOD according to the scheme defined in RFC2307.

The returned hash will be a string of the format:

{method}base64hash

If SALT is passed, or the method is a salted one (sDIGEST), then the salt is returned as a secondary value and included in the hash. The hash is thus computed as follows, where no salt is an empty salt sequence.

base64(digest(password+salt)+salt)

An extension is provided to the standard, wherein extra parameters can be supplied to the hashing mechanism via commas after the method
name. For most hashes this is just the iteration count, which is
omitted if the count is 1. For PBKDF2, this also includes the actual digest method used.

See CHECK-RFC-2307-HASH

Package

crypto-shortcuts.

Source

hashing.lisp.

Function: ripemd-128 (string &key to encode iterations)

Turn a string into a RIPEMD-128-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: ripemd-160 (string &key to encode iterations)

Turn a string into a RIPEMD-160-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha1 (string &key to encode iterations)

Turn a string into a SHA1-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha224 (string &key to encode iterations)

Turn a string into a SHA224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha256 (string &key to encode iterations)

Turn a string into a SHA256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha3 (string &key to encode iterations)

Turn a string into a SHA3-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha3/224 (string &key to encode iterations)

Turn a string into a SHA3/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha3/256 (string &key to encode iterations)

Turn a string into a SHA3/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha3/384 (string &key to encode iterations)

Turn a string into a SHA3/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha384 (string &key to encode iterations)

Turn a string into a SHA384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sha512 (string &key to encode iterations)

Turn a string into a SHA512-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: shake128 (string &key to encode iterations)

Turn a string into a SHAKE128-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: shake256 (string &key to encode iterations)

Turn a string into a SHAKE256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: simple-hash (password salt &key digest iterations to)

Hashes PASSWORD with SALT using DIGEST as the digest-method and repeats the hashing ITERATIONS times. The returned hash is encoded using the method specified in TO.

The default DIGEST is SHA512, the iteration is 1000, and TO is HEX.

Four values are returned: hash, salt (as a string), digest, and iterations.

See TO.

Package

crypto-shortcuts.

Source

hashing.lisp.

Function: skein1024 (string &key to encode iterations)

Turn a string into a SKEIN1024-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein1024/384 (string &key to encode iterations)

Turn a string into a SKEIN1024/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein1024/512 (string &key to encode iterations)

Turn a string into a SKEIN1024/512-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein256 (string &key to encode iterations)

Turn a string into a SKEIN256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein256/128 (string &key to encode iterations)

Turn a string into a SKEIN256/128-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein256/160 (string &key to encode iterations)

Turn a string into a SKEIN256/160-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein256/224 (string &key to encode iterations)

Turn a string into a SKEIN256/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512 (string &key to encode iterations)

Turn a string into a SKEIN512-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512/128 (string &key to encode iterations)

Turn a string into a SKEIN512/128-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512/160 (string &key to encode iterations)

Turn a string into a SKEIN512/160-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512/224 (string &key to encode iterations)

Turn a string into a SKEIN512/224-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512/256 (string &key to encode iterations)

Turn a string into a SKEIN512/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: skein512/384 (string &key to encode iterations)

Turn a string into a SKEIN512/384-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: sm3 (string &key to encode iterations)

Turn a string into a SM3-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: streebog (string &key to encode iterations)

Turn a string into a STREEBOG-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: streebog/256 (string &key to encode iterations)

Turn a string into a STREEBOG/256-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: tiger (string &key to encode iterations)

Turn a string into a TIGER-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: totp (secret &key time digest period digits)

Computes a Timed One Time Password for the given secret key.

TIME should be the universal-time for which the OTP is computed. DIGEST should be the HMAC inner digest used, default being SHA1. PERIOD should be how long the OTP is valid for in seconds, default being 30.
DIGITS should be the number of digits for the OTP, default being 6.

Returns the OTP as an integer. If presenting to the user, you should pad the integer with zeroes to the required number of digits.

The code is computed according to RFC6238

See TOTP-URI

Package

crypto-shortcuts.

Source

totp.lisp.

Function: totp-uri (account &key secret issuer digest period digits)

Computes a URI to exchange the TOTP parameters with an external authenticator app.

You will most likely want to encode the returned URI into a QR code to
let the user scan it with a phone or other app more easily.

The ACCOUNT should be some identifier for the user account this URI is
for. Typically a username or email address.

You should pass the ISSUER argument to identify the service that is
using the TOTP.

If no explicit SECRET is passed, one will be generated for you and
is returned as the secondary value. You MUST store this secret
somewhere and use it to compute the TOTP.

You must pass the exact same parameters as you intend to use for the
TOTP generation, as otherwise the authenticator application will not
generate the same codes as you, and verification will fail.

This URL is according to Google’s Authenticator scheme as described in https://github.com/google/google-authenticator/wiki/Key-Uri-Format

See TOTP

Package

crypto-shortcuts.

Source

totp.lisp.

Function: tree-hash (string &key to encode iterations)

Turn a string into a TREE-HASH-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.

Function: whirlpool (string &key to encode iterations)

Turn a string into a WHIRLPOOL-hash.

TO is the returned representation ENCODE is the encoding before hashing ITERATIONS is the number of times to hash

See TO.

Package

crypto-shortcuts.

Source

digests.lisp.


5.1.2 Generic functions

Generic Function: cmac (text key &key cipher mode iv to normalize-key)

Generate a CMAC digest of TEXT using KEY and the provided CIPHER/MODE/IV. The returned digest is encoded by the format specified in TO.

The default cipher is AES, default mode is ECB, and default TO is BASE64.

Four values are returned: digest, key, cipher, mode, and IV.

See TO
See NORMALIZE-KEY

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: cmac (text key &key cipher mode iv to normalize-key)
Generic Function: code (from to vector)

Convenience function to de/encode in one pass.
By default, FROM and TO can both be one of:

:OCTETS :STRING :HEX :BASE64 :BASE32

If FROM is NIL, then TO is called with the remaining arguments.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: code ((from (eql nil)) to vector)
Method: code ((from (eql :octets)) (to (eql :octets)) vector)
Method: code ((from (eql :octets)) (to (eql :string)) vector)
Method: code ((from (eql :octets)) (to (eql :hex)) vector)
Method: code ((from (eql :octets)) (to (eql :base64)) vector)
Method: code ((from (eql :octets)) (to (eql :base32)) vector)
Method: code ((from (eql :string)) (to (eql :octets)) vector)
Method: code ((from (eql :string)) (to (eql :string)) vector)
Method: code ((from (eql :string)) (to (eql :hex)) vector)
Method: code ((from (eql :string)) (to (eql :base64)) vector)
Method: code ((from (eql :string)) (to (eql :base32)) vector)
Method: code ((from (eql :hex)) (to (eql :octets)) vector)
Method: code ((from (eql :hex)) (to (eql :string)) vector)
Method: code ((from (eql :hex)) (to (eql :hex)) vector)
Method: code ((from (eql :hex)) (to (eql :base64)) vector)
Method: code ((from (eql :hex)) (to (eql :base32)) vector)
Method: code ((from (eql :base64)) to vector)
Method: code ((from (eql :base32)) to vector)
Generic Function: decrypt (text key &key cipher mode iv from normalize-key)

Decrypt TEXT with KEY using the provided CIPHER/MODE/IV.
Depending on the mode, the key should be of length 16, 32, or 64.
The passed text is decoded by the format specified in FROM.

The default cipher is AES, default mode is ECB, and default TO is BASE64.

Four values are returned: Decrypted text, key, cipher, mode, and IV.

See CODE
See NORMALIZE-KEY

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: decrypt (text key &key cipher mode iv from normalize-key)
Generic Function: encrypt (text key &key cipher mode iv to normalize-key)

Encrypt TEXT with KEY using the provided CIPHER/MODE/IV.
Depending on the mode, the key should be of length 16, 32, or 64.
The returned encrypted vector is encoded by the format specified in TO.

The default cipher is AES, default mode is ECB, and default TO is BASE64.

Four values are returned: Encrypted&encoded text, key, cipher, mode, and IV.

See TO
See NORMALIZE-KEY

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: encrypt (text key &key cipher mode iv to normalize-key)
Generic Function: from-base32 (vector &optional to)

Turns a base32-encoded vector into a vector encoded by TO. See TO.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: from-base32 ((string string) &optional to)
Method: from-base32 ((vector vector) &optional to)
Generic Function: from-base64 (vector &optional to)

Turns a base64-encoded vector into a vector encoded by TO. See TO.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: from-base64 ((string string) &optional to)
Method: from-base64 ((vector vector) &optional to)
Generic Function: from-hex (hex-string)

Turn the hex-string into an octet-vector.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: from-hex ((string string))
Generic Function: get-cipher (key &key cipher mode iv)

Return the corresponding cipher with KEY using MODE and potentially the initialization-vector IV.

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: get-cipher (key &key cipher mode iv)
Generic Function: hmac (text key &key digest to)

Generate an HMAC digest of TEXT using KEY and the provided DIGEST method. The returned digest is encoded by the format specified in TO.

The default digest is SHA512, and default TO is BASE64.

Three values are returned: digest, key, and digest-type.

See TO

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: hmac (text key &key digest to)
Generic Function: make-salt (salt)

Create a salt from the given object.

(eql T) – A random salt
INTEGER – A salt of this size
STRING – Use this string as an octet-vector VECTOR – Use this vector directly

See TO-OCTETS

Package

crypto-shortcuts.

Source

hashing.lisp.

Methods
Method: make-salt ((salt (eql t)))
Method: make-salt ((size integer))
Method: make-salt ((salt string))
Method: make-salt ((salt vector))
Generic Function: normalize-key (method key)

Normalizes the KEY to an octet-vector using METHOD.
By default, method can be one of:

:HASH – Hash it by sha256
:FIT – Truncate or pad it out before turning into octets. NIL – Just turn it into an octet-vector.

Package

crypto-shortcuts.

Source

crypto.lisp.

Methods
Method: normalize-key ((method (eql :hash)) key)
Method: normalize-key ((method (eql :fit)) key)
Method: normalize-key ((method (eql nil)) key)
Generic Function: to (thing vector)

Convenience function to call the various encoders. By default, THING can be one of:

NIL – Returns VECTOR
:OCTETS – See TO-OCTETS
:STRING – See TO-STRING
:HEX – See TO-HEX
:BASE64 – See TO-BASE64
:BASE32 – See TO-BASE32

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to ((thing (eql nil)) vector)
Method: to ((thing (eql :octets)) vector)
Method: to ((thing (eql :string)) vector)
Method: to ((thing (eql :hex)) vector)
Method: to ((thing (eql :base64)) vector)
Method: to ((thing (eql :base32)) vector)
Generic Function: to-base32 (sequence)

Turns a vector into a base32-encoded string.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to-base32 ((vector vector))
Method: to-base32 ((string string))
Method: to-base32 ((symbol symbol))
Generic Function: to-base64 (sequence)

Turns a vector into a base64-encoded string.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to-base64 ((integer integer))
Method: to-base64 ((vector vector))
Method: to-base64 ((string string))
Method: to-base64 ((symbol symbol))
Generic Function: to-hex (vector)

Turn VECTOR into a hex-string.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to-hex ((symbol symbol))
Method: to-hex ((string string))
Method: to-hex ((vector vector))
Generic Function: to-octets (string &optional format)

Turns STRING into a FORMAT (default UTF-8) encoded octet-vector.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to-octets ((symbol symbol) &optional format)
Method: to-octets ((string string) &optional format)
Method: to-octets ((vector vector) &optional format)
Generic Function: to-string (octets &optional format)

Turns OCTETS from FORMAT (default UTF-8) encoding into a string.

Package

crypto-shortcuts.

Source

encode.lisp.

Methods
Method: to-string ((vector vector) &optional format)
Method: to-string ((string string) &optional format)

5.2 Internals


5.2.1 Macros

Macro: define-digest-wrapper (digest)
Package

crypto-shortcuts.

Source

digests.lisp.

Macro: setdocs (&body pairs)
Package

crypto-shortcuts.

Source

documentation.lisp.


5.2.2 Ordinary functions

Function: %rfc-2307-hash (digest password salt iterations)
Package

crypto-shortcuts.

Source

hashing.lisp.

Function: split (split string)
Package

crypto-shortcuts.

Source

hashing.lisp.

Function: url-decode (string)
Package

crypto-shortcuts.

Source

totp.lisp.

Function: url-encode (thing)
Package

crypto-shortcuts.

Source

totp.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %  
A   B   C   D   E   F   G   H   J   K   M   N   P   R   S   T   U   W  
Index Entry  Section

%
%rfc-2307-hash: Private ordinary functions

A
adler32: Public ordinary functions

B
blake2: Public ordinary functions
blake2/160: Public ordinary functions
blake2/256: Public ordinary functions
blake2/384: Public ordinary functions
blake2s: Public ordinary functions
blake2s/128: Public ordinary functions
blake2s/160: Public ordinary functions
blake2s/224: Public ordinary functions

C
check-rfc-2307-hash: Public ordinary functions
cmac: Public generic functions
cmac: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
code: Public generic functions
crc24: Public ordinary functions
crc32: Public ordinary functions

D
decode-totp-uri: Public ordinary functions
decrypt: Public generic functions
decrypt: Public generic functions
define-digest-wrapper: Private macros

E
encrypt: Public generic functions
encrypt: Public generic functions

F
find-digest: Public ordinary functions
from-base32: Public generic functions
from-base32: Public generic functions
from-base32: Public generic functions
from-base64: Public generic functions
from-base64: Public generic functions
from-base64: Public generic functions
from-hex: Public generic functions
from-hex: Public generic functions
Function, %rfc-2307-hash: Private ordinary functions
Function, adler32: Public ordinary functions
Function, blake2: Public ordinary functions
Function, blake2/160: Public ordinary functions
Function, blake2/256: Public ordinary functions
Function, blake2/384: Public ordinary functions
Function, blake2s: Public ordinary functions
Function, blake2s/128: Public ordinary functions
Function, blake2s/160: Public ordinary functions
Function, blake2s/224: Public ordinary functions
Function, check-rfc-2307-hash: Public ordinary functions
Function, crc24: Public ordinary functions
Function, crc32: Public ordinary functions
Function, decode-totp-uri: Public ordinary functions
Function, find-digest: Public ordinary functions
Function, groestl: Public ordinary functions
Function, groestl/224: Public ordinary functions
Function, groestl/256: Public ordinary functions
Function, groestl/384: Public ordinary functions
Function, jh: Public ordinary functions
Function, jh/224: Public ordinary functions
Function, jh/256: Public ordinary functions
Function, jh/384: Public ordinary functions
Function, keccak: Public ordinary functions
Function, keccak/224: Public ordinary functions
Function, keccak/256: Public ordinary functions
Function, keccak/384: Public ordinary functions
Function, kupyna: Public ordinary functions
Function, kupyna/256: Public ordinary functions
Function, md2: Public ordinary functions
Function, md4: Public ordinary functions
Function, md5: Public ordinary functions
Function, pbkdf2-hash: Public ordinary functions
Function, pbkdf2-key: Public ordinary functions
Function, rfc-2307-hash: Public ordinary functions
Function, ripemd-128: Public ordinary functions
Function, ripemd-160: Public ordinary functions
Function, sha1: Public ordinary functions
Function, sha224: Public ordinary functions
Function, sha256: Public ordinary functions
Function, sha3: Public ordinary functions
Function, sha3/224: Public ordinary functions
Function, sha3/256: Public ordinary functions
Function, sha3/384: Public ordinary functions
Function, sha384: Public ordinary functions
Function, sha512: Public ordinary functions
Function, shake128: Public ordinary functions
Function, shake256: Public ordinary functions
Function, simple-hash: Public ordinary functions
Function, skein1024: Public ordinary functions
Function, skein1024/384: Public ordinary functions
Function, skein1024/512: Public ordinary functions
Function, skein256: Public ordinary functions
Function, skein256/128: Public ordinary functions
Function, skein256/160: Public ordinary functions
Function, skein256/224: Public ordinary functions
Function, skein512: Public ordinary functions
Function, skein512/128: Public ordinary functions
Function, skein512/160: Public ordinary functions
Function, skein512/224: Public ordinary functions
Function, skein512/256: Public ordinary functions
Function, skein512/384: Public ordinary functions
Function, sm3: Public ordinary functions
Function, split: Private ordinary functions
Function, streebog: Public ordinary functions
Function, streebog/256: Public ordinary functions
Function, tiger: Public ordinary functions
Function, totp: Public ordinary functions
Function, totp-uri: Public ordinary functions
Function, tree-hash: Public ordinary functions
Function, url-decode: Private ordinary functions
Function, url-encode: Private ordinary functions
Function, whirlpool: Public ordinary functions

G
Generic Function, cmac: Public generic functions
Generic Function, code: Public generic functions
Generic Function, decrypt: Public generic functions
Generic Function, encrypt: Public generic functions
Generic Function, from-base32: Public generic functions
Generic Function, from-base64: Public generic functions
Generic Function, from-hex: Public generic functions
Generic Function, get-cipher: Public generic functions
Generic Function, hmac: Public generic functions
Generic Function, make-salt: Public generic functions
Generic Function, normalize-key: Public generic functions
Generic Function, to: Public generic functions
Generic Function, to-base32: Public generic functions
Generic Function, to-base64: Public generic functions
Generic Function, to-hex: Public generic functions
Generic Function, to-octets: Public generic functions
Generic Function, to-string: Public generic functions
get-cipher: Public generic functions
get-cipher: Public generic functions
groestl: Public ordinary functions
groestl/224: Public ordinary functions
groestl/256: Public ordinary functions
groestl/384: Public ordinary functions

H
hmac: Public generic functions
hmac: Public generic functions

J
jh: Public ordinary functions
jh/224: Public ordinary functions
jh/256: Public ordinary functions
jh/384: Public ordinary functions

K
keccak: Public ordinary functions
keccak/224: Public ordinary functions
keccak/256: Public ordinary functions
keccak/384: Public ordinary functions
kupyna: Public ordinary functions
kupyna/256: Public ordinary functions

M
Macro, define-digest-wrapper: Private macros
Macro, setdocs: Private macros
make-salt: Public generic functions
make-salt: Public generic functions
make-salt: Public generic functions
make-salt: Public generic functions
make-salt: Public generic functions
md2: Public ordinary functions
md4: Public ordinary functions
md5: Public ordinary functions
Method, cmac: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, code: Public generic functions
Method, decrypt: Public generic functions
Method, encrypt: Public generic functions
Method, from-base32: Public generic functions
Method, from-base32: Public generic functions
Method, from-base64: Public generic functions
Method, from-base64: Public generic functions
Method, from-hex: Public generic functions
Method, get-cipher: Public generic functions
Method, hmac: Public generic functions
Method, make-salt: Public generic functions
Method, make-salt: Public generic functions
Method, make-salt: Public generic functions
Method, make-salt: Public generic functions
Method, normalize-key: Public generic functions
Method, normalize-key: Public generic functions
Method, normalize-key: Public generic functions
Method, to: Public generic functions
Method, to: Public generic functions
Method, to: Public generic functions
Method, to: Public generic functions
Method, to: Public generic functions
Method, to: Public generic functions
Method, to-base32: Public generic functions
Method, to-base32: Public generic functions
Method, to-base32: Public generic functions
Method, to-base64: Public generic functions
Method, to-base64: Public generic functions
Method, to-base64: Public generic functions
Method, to-base64: Public generic functions
Method, to-hex: Public generic functions
Method, to-hex: Public generic functions
Method, to-hex: Public generic functions
Method, to-octets: Public generic functions
Method, to-octets: Public generic functions
Method, to-octets: Public generic functions
Method, to-string: Public generic functions
Method, to-string: Public generic functions

N
normalize-key: Public generic functions
normalize-key: Public generic functions
normalize-key: Public generic functions
normalize-key: Public generic functions

P
pbkdf2-hash: Public ordinary functions
pbkdf2-key: Public ordinary functions

R
rfc-2307-hash: Public ordinary functions
ripemd-128: Public ordinary functions
ripemd-160: Public ordinary functions

S
setdocs: Private macros
sha1: Public ordinary functions
sha224: Public ordinary functions
sha256: Public ordinary functions
sha3: Public ordinary functions
sha3/224: Public ordinary functions
sha3/256: Public ordinary functions
sha3/384: Public ordinary functions
sha384: Public ordinary functions
sha512: Public ordinary functions
shake128: Public ordinary functions
shake256: Public ordinary functions
simple-hash: Public ordinary functions
skein1024: Public ordinary functions
skein1024/384: Public ordinary functions
skein1024/512: Public ordinary functions
skein256: Public ordinary functions
skein256/128: Public ordinary functions
skein256/160: Public ordinary functions
skein256/224: Public ordinary functions
skein512: Public ordinary functions
skein512/128: Public ordinary functions
skein512/160: Public ordinary functions
skein512/224: Public ordinary functions
skein512/256: Public ordinary functions
skein512/384: Public ordinary functions
sm3: Public ordinary functions
split: Private ordinary functions
streebog: Public ordinary functions
streebog/256: Public ordinary functions

T
tiger: Public ordinary functions
to: Public generic functions
to: Public generic functions
to: Public generic functions
to: Public generic functions
to: Public generic functions
to: Public generic functions
to: Public generic functions
to-base32: Public generic functions
to-base32: Public generic functions
to-base32: Public generic functions
to-base32: Public generic functions
to-base64: Public generic functions
to-base64: Public generic functions
to-base64: Public generic functions
to-base64: Public generic functions
to-base64: Public generic functions
to-hex: Public generic functions
to-hex: Public generic functions
to-hex: Public generic functions
to-hex: Public generic functions
to-octets: Public generic functions
to-octets: Public generic functions
to-octets: Public generic functions
to-octets: Public generic functions
to-string: Public generic functions
to-string: Public generic functions
to-string: Public generic functions
totp: Public ordinary functions
totp-uri: Public ordinary functions
tree-hash: Public ordinary functions

U
url-decode: Private ordinary functions
url-encode: Private ordinary functions

W
whirlpool: Public ordinary functions


A.3 Variables