mirror of
https://github.com/donl/gPanel.git
synced 2026-05-26 22:06:36 -06:00
13 lines
430 B
Go
13 lines
430 B
Go
// Encryption package has functions inside of it that utilize various encypting and hashing techniques
|
|
package encryption
|
|
|
|
import "golang.org/x/crypto/bcrypt"
|
|
|
|
func HashPassword(password string) (string, error) {
|
|
hash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
|
return string(hash), err
|
|
}
|
|
|
|
func CheckPassword(hash, plainText []byte) error {
|
|
return bcrypt.CompareHashAndPassword(hash, plainText)
|
|
}
|