Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PBKDF derivation compiler warning #56

Open
paulfreeman opened this issue Apr 19, 2019 · 1 comment
Open

PBKDF derivation compiler warning #56

paulfreeman opened this issue Apr 19, 2019 · 1 comment

Comments

@paulfreeman
Copy link

I'm having a problem with the following usage

key = try PBKDF.deriveKey(fromPassword:password, salt: salt,
                               prf: .sha512, rounds: 1000,
                               derivedKeyLength: 256)

The compiler is telling me I have an "Ambiguous reference to member 'deriveKey(fromPassword:salt:prf:rounds:derivedKeyLength:)'

password is a String
salt is a [UInt8]
the other values are as expected

I expected the string parameter for password to enable the compiler to disambiguate the call. This is with Swift 5.0

Any thoughts? For now I'll access commoncrypto instead.

@macwish
Copy link

macwish commented Apr 26, 2019

@paulfreeman try these:

let rounds = ...
let derivedKeyLength = ...

key = try PBKDF.deriveKey(fromPassword:password, salt: salt,
                               prf: .sha512, rounds: UInt32(rounds),
                               derivedKeyLength: UInt(derivedKeyLength))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants