I'm trying to encrypt some data using triple DES ECB, but I get a discrepancy between OpenSSL and the pyDES library I'm using.
When trying to get a KCV value, I'm using a file consisting of 8 bytes each with value 0.
I'm using the following OpenSSL command (des-ede3 chosen based on this):
openssl enc -des-ede3 -pass pass:abcdefgh12345678abcdefgh -in empty8.bin -nosalt | xxd
which results in:
00000000: 17f7 b498 bd79 4d55 5e40 aa9c 2907 44bb .....yMU^@..).D.
I'm using the following Python script, based on this question:
import binascii
import hashlib
import base64
from pyDes import *
key = 'abcdefgh12345678abcdefgh'
fileInput = open("empty8.bin", "rb")
data = fileInput.read()
print('key: ' + str(key))
k = triple_des(key, ECB)
d = k.encrypt(data)
print('KCV: ' + str(binascii.hexlify(d)[0:8]))
which results in:
key: abcdefgh12345678abcdefgh
KCV: b'37c92746'
I've also tried using http://online-domain-tools.com/ for a reference, which gives the same result as the Python code.
Can anyone offer any insights into why OpenSSL produces a different result?
