MCPcopy
hub / github.com/FiloSottile/age / NewScryptIdentity

Function NewScryptIdentity

scrypt.go:123–132  ·  view source on GitHub ↗

NewScryptIdentity returns a new ScryptIdentity with the provided password.

(password string)

Source from the content-addressed store, hash-verified

121
122// NewScryptIdentity returns a new ScryptIdentity with the provided password.
123func NewScryptIdentity(password string) (*ScryptIdentity, error) {
124 if len(password) == 0 {
125 return nil, errors.New("passphrase can't be empty")
126 }
127 i := &ScryptIdentity{
128 password: []byte(password),
129 maxWorkFactor: 22, // 15s on a modern machine
130 }
131 return i, nil
132}
133
134// SetMaxWorkFactor sets the maximum accepted scrypt work factor to 2^logN.
135// It must be called before Unwrap.

Callers 5

TestScryptRoundTripFunction · 0.92
TestEncryptDecryptScryptFunction · 0.92
TestScryptIdentityErrorsFunction · 0.92
UnwrapMethod · 0.92
UnwrapMethod · 0.92

Calls

no outgoing calls

Tested by 3

TestScryptRoundTripFunction · 0.74
TestEncryptDecryptScryptFunction · 0.74
TestScryptIdentityErrorsFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…