Skip to main content

Python interface to the MD5 routines of libaprutil

Project description

The python-aprmd5 project provides the Python module “aprmd5”, which in turn is an interface to the MD5 routines of the Apache Portable Runtime (APR) Utility Library (libaprutil).

The main purpose of python-aprmd5 is to expose a single function, apr_md5_encode(), from among libaprutil’s MD5 routines. That function is used to generate salted crypt-style hashes using a version of the MD5 hash algorithm that was modified for Apache. The resulting hashes always start with the prefix characters “$apr1$” in order to distinguish them from the result of various other crypt() variants, which use other prefixes. For instance, for input “foo” and salt “mYJd83wW”, apr_md5_encode() produces the following hash:

$apr1$mYJd83wW$IO.6aK3G0d4mHxcImhPX50

Hashes like this are typically generated by the command line utility htpasswd, which is part of the Apache HTTP server project. The hashes encrypt user passwords that are used by the Apache HTTP server for basic user authentication.

In an attempt to earn its name, python-aprmd5 tries to expose most of the other functions of libaprutil’s MD5 routines as well. It doesn’t try too hard, though, since those functions are mostly concerned with the original, unmodified MD5 algorithm, and access to that algorithm can be easily obtained through the Python Standard Library module “hashlib”.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page