phpass

package
v0.596.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package phpass verifies and computes "portable PHP" password hashes — the phpass scheme used by WordPress ($P$…) and phpBB3 ($H$…). WordPress is the most-deployed CMS, so its user-table hashes are among the most common offline- crack targets (hashcat mode 400); this is the compute/verify side, and hash_crack gains a phpass dictionary mode.

Wrap-vs-native judgement

Native. phpass is an iterated MD5 (h = MD5(salt|pw); then h = MD5(h|pw) for 2^N rounds) finished with phpass's own base64 — a few dozen lines over crypto/md5; there is nothing to wrap.

Verifiable / no confidently-wrong output

The round count encoding, the MD5 loop, and the phpass base64 were confirmed against the reference passlib library (an independent oracle). Verify constant-time-compares the recomputed setting string, so a wrong password is reported as such, never asserted to match. A hash whose embedded cost is absurd (> 2^24 rounds) is rejected rather than allowed to hang.

Covered / deferred

Covered: phpass $P$ (WordPress) and $H$ (phpBB3), verify + compute. The older non-portable WordPress MD5 and the bcrypt-backed $wp$ hashes are out of scope (the latter is the bcrypt tool's domain).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compute

func Compute(magic string, roundsLog int, salt, password string) (string, error)

Compute builds a phpass hash for password. magic is "$P$" (WordPress) or "$H$" (phpBB3); roundsLog is the iteration exponent (2^roundsLog rounds; WordPress uses ~13); salt must be 8 characters.

func Verify

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

Verify reports whether password produces the given phpass ($P$ / $H$) hash.

Types

This section is empty.

Jump to

Keyboard shortcuts

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