How to use byte array decryption in Python?

problem description

how to use byte array decryption in Python when getting java des encrypted data and key,?

the environmental background of the problems and what methods you have tried

when performing python automated testing, you need to decrypt and compare the data

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< H1 >! / usr/local/bin/python < / H1 > < H1 >--coding: utf-8--< / H1 >

from pyDes import *

def desDescrypt ():

print ("Example of DES encryption using CBC mode\n")
key = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
arr = bytearray(key)

k = triple_des(key, CBC, pad=None, padmode=PAD_PKCS5)
data = "DES encryption algorithm"
print ("Key      : %r" % k.getKey())
print ("Data     : %r" % data)

d = k.encrypt(data)
print ("Encrypted: %r" % d)

if _ _ name__=="__main__":

ss = desDescrypt()
print ss

what result do you expect? What is the error message actually seen?

failed to decrypt, error:
File "D:/pyWorkspace/testPy/pyRRR.py", line 36, in < module >

ss = desid( )

File "D:/pyWorkspace/testPy/pyRRR.py", line 11, in desid

k = triple_des(key, pyDes.CBC, pad=None, padmode=pyDes.PAD_PKCS5)

File "C:Python27libsite-packagespyDes.py", line 710, in init

self.setKey(key)

File "C:Python27libsite-packagespyDes.py", line 727, in setKey

self._padding, self._padmode)

File "C:Python27libsite-packagespyDes.py", line 409, in init

self.setKey(key)

File "C:Python27libsite-packagespyDes.py", line 414, in setKey

self.__create_sub_keys()

File "C:Python27libsite-packagespyDes.py", line 462, in _ create_sub_keys

key = self.__permutate(des.__pc1, self.__String_to_BitList(self.getKey()))

File "C:Python27libsite-packagespyDes.py", line 421, in _ String_to_BitList

data = [ord(c) for c in data]

TypeError: ord () expected string of length 1, but int found

Sep.30,2021
The

DES algorithm has three entry parameters: Key, Data, and Mode. where Key is a 7-byte 56-bit , which is the working key of the DES algorithm; Data is 8-byte 64-bit, which is the data to be encrypted or decrypted; and Mode works in two ways: encryption or decryption.
-Baidu encyclopedia
then please learn the relationship between "byte" and "bit"

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45d13-270a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45d13-270a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?