Documentation ¶
Overview ¶
Package sha512_crypt implements Ulrich Drepper's SHA512-Crypt password hashing algorithm.
The specification for this algorithm can be found here: http://www.akkadia.org/drepper/SHA-crypt.txt
Index ¶
Constants ¶
const ( MagicPrefix = "$6$" RandomSalt = "" RoundsDefault = 5000 RoundsMax = 999999999 RoundsMin = 1000 SaltLenMax = 16 SaltLenMin = 1 )
Variables ¶
This section is empty.
Functions ¶
func Crypt ¶
Crypt takes key and salt strings and performs the SHA512-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 with a length of SaltLenMax and RoundsDefault number of rounds.
func GenerateSalt ¶
GenerateSalt creates a random salt parameter string with the random bytes being of the length provided, and the rounds parameter set as specified.
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.
If rounds is equal to RoundsDefault, then the 'rounds=' part of the salt parameter string is elided.
Types ¶
This section is empty.