Argon2

Category: Crypto

Status: Registered and callable in the CyberChef 11.3.0 compatibility inventory.

Input / output: string → string

Background: https://wikipedia.org/wiki/Argon2

What it does

Argon2 is a key derivation function that was selected as the winner of the Password Hashing Competition in July 2015. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg. Enter the password in the input to generate its hash.

Note

Status here means the operation name is implemented and callable. It does not by itself promise byte-for-byte parity for every upstream option. See Compatibility and current status for the verified scope and known boundaries.

Arguments and options

Arguments are positional. Keep their order when using bake() or Pipeline.then().

Index

Name

UI type

PyChef default

Accepted values / format

0

Salt

toggleString

{'string': 'somesalt', 'option': 'UTF8'}

'somesalt'

1

Iterations

number

3

A Python integer or floating-point value

2

Memory (KiB)

number

4096

A Python integer or floating-point value

3

Parallelism

number

1

A Python integer or floating-point value

4

Hash length (bytes)

number

32

A Python integer or floating-point value

5

Type

option

'Argon2i'

'Argon2i', 'Argon2d', 'Argon2id'

6

Output format

option

'Encoded hash'

'Encoded hash', 'Hex hash', 'Raw hash'

Recipe template

Important

This is a call template built from the documented defaults. Replace placeholder values such as empty keys, paths, patterns, or lookup data before running it.

from pychef import bake

input_value = "example"
args = [{'string': 'somesalt', 'option': 'UTF8'}, 3, 4096, 1, 32, 'Argon2i', 'Encoded hash']
result = bake(input_value, [{"op": 'Argon2', "args": args}])
print(result)

Pipeline example

from pychef import Pipeline

args = [{'string': 'somesalt', 'option': 'UTF8'}, 3, 4096, 1, 32, 'Argon2i', 'Encoded hash']
transform = Pipeline().then('Argon2', *args)
result = transform("example")

Dedicated operation module

The registered entry point lives in pychef.operations.by_operation.argon2. Direct calls receive the input value and a positional argument tuple:

from pychef.operations.by_operation.argon2 import run

result = run("example", tuple([{'string': 'somesalt', 'option': 'UTF8'}, 3, 4096, 1, 32, 'Argon2i', 'Encoded hash']))
pychef.operations.by_operation.argon2.run(value, args)

Run this operation using its shared internal implementation.

Parameters:
  • value (str | bytes)

  • args (Sequence[Any])

Return type:

str | bytes