utils: hash: Use hashlib for pbkdf2
werkzeug 2.1 will deprecate `pbkdf2_bin` and recommends
pbkdf2_hmac as an alternative.
Adjust function invocation and use named args to avoid
confusion.
Compare:
> Will be gone in werkzeug 2.1
> Available since Python 3.4
import codecs
import hashlib
-from werkzeug.security import pbkdf2_bin as pbkdf2
+from hashlib import pbkdf2_hmac as pbkdf2
def _TypeError(name, expected, val):
@@ -68,7 +68,8 @@ class PBKDF2(Hash):
self.func = func
def compute(self, val):
- return pbkdf2(val, self.salt, self.iterations, self.dklen, self.func)
+ return pbkdf2(hash_name=self.func, password=val, salt=self.salt,
+ iterations=self.iterations, dklen=self.dklen)
def new(conf):
