Documentation ¶
Overview ¶
Raw package provides a raw implementation of the sha256-crypt and sha512-crypt primitives.
Index ¶
Constants ¶
const ( // Minimum number of rounds allowed for sha256-crypt and sha512-crypt. MinimumRounds = 1000 // Maximum number of rounds allowed for sha256-crypt and sha512-crypt. MaximumRounds = 999999999 // The 'default' number of rounds for sha256-crypt and sha512-crypt. // When using this rounds value, // the number of rounds is not specified explicitly in // the modular crypt format, as it is used by default. DefaultRounds = 5000 // Recommended number of rounds for sha256-crypt and sha512-crypt. // It is recommended to call sha256-crypt or // sha512-crypt with this or a proportional value. RecommendedRounds = 10000 )
Variables ¶
var ( ErrInvalidStub = errors.New("invalid stub") ErrInvalidRounds = errors.New("invalid number of rounds") )
Functions ¶
func Crypt256 ¶
Calculates sha256-crypt. The password must be plaintext and be a UTF-8 string. Salt must be a valid ASCII between 0 and 16 characters in length inclusive. For suggested values for rounds, see the constants in this package. Rounds must be in the range 1000 <= rounds <= 999999999. Otherwise, the function panics. The output is in modular crypt format.
func Crypt512 ¶
Calculates sha256-crypt. The password must be plaintext and be a UTF-8 string. Salt must be a valid ASCII between 0 and 16 characters in length inclusive. For suggested values for rounds, see the constants in this package. Rounds must be in the range 1000 <= rounds <= 999999999. Otherwise, the function panics. The output is in modular crypt format.
func EncodeBase64 ¶
Encodes a byte string using the sha2-crypt base64.
Types ¶
This section is empty.