November 16th, 2012, 01:03 PM
Crypto python DES encryption with hex
i want to make a program that encrypts and decrypts. Because it is too big i wont post it but only the interesting code:
my problem is that this code produces symbols, while i want to make it produce hexadecimal numbers. how can i do it? (for both input and output)
pt = str(input_txt) # has to be multiple of 8
key = str(input_key) # must be 8 bytes long
des = DES.new(key, DES.MODE_ECB)
chiper_txt = des.encrypt(input_txt)
November 16th, 2012, 04:41 PM
a method to convert decimal numbers to hexadecimal:
dec = input()
#use hex(dec)[2:] to remove "0x" etc.
November 17th, 2012, 06:01 AM
i already knew that but it wont help if the outcome is string ad not a number... any other suggestions?
Originally Posted by Yegers
November 17th, 2012, 02:11 PM
this should do the the job ^^'
>>> import binascii
Good luck Yegers