This algorithm is used primarily by PHP software which uses PHPass [1], a PHP library similar to Passlib. The PHPass Portable Hash is a custom password hash used by PHPass as a fallback when none of it’s other hashes are available. Due to it’s reliance on MD5, and the simplistic implementation, other hash algorithms should be used if possible.
See also
password hash usage – for examples of how to use this class via the common hash interface.
This class implements the PHPass Portable Hash, and follows the Password Hash Interface.
It supports a fixed-length salt, and a variable number of rounds.
The encrypt() and genconfig() methods accept the following optional keywords:
| Parameters: |
|
|---|
An example hash (of password) is $P$8ohUJ.1sdFw09/bMaAQPTGDNi2BIUt1. A phpass portable hash string has the format $P$roundssaltchecksum, where:
Note
Note that phpBB3 databases uses the alternate prefix $H$, both prefixes are recognized by this implementation, and the checksums are the same.
PHPass uses a straightforward algorithm to calculate the checksum:
This implementation of phpass differs from the specification in one way:
Unicode Policy:
The underlying algorithm takes in a password specified as a series of non-null bytes, and does not specify what encoding should be used; though a us-ascii compatible encoding is implied by nearly all known reference hashes.
In order to provide support for unicode strings, Passlib will encode unicode passwords using utf-8 before running them through phpass. If a different encoding is desired by an application, the password should be encoded before handing it to Passlib.
Footnotes
| [1] | PHPass homepage, which describes the Portable Hash algorithm - http://www.openwall.com/phpass/ |