def str_to_key56(key_str): if not type(key_str) == six.binary_type: # TODO rsanders high - figure out how to make this not necessary key_str = key_str.encode('ascii') if len(key_str) < 7: key_str = key_str + b'\000\000\000\000\000\000\000'[:(7 - len(key_str))] key_56 = [] for i in six.iterbytes(key_str[:7]): key_56.append(i) return key_56
def decrypt(self, str): # block - UChar[] block = [] for i in six.iterbytes(str): block.append(i) # print block block = des_ecb_encrypt(block, self.KeySched, 0) res = b'' for i in block: res = res + six.int2byte(i) return res