key = b''
if self['string-to-key-type'] == 'simple':
update_bytes = string
+ elif self['string-to-key-type'] == 'salted':
+ update_bytes = self['string-to-key-salt'] + string
else:
raise NotImplementedError(
'key calculation for string-to-key type {}'.format(
for padding in range(hashes):
string_hash = _hashlib.new(hash_name)
string_hash.update(padding * b'\x00')
- if self['string-to-key-type'] == 'simple':
+ if self['string-to-key-type'] in [
+ 'simple',
+ 'salted',
+ ]:
string_hash.update(update_bytes)
key += string_hash.digest()
key = key[:key_size_bytes]