md5crypt(3tcl)
π md5crypt β the manual page, but make it cute π
okay bestie, you're reading md5crypt(3tcl), and honestly? she's an icon. password hashing, but make it β¨vibesβ¨. let's go π«Ά
β¨ NAME β¨
md5crypt β MD5-based password encryption. that's it, that's the whole name, and she's serving π
πΈ 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 basically, this package gives you an implementation of the MD5-crypt password encryption algorithm β the one FreeBSD pioneered, and the one that's currently out here replacing the unix crypt(3) function on a whole bunch of modern systems. main character energy, truly. π₯
and because one slay wasn't enough, there's also an implementation of the closely related Apache MD5-crypt available too. you're welcome. πβοΈ
the way that this matters: the output of these commands is compatible with the BSD and OpenSSL implementation of md5crypt, and also with the Apache 2 htpasswd program. no cap. π
π¦ COMMANDS π¦
::md5crypt::md5crypt password saltβ generates a BSD compatible md5-encoded password hash from the plaintext password and a random salt (peep the SALT section below, bestie π).::md5crypt::aprcrypt password saltβ generates an Apache compatible md5-encoded password hash from the plaintext password and a random salt (again, SALT section, iykyk).::md5crypt::salt ?length?β generates a random salt string that's suitable for use with themd5cryptandaprcryptcommands. little salt fairy, doing her thing β¨π§
π§ SALT π§
here's the tea on salt, and it's lowkey important so listen up:
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? that bit gets removed. βοΈ
then the remaining characters, up to the next $ and up to a maximum of 8 characters, are used as the salt. periodt.
also, 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. it's giving responsible queen. π
and if you're generating a password rather than checking one from a password file, then the salt command may be used to generate a random salt. easy. π
π EXAMPLES π
look at her go:
% md5crypt::md5crypt password 01234567
$1$01234567$b5lh2mHyD2PdJjFfALlEz1
% md5crypt::aprcrypt password 01234567
$apr1$01234567$IXBaQywhAhc0d75ZbaSDp/
% md5crypt::md5crypt password [md5crypt::salt]
$1$dFmvyRmO$T.V3OmzqeEf3hqJp2WFcb.
ate. no crumbs. ππ₯
π BUGS, IDEAS, FEEDBACK π
ngl, this is the part where we keep it real:
this document, and the package it describes, will undoubtedly contain bugs and other problems. not me being dramatic, that's literally what it says. π
please report such in the category md5crypt of the Tcllib Trackers at [http://core.tcl.tk/tcllib/reportlist]. and please also report any ideas for enhancements you may have for either the package and/or the documentation. we're listening, bestie π«Ά
when proposing code changes, please provide unified diffs, i.e the output of diff -u.
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. yes, that specific button. that one. π
π 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>
and that's the whole page, bestie!! π this was brought to you by tcllib, version 1.2.0, serving from the md5crypt(3tcl) manual. stay salty (cryptographically speaking) π§πβ¨
π¦ where this page comes from
- debian trixie: tcllib 2.0+dfsg-4 Β· Tcl
- ubuntu questing: tcllib 2.0+dfsg-4
- ubuntu resolute: tcllib 2.0+dfsg-5 Β· Tcl
- ubuntu stonking: tcllib 2.0+dfsg-6 Β· Tcl
- 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