Skip to content

Commit

Permalink
fix CryptDeriveKey for RC4 & MD5
Browse files Browse the repository at this point in the history
  • Loading branch information
zerog2k authored Dec 11, 2022
1 parent 7b87ba7 commit 7cea1d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wincrypto/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,7 @@ def CryptDeriveKey(hash_alg, algid):
else:
key = hash_val
key = key[:alg_class.key_len]
return alg_class(key)
if algid == CALG_RC4:
# MSFT RC4 only uses 5 bytes of hash, zero padded
key = key[:5] + bytes(11)
return alg_class(key)

0 comments on commit 7cea1d8

Please sign in to comment.