Skip to main content

pyargon2

Simultaneously the simplest and most powerful implementation of Argon2 in Python.

Installation

pip install pyargon2

Basic Usage

The hash function supports basic password hashing using the Argon2id variant and mandates password and salt strings. The resulting hash returned is hex encoded.

from pyargon2 import hash

password = 'a strong password'
salt = 'a unique salt'
hex_encoded_hash = hash(password, salt)

Advanced Usage

Function Parameters

The hash function takes in the following parameters:

Positional
  • password : A string representing a password.
  • salt : A string representing a unique salt.
Keyword
  • pepper : A secret string to fold into the hash of the password.
  • hash_len : The length in bytes of the resulting hash.
  • time_cost : The number of iterations to perform.
  • memory_cost : The number of kibibytes in memory to utilise.
  • parallelism : The number of independent computations chains (lanes) to run.
  • flags : Flags to determine which fields are securely wiped.
  • variant : Argon2 algorithm variant ('i', 'd', or 'id').
  • version : Argon2 algorithm version number.
  • encoding : Encoding for the returned hash type ('raw', 'hex' or 'b64').

Function Exceptions

Exceptions generated by the underlying Argon2 hashing function are raised under the Argon2Error class which can be imported as follows:

from pyargon2 import Argon2Error

Release files for pyargon2 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyargon2 0.9.0
File Size Uploaded
pyargon2-0.9.0.tar.gz 53.1 kB Details

Release files / pyargon2-0.9.0.tar.gz

Download URL pyargon2-0.9.0.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f87d0fc359bd0829dfebb1f35554113e072b395b085085e36795abe67825310b
BLAKE2b-256 checksum
How to use checksums
eb10cdaa436a0bd9e0c344917911990d302fbc2a0ba541a4dc5ed3650ef10365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release history Release notifications | RSS feed

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

1 release file

This release

0.9.0 This release

1 release file

0.2.8

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page