The Passlib documentation has moved to https://passlib.readthedocs.io

passlib.hash.plaintext - Plaintext

This class stores passwords in plaintext. This is, of course, ridiculously insecure; it is provided for backwards compatibility when migrating existing applications. It should not be used for any other purpose. This class should always be the last algorithm checked, as it will recognize all hashes. It can be used directly as follows:

>>> from passlib.hash import plaintext as plaintext

>>> # "encrypt" password
>>> plaintext.hash("password")
'password'

>>> # verify password
>>> plaintext.verify("password", "password")
True
>>> plaintext.verify("secret", "password")
False

See also

Interface

class passlib.hash.plaintext

This class stores passwords in plaintext, and follows the PasswordHash API.

The hash(), genhash(), and verify() methods all require the following additional contextual keyword:

Parameters:encoding (str) –

This controls the character encoding to use (defaults to utf-8).

This encoding will be used to encode unicode passwords under Python 2, and decode bytes hashes under Python 3.

Changed in version 1.6: The encoding keyword was added.