# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
# to use, copy, modify, and distribute this software is granted under
# terms provided in the LICENSE file distributed with this software.
This is a wrapper around struct.pack, used to turn a list of integers
between 0 and 255 into a packed sequence akin to a C-style string.
"""
This is a wrapper around struct.pack, used to turn a list of integers
between 0 and 255 into a packed sequence akin to a C-style string.
"""
This is a wrapper around base64.b64encode with preferences
appropriate for encoding Unix-style passwd hash strings.
"""
This is a wrapper around base64.b64encode with preferences
appropriate for encoding Unix-style passwd hash strings.
"""
This simply generates a sequence of pseudo-random characters (with
6-bits of effective entropy per character). Since it relies on base64
encoding (which operates on 6-bit chunks of data), we only generate
This simply generates a sequence of pseudo-random characters (with
6-bits of effective entropy per character). Since it relies on base64
encoding (which operates on 6-bit chunks of data), we only generate
This utility function is meant to provide a migration path for users
of mudpy's legacy account-name-salted MD5 hexdigest password hashes.
By passing the old passhash (as legacy_hash) and name (as salt)
This utility function is meant to provide a migration path for users
of mudpy's legacy account-name-salted MD5 hexdigest password hashes.
By passing the old passhash (as legacy_hash) and name (as salt)
The meat of the module, this function takes a provided password and
generates a Unix-like passwd hash suitable for storage in portable,
text-based data files. The password is prepended with a salt (which
The meat of the module, this function takes a provided password and
generates a Unix-like passwd hash suitable for storage in portable,
text-based data files. The password is prepended with a salt (which
- # TODO: remove this check after the switch to py3k
- try:
- hashed = "".join(format(x, "02x") for x in bytes(hashed))
- except ValueError:
- hashed = "".join(format(ord(x), "02x") for x in bytes(hashed))
+ hashed = "".join(format(x, "02x") for x in bytes(hashed))
# concatenate the output fields, coercing into text form as needed
return "%s%s%s%s%s%s%s%s" % (
# concatenate the output fields, coercing into text form as needed
return "%s%s%s%s%s%s%s%s" % (
This simple function requires a text password and a mudpy-format
password hash (as generated by the create function). It returns True
if the password, hashed with the parameters from the encoded_hash,
This simple function requires a text password and a mudpy-format
password hash (as generated by the create function). It returns True
if the password, hashed with the parameters from the encoded_hash,