Documentation ¶
Overview ¶
Package apr1_crypt implements the standard Unix MD5-Crypt algorithm created by Poul-Henning Kamp for FreeBSD, and modified by the Apache project.
The only change from MD5-Crypt is the use of the magic constant "$apr1$" instead of "$1$". The algorithms are otherwise identical.
Index ¶
Constants ¶
const ( MagicPrefix = "$apr1$" RandomSalt = "" SaltLenMax = 8 SaltLenMin = 1 // Real minimum is 0, but that isn't useful. )
Variables ¶
This section is empty.
Functions ¶
func Crypt ¶
Crypt takes key and salt strings and performs the MD5-Crypt hashing algorithm on them, returning a full hash string suitable for storage and later password verification.
If the salt string is the value RandomSalt, a randomly-generated salt parameter string will be generated of length SaltLenMax.
func GenerateSalt ¶
Generate a random salt parameter string of a given length.
If the length is greater than SaltLenMax, a string of that length will be returned instead. Similarly, if length is less than SaltLenMin, a string of that length will be returned instead.
Types ¶
This section is empty.