webpass

package
v0.807.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package webpass verifies and computes the PBKDF2 password hashes used by the two dominant Python web frameworks: Django (pbkdf2_sha256$…) and Werkzeug / Flask (pbkdf2:sha256:…). These are the format of the user-credential rows in a Django/Flask database dump — a very common offline-crack target — that the credential toolkit could not previously verify, compute or crack.

Wrap-vs-native judgement

Native. Both are PBKDF2-HMAC over the standard library's crypto/sha*, reusing the generic PBKDF2 already in internal/wpa; only the framework-specific string framing (separators, salt-as-string, base64 vs hex digest) is added here.

Verifiable / no confidently-wrong output

The exact framing — PBKDF2-HMAC-SHA256, the salt used as raw bytes, a 32-byte derived key, Django's padded standard base64 vs Werkzeug's hex — was confirmed against the reference Django and Werkzeug libraries (an independent oracle) and against raw hashlib.pbkdf2_hmac. Verify constant-time-compares the recomputed derived key to the stored one, so a wrong password is reported as such, never asserted to match.

Covered / deferred

Covered: Django pbkdf2_sha256 / pbkdf2_sha1, Werkzeug pbkdf2:{sha256,sha1, sha512}, and Werkzeug scrypt:N:r:p (the modern Flask default — see scrypt.go), verify + compute. Deferred: Django's bcrypt/argon2 hasher wrappers (those delegate to the bcrypt/argon2 tools).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(scheme, algo string, iter int, salt, password string) (string, error)

Compute builds a Django or Werkzeug PBKDF2 hash string for password.

func ComputeScrypt added in v0.459.0

func ComputeScrypt(n, r, p int, salt, password string) (string, error)

ComputeScrypt builds a Werkzeug scrypt hash (scrypt:N:r:p$salt$hex).

func Scheme

func Scheme(stored string) string

Scheme reports the framework a hash belongs to ("django" / "werkzeug" / "").

func Verify

func Verify(stored, password string) (bool, error)

Verify reports whether password produces the given Django/Werkzeug PBKDF2 or Werkzeug scrypt hash. The format is auto-detected from the prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL