skillfed

pyscrypt

Pure-Python Implementation of the scrypt password-based key derivation function and scrypt file format library

pyscrypt v1.6.2 246.7K downloads/30d#8,705 on PyPI83
Permissive license License :: OSI Approved :: MIT License Abandoned released

What it is and what it does

pyscrypt is a pure-Python reference implementation of the scrypt password-based key derivation function (PBKDF). It provides two main capabilities: hashing passwords with configurable work factors (N, r, p parameters) to produce cryptographic keys, and reading/writing files encrypted with the scrypt file format. The package has no external dependencies and supports both Python 2 and 3, though it is intentionally slow—the documentation explicitly states it is 'not meant to be fast, more of a reference solution.' The scrypt algorithm itself is CPU and memory intensive by design, making brute-force password attacks computationally expensive.

The package includes a ScryptFile class for transparent file encryption/decryption and a hash function for key derivation. It comes with test cases that can be validated against the command-line scrypt utility. However, the project has been abandoned since 2015, with the maintainer noting that faster C-wrapper implementations exist for production use. For most real-world applications requiring scrypt, a maintained C-based library would be preferable.

Use it for:

  • Hashing user passwords for authentication systems where you need a slow, memory-hard key derivation function.
  • Encrypting sensitive files using the scrypt file format for compatibility with the command-line scrypt utility.
  • Educational or reference purposes to understand how scrypt works without external C dependencies.
  • Legacy system maintenance where existing code depends on pyscrypt's pure-Python implementation.
  • Scenarios where you cannot use compiled C extensions and need scrypt functionality despite performance trade-offs.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pure-Python implementation of the scrypt password-based key derivation function that hashes passwords and encrypts/decrypts files using the scrypt algorithm.

No, unless you have a specific legacy dependency or educational need. The package is abandoned (last release 2015), explicitly slow by design, and the maintainer recommends C-wrappers for production use. For new projects, use a maintained scrypt library or bcrypt/argon2 instead. The lack of maintenance and known performance limitations make it unsuitable for most modern applications.

Install

pyscrypt on PyPI

pip

pip install pyscrypt

uv

uv add pyscrypt

poetry

poetry add pyscrypt

Installing pyscrypt

Before you install

High install friction: the package is abandoned (last release 2015-02-03, last commit 2022-07-02) with no external dependencies but relies on pure Python, making it slow by design. The maintainer explicitly notes it is 'not meant to be fast, more of a reference solution.' Consider a maintained C-wrapper alternative for production use.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions, provided you include the license notice.

Quickstart

import pyscrypt

# Hash a password
hashed = pyscrypt.hash(password=b"correct horse battery staple",
                       salt=b"seasalt",
                       N=1024, r=1, p=1, dkLen=32)

# Encrypt a file
with pyscrypt.ScryptFile('file.scrypt', b'password', 1024, 1, 1) as f:
    f.write(b"Hello World")

Python 3 requires password and salt as byte objects (b"..."), not strings. ScryptFile mode must be 'rb' or 'wb'.

Verify before relying

  • Whether the pure-Python implementation is suitable for your security requirements or if a C-wrapper is necessary for production.
  • Current compatibility with modern Python versions beyond the 2.x/3.x support stated in documentation.
  • Whether the reference implementation has been audited for cryptographic correctness.

Package facts

License License :: OSI Approved :: MIT License (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 4,210 days since the last release
Last repo commit
First released
Downloads 246,727/month — #8,705 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyscrypt-1.6.2.tar.gz

License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: Security :: Cryptography

Tags

scrypt password hashingkey derivation function pythonpassword-based encryptionscrypt file encryptionpbkdf scrypt implementationpure python cryptographyscrypt file format
reference-implementationabandonedpure-python

More Cryptography packages