INNER CODE UNIT · Go
algorithmNone
aead/minisign · private.go:170
algorithmNone = 0x0000 // hex value for KDF when key is not encrypted
algorithmScrypt = 0x6353 // hex value for "Sc"
algorithmBlake2b = 0x3242 // hex value for "B2"
scryptOpsLimit = 0x2000000 // max. Scrypt ops limit based on libsodium
scryptMemLimit = 0x40000000 // max. Scrypt mem limit based on libsodium
privateKeySize = 158 // 2 + 2 + 2 + 32 + 8 + 8 + 104
)
// EncryptKey encrypts the private key with the given password
// using some entropy from the RNG of the OS.
func EncryptKey(password string, privateKey PrivateKey) ([]byte, error) {
var privateKeyBytes [72]byte
binary.LittleEndian.PutUint64(privateKeyBytes[:], privateKey.ID())
copy(privateKeyBytes[8:], privateKey.bytes[:])
var salt [32]byte