1
0
mirror of https://github.com/rancher/os.git synced 2025-07-16 08:05:51 +00:00
os/pkg/util/crypt.go

14 lines
303 B
Go
Raw Normal View History

2021-08-31 18:14:03 +00:00
package util
import (
"github.com/tredoe/osutil/user/crypt/common"
"github.com/tredoe/osutil/user/crypt/sha512_crypt"
)
func GetEncryptedPasswd(key string) (string, error) {
c := sha512_crypt.New()
salt := common.Salt{}
saltBytes := salt.Generate(16)
return c.Generate([]byte(key), saltBytes)
}