Skip to content
Browse files

Improve *.format documentation

  • Loading branch information...
1 parent 9fbe63e commit e6e8752ff5f887b54bcd3a80147a5a18c4e3df0d @DasIch committed Apr 4, 2013
Showing with 10 additions and 0 deletions.
  1. +10 −0 pwhash/hashers.py
View
10 pwhash/hashers.py
@@ -229,6 +229,9 @@ def format(self, parsed_hash):
"""
Takes a :class:`PasswordHash` object as returned by :meth:`parse` and
returns a byte string that must be parseable by :meth:`parse`.
+
+ The given hash object is expected to have an `cost` parameter
+ corresponding to the `cost` argument :class:`BCryptHasher` takes.
"""
return b"$".join([
native_to_bytes(parsed_hash.name),
@@ -322,6 +325,10 @@ def format(self, parsed_hash):
"""
Takes a :class:`PasswordHash` object as returned by :meth:`parse` and
returns a byte string that must be parseable by :meth:`parse`.
+
+ The given hash object is expected to have a `rounds` and `method`
+ parameter, corresponding to the arguments passed to
+ :class:`PBKDF2Hasher` as well as a `salt` parameter of type `str`.
"""
return b"$".join([
native_to_bytes(parsed_hash.name),
@@ -441,6 +448,9 @@ def format(self, parsed_hash):
"""
Takes a :class:`PasswordHash` object as returned by :meth:`parse` and
returns a byte string that must be parseable by :meth:`parse`.
+
+ The given hash object is expected to have a `salt` parameter of type
+ `str`.
"""
return b"$".join([
native_to_bytes(parsed_hash.name),

0 comments on commit e6e8752

Please sign in to comment.
Something went wrong with that request. Please try again.