From 7cea1d89c3f95815614afa9423f1b24bfc08ee97 Mon Sep 17 00:00:00 2001 From: Jens J Date: Sat, 10 Dec 2022 21:59:20 -0600 Subject: [PATCH] fix CryptDeriveKey for RC4 & MD5 fixes https://github.com/crappycrypto/wincrypto/issues/5 --- wincrypto/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wincrypto/api.py b/wincrypto/api.py index cc7de3e..353c127 100644 --- a/wincrypto/api.py +++ b/wincrypto/api.py @@ -102,4 +102,7 @@ def CryptDeriveKey(hash_alg, algid): else: key = hash_val key = key[:alg_class.key_len] - return alg_class(key) \ No newline at end of file + if algid == CALG_RC4: + # MSFT RC4 only uses 5 bytes of hash, zero padded + key = key[:5] + bytes(11) + return alg_class(key)