{"modulePath":"code.cloudfoundry.org/cli","version":"v6.1.1+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package bcrypt\n\nPackage bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm. See [http://www.usenix.org/event/usenix99/provos/provos.pdf](http://www.usenix.org/event/usenix99/provos/provos.pdf)\n\n## Constants\n\n```go\nconst (\n\tMinCost     int = 4  // the minimum allowable cost as passed in to GenerateFromPassword\n\tMaxCost     int = 31 // the maximum allowable cost as passed in to GenerateFromPassword\n\tDefaultCost int = 10 // the cost that will actually be set if a cost below MinCost is passed into GenerateFromPassword\n)\n```\n\n## Variables\n\n```go\nvar ErrHashTooShort = errors.New(\"crypto/bcrypt: hashedSecret too short to be a bcrypted password\")\n```\nThe error returned from CompareHashAndPassword when a hash is too short to be a bcrypt hash.\n\n```go\nvar ErrMismatchedHashAndPassword = errors.New(\"crypto/bcrypt: hashedPassword is not the hash of the given password\")\n```\nThe error returned from CompareHashAndPassword when a password and hash do not match.\n\n## Functions\n\n```go\nfunc CompareHashAndPassword(hashedPassword, password []byte) error\n```\nCompareHashAndPassword compares a bcrypt hashed password with its possible plaintext equivalent. Returns nil on success, or an error on failure.\n\n```go\nfunc Cost(hashedPassword []byte) (int, error)\n```\nCost returns the hashing cost used to create the given hashed password. When, in the future, the hashing cost of a password system needs to be increased in order to adjust for greater computational power, this function allows one to establish which passwords need to be updated.\n\n```go\nfunc GenerateFromPassword(password []byte, cost int) ([]byte, error)\n```\nGenerateFromPassword returns the bcrypt hash of the password at the given cost. If the cost given is less than MinCost, the cost will be set to DefaultCost, instead. Use CompareHashAndPassword, as defined in this package, to compare the returned hashed password with its cleartext version.\n\n## Types\n\n```go\ntype HashVersionTooNewError byte\n```\nThe error returned from CompareHashAndPassword when a hash was created with a bcrypt algorithm newer than this implementation.\n\n```go\nfunc (hv HashVersionTooNewError) Error() string\n```\n\n```go\ntype InvalidCostError int\n```\n\n```go\nfunc (ic InvalidCostError) Error() string\n```\n\n```go\ntype InvalidHashPrefixError byte\n```\nThe error returned from CompareHashAndPassword when a hash starts with something other than '$'\n\n```go\nfunc (ih InvalidHashPrefixError) Error() string\n```\n\n","path":"code.cloudfoundry.org/cli/src/code.google.com/p/go.crypto/bcrypt","name":"bcrypt","synopsis":"Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.","isRedistributable":true}
