NewScryptIdentity returns a new ScryptIdentity with the provided password.
(password string)
| 121 | |
| 122 | // NewScryptIdentity returns a new ScryptIdentity with the provided password. |
| 123 | func 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. |
no outgoing calls
searching dependent graphs…