Equivalent Python3 code to JS DES encryption with CryptoJS

Based on Topaco’s suggestion, finally it’s working, the code is as below:

data = b'123456789'
# the next cdefghijklmnopqrstuvwxyz is no needed
key = b'123456ab'
cipher = DES.new(key, DES.MODE_ECB)
ct = cipher.encrypt(pad(data, 8))
print(binascii.b2a_base64(ct))

FYI.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top