md5crypt(n)
π md5crypt β MD5-based password encryption π
okay bestie, buckle UP, because this is md5crypt(n), the manual page for the Tcl md5crypt package, and it's literally the whole MD5-crypt password-hashing situation in one little doc. no cap. π
β¨ NAME β¨
md5crypt β MD5-based password encryption. that's it, that's the name, she's simple and she knows what she wants. π
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require md5 2.0
package require md5crypt ?1.2.0?
::md5crypt::md5crypt password salt
::md5crypt::aprcrypt password salt
::md5crypt::salt ?length?
π¦ DESCRIPTION π¦
so this package gives you an implementation of the MD5-crypt password encryption algorithm, which was pioneered by FreeBSD and is currently in use as a replacement for the unix crypt(3) function on many modern systems. iconic behaviour honestly. π
there's also an implementation of the closely related Apache MD5-crypt available, because why not have both.
and the important bit, bestie: the output of these commands is compatible with the BSD and OpenSSL implementation of md5crypt and the Apache 2 htpasswd program. so you can vibe with the whole ecosystem. π
π COMMANDS π
::md5crypt::md5crypt password saltβ generate a BSD compatible md5-encoded password hash from the plaintext password and a random salt (peep the SALT section below, it matters π).::md5crypt::aprcrypt password saltβ generate an Apache compatible md5-encoded password hash from the plaintext password and a random salt (again, SALT section, go read it).::md5crypt::salt ?length?β generate a random salt string suitable for use with themd5cryptandaprcryptcommands. it's giving "salt fairy" π§β¨
π§ SALT π§
okay so here's the tea about the salt. the salt you pass to either of the encryption schemes implemented here gets checked to see if it begins with the encryption scheme magic string β that's either "$1$" for MD5-crypt or "$apr1$" for Apache crypt. if it does? it gets removed. bye girl. π
then the remaining characters up to the next $ and up to a maximum of 8 characters are used as the salt.
and ngl, the salt text should probably be restricted to the set of ASCII alphanumeric characters plus "./" (dot and forward-slash) β this is to preserve maximum compatibility with the unix password file format. don't be chaotic with your salt, bestie, the password file has feelings. π₯Ί
if a password is being generated rather than checked from a password file, then the salt command may be used to generate a random salt. easy. β¨
β EXAMPLES β
% md5crypt::md5crypt password 01234567
$1$01234567$b5lh2mHyD2PdJjFfALlEz1
% md5crypt::aprcrypt password 01234567
$apr1$01234567$IXBaQywhAhc0d75ZbaSDp/
% md5crypt::md5crypt password [md5crypt::salt]
$1$dFmvyRmO$T.V3OmzqeEf3hqJp2WFcb.
look at that output. immaculate. ππ₯
π BUGS, IDEAS, FEEDBACK π
not to be dramatic but: this document, and the package it describes, will undoubtedly contain bugs and other problems. it's fine, we're all doing our best. π
please report such in the category md5crypt of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. please also report any ideas for enhancements you may have for either the package and/or the documentation. we love a glow-up suggestion. π
when proposing code changes, please provide unified diffs, i.e. the output of diff -u. periodt.
note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. (iykyk π«Ά)
π SEE ALSO π
md5
π KEYWORDS π
hashing, md5, md5crypt, message-digest, security πΈ
π CATEGORY π
Hashes, checksums, and encryption
π COPYRIGHT π
Copyright (c) 2003, Pat Thoyts <patthoyts@users.sourceforge.net>
okay bestie that's the whole page!! this was brought to you by tcllib, version 1.2.0, and yes the version is 1.2.0 and the source is tcllib and the manual is md5crypt(n). go hash something responsibly, mwah πβ¨π
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2003, Pat Thoyts <patthoyts@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms