4 ms·
I know! That's why I am asking. I have found surprisingly difficult to find a package that does this.
by dawkins 10y ago
I know! That's why I am asking. I have found surprisingly difficult to find a package that does this.
- elithrar 10y ago> I know! That's why I am asking. I have found surprisingly difficult to find a package that does this. scrypt, with an output length that suits your use-case? (as Filippo points out) Note: I wrote https://github.com/elithrar/simple-scrypt https://github.com/elithrar/simple-scrypt, which wraps Go's scrypt package and gives it a friendlier API (mimicking the bcrypt one). Handles salt generation for you and has sane default parameters, outputting a 32-byte derived key by default. e.g. func deriveKey(key []byte) ([]byte, error) { return scrypt.GenerateFromPassword([]byte("plaintext"), scrypt.DefaultParams) } You can pass your own params, or modify the defaults to get a different key length depending on your use-case.
- dawkins 10y agoyes, that is what I was looking for. Thank you!