Argon2 and Ed25519
Hash and verify passwords with Argon2id, and generate Ed25519 key pairs to sign messages and check signatures. Typical uses: store user passwords, sign a message that a partner must be able to verify.
string argon2_hashstring argon2_hashstring argon2_verifystring argon2_verifyed25519 generate_keysed25519 generate_keysed25519 signed25519 signed25519 verifyed25519 verify

string argon2_hash <password>


Description

    Hash a password with Argon2id and a random salt. Each call gives another text, as the salt changes. Returns the PHC text

Parameters

    password:   The password - String - required
admin
string argon2_hash "correct horse"
mentdb
$argon2id$v=19$m=65536,t=3,p=4$eXGpEjmCEDJ8wxgG+S/Kxg$hljvB61RsD6Gxb+8lJTquLRNLEp5JlX+cDtBwsJ0QQY

string argon2_hash <password> <params>


Description

    Hash with parameters: memory_kib (65536), iterations (3), parallelism (4), hash_len (32), salt_len (16), salt_hex (a fixed salt, for tests only), secret or secret_hex (a pepper kept out of the database; it is then needed by string argon2_verify), ad_hex (associated data), password_encoding (utf-8, hex or base64)

Parameters

    password:   The password - String - required
    params:   The parameters as JSON - String - required
admin
string argon2_hash "correct horse" "{\"memory_kib\": 1024, \"iterations\": 2, \"parallelism\": 1, \"salt_hex\": \"000102030405060708090a0b0c0d0e0f\"}"
mentdb
$argon2id$v=19$m=1024,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$dyN7iiF9/XdplhfjiTgX+fohW/+IGEnzwAcVTaC0eI0
the Argon2id test vector of RFC 9106: the tag is 0d640df5...e659
admin
string argon2_hash "0101010101010101010101010101010101010101010101010101010101010101" "{\"memory_kib\": 32, \"iterations\": 3, \"parallelism\": 4, \"salt_hex\": \"02020202020202020202020202020202\", \"secret_hex\": \"0303030303030303\", \"ad_hex\": \"040404040404040404040404\", \"password_encoding\": \"hex\"}"
mentdb
$argon2id$v=19$m=32,t=3,p=4$AgICAgICAgICAgICAgICAg$DWQN9Y14dmwIwDejSotTydAe8EUtdbZetSUg6WsB5lk
Used in use cases (1 recipe)

    Security engineer › Store a password with Argon2id and sign a licence with Ed25519
Often used with

    ed25519 generate_keys  ·  ed25519 sign  ·  ed25519 verify  ·  string argon2_verify

string argon2_verify <password> <hash>


Description

    Check a password against a stored text: 1 or 0, in constant time. Argon2id, Argon2i and Argon2d are read. A text that is not a PHC text is an error

Parameters

    password:   The password - String - required
    hash:   The stored PHC text - String - required
admin
string argon2_verify "correct horse" "$argon2id$v=19$m=1024,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$dyN7iiF9/XdplhfjiTgX+fohW/+IGEnzwAcVTaC0eI0"
mentdb
1
a wrong one
admin
string argon2_verify "wrong" "$argon2id$v=19$m=1024,t=2,p=1$AAECAwQFBgcICQoLDA0ODw$dyN7iiF9/XdplhfjiTgX+fohW/+IGEnzwAcVTaC0eI0"
mentdb
0

string argon2_verify <password> <hash> <params>


Description

    Check with parameters: secret or secret_hex, ad_hex, password_encoding

Parameters

    password:   The password - String - required
    hash:   The stored PHC text - String - required
    params:   The parameters as JSON - String - required
admin
string argon2_verify "0101010101010101010101010101010101010101010101010101010101010101" "$argon2id$v=19$m=32,t=3,p=4$AgICAgICAgICAgICAgICAg$DWQN9Y14dmwIwDejSotTydAe8EUtdbZetSUg6WsB5lk" "{\"secret_hex\": \"0303030303030303\", \"ad_hex\": \"040404040404040404040404\", \"password_encoding\": \"hex\"}"
mentdb
1
Used in use cases (1 recipe)

    Security engineer › Store a password with Argon2id and sign a licence with Ed25519
Often used with

    ed25519 generate_keys  ·  ed25519 sign  ·  ed25519 verify  ·  string argon2_hash

ed25519 generate_keys


Description

    Generate a key pair. Returns {private_key, public_key, format}, in PEM

admin
ed25519 generate_keys
mentdb
{"private_key": "-----BEGIN PRIVATE KEY-----\ MC4CAQAwBQYDK2VwBCIEIFHY1VSOB5/XMDOIW81uAN8K46nDFdUuimAy7yG7ypbD\ -----END PRIVATE KEY-----\ ", "public_key": "-----BEGIN PUBLIC KEY-----\ MCowBQYDK2VwAyEA9TvFeP3nAkVi+u7Wth0QJh+87v/T4eg2VGe5Slx24K8=\ -----END PUBLIC KEY-----\ ", "format": "pem"}

ed25519 generate_keys <params>


Description

    Generate a key pair with parameters: format (pem, base64 or hex: the 32 raw bytes), seed_hex (the 32 bytes of a known private key, to find its public key)

Parameters

    params:   The parameters as JSON - String - required
admin
ed25519 generate_keys "{\"format\": \"hex\", \"seed_hex\": \"9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60\"}"
mentdb
{"private_key": "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60", "public_key": "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a", "format": "hex"}
Used in use cases (1 recipe)

    Security engineer › Store a password with Argon2id and sign a licence with Ed25519
Often used with

    ed25519 sign  ·  ed25519 verify  ·  string argon2_hash  ·  string argon2_verify

ed25519 sign <message> <private_key>


Description

    Sign a text with a private key. Returns the signature in base64

Parameters

    message:   The message (UTF-8) - String - required
    private_key:   The private key - String - required
admin
ed25519 sign "Order 42 accepted" "-----BEGIN PRIVATE KEY----- MC4CAQAwBQYDK2VwBCIEIF1DKn5EyZ8VMFyyDi8+xiSjo9ohPGQlzCJLM0G+/7L4 -----END PRIVATE KEY-----"
mentdb
5dBNDn7wN/kuiTmp9aIBAUjrcJOFQuriUh/HxCfI1YHSzUQn12yVmVDlsJWiKy6SdfvMzXIBO6f+EnjrQ006Cg==

ed25519 sign <message> <private_key> <params>


Description

    Sign with parameters: encoding of the message (utf-8, hex or base64), signature_format (base64 or hex)

Parameters

    message:   The message - String - required
    private_key:   The private key - String - required
    params:   The parameters as JSON - String - required
admin
ed25519 sign "" "9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60" "{\"encoding\": \"hex\", \"signature_format\": \"hex\"}"
mentdb
e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b
Used in use cases (1 recipe)

    Security engineer › Store a password with Argon2id and sign a licence with Ed25519
Often used with

    ed25519 generate_keys  ·  ed25519 verify  ·  string argon2_hash  ·  string argon2_verify

ed25519 verify <message> <signature> <public_key>


Description

    Check a signature: 1 or 0. Only an argument that cannot be read is an error

Parameters

    message:   The message (UTF-8) - String - required
    signature:   The signature in base64 or hexadecimal - String - required
    public_key:   The public key - String - required
admin
ed25519 verify "other" "e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b" "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a"
mentdb
0

ed25519 verify <message> <signature> <public_key> <params>


Description

    Check a signature with the parameter encoding of the message (utf-8, hex or base64)

Parameters

    message:   The message - String - required
    signature:   The signature in base64 or hexadecimal - String - required
    public_key:   The public key - String - required
    params:   The parameters as JSON - String - required
admin
ed25519 verify "" "e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b" "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a" "{\"encoding\": \"hex\"}"
mentdb
1
Used in use cases (1 recipe)

    Security engineer › Store a password with Argon2id and sign a licence with Ed25519
Often used with

    ed25519 generate_keys  ·  ed25519 sign  ·  string argon2_hash  ·  string argon2_verify