Reputation: 20419
On data import I should apply the following transformation:
if value:
return hashlib.sha512(value + salt).hexdigest()
How can I use that with import_transform?
Upvotes: 0
Views: 118
Reputation: 20419
The following helped:
import_transform: "lambda x: hashlib.sha512(x.encode('utf-8') + 'actual_salt_value').hexdigest()"
Upd. the following code handles the case, when field is missed in the upload file:
import_transform: "lambda x: None if x is None or x=='' else hashlib.sha512(x.encode('utf-8') + 'actual_salt_value').hexdigest()"
Upvotes: 1