Documentation ¶
Overview ¶
Package raw provides a raw implementation of the sha256-crypt and sha512-crypt primitives.
Index ¶
Constants ¶
const DefaultRounds = 5000
This is the 'default' number of rounds for sha256-crypt and sha512-crypt. If this rounds value is used the number of rounds is not explicitly specified in the modular crypt format, as it is the default.
const MaximumRounds = 999999999
The maximum number of rounds permissible for sha256-crypt and sha512-crypt. Don't use this!
const MinimumRounds = 1000
The minimum number of rounds permissible for sha256-crypt and sha512-crypt.
const RecommendedRounds = 10000
This is the recommended number of rounds for sha256-crypt and sha512-crypt. This may change with subsequent releases of this package. It is recommended that you invoke sha256-crypt or sha512-crypt with this value, or a value proportional to it.
Variables ¶
var ErrInvalidRounds = fmt.Errorf("invalid number of rounds")
Indicates that the number of rounds specified is not in the valid range.
var ErrInvalidStub = fmt.Errorf("invalid stub")
Indicates that a password hash or stub is invalid.
Functions ¶
func Crypt256 ¶
Calculates sha256-crypt. The password must be in plaintext and be a UTF-8 string.
The salt must be a valid ASCII between 0 and 16 characters in length inclusive.
See the constants in this package for suggested values for rounds.
Rounds must be in the range 1000 <= rounds <= 999999999. The function panics if this is not the case.
The output is in modular crypt format.
func Crypt512 ¶
Calculates sha256-crypt. The password must be in plaintext and be a UTF-8 string.
The salt must be a valid ASCII between 0 and 16 characters in length inclusive.
See the constants in this package for suggested values for rounds.
Rounds must be in the range 1000 <= rounds <= 999999999. The function panics if this is not the case.
The output is in modular crypt format.
func EncodeBase64 ¶
Encodes a byte string using the sha2-crypt base64 variant.
Types ¶
This section is empty.