Skip to content

Instantly share code, notes, and snippets.

@yigityus
Last active October 3, 2017 19:57
Show Gist options
  • Select an option

  • Save yigityus/de1f4c89d91b2627e87f5e8d9ae10e2c to your computer and use it in GitHub Desktop.

Select an option

Save yigityus/de1f4c89d91b2627e87f5e8d9ae10e2c to your computer and use it in GitHub Desktop.
import binascii
import hashlib
import base64
from pyDes import *
data = '000000000000000000000000000000'
#key = '48C3B4286FF421A4A328E68AD9E542A4'
key = 'E6F1081FEA4C402CC192B65DE367EC3E'
key = binascii.unhexlify(key)
data= binascii.unhexlify(data)
print('key: ' + str(key))
k = triple_des(key, ECB, "\0\0\0\0\0\0\0\0", pad=None, padmode=PAD_PKCS5)
d = k.encrypt(data)
print('KCV: ' + str(binascii.hexlify(d)[0:8]))
print(hex(0x12ef ^ 0xabcd))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment