sectroyer / SmartCrypto

SmartView2 Handshake API implementation
GNU Affero General Public License v3.0
12 stars 25 forks source link

Running rijndael encryption in python3 #4

Closed eclair4151 closed 5 years ago

eclair4151 commented 5 years ago

I am trying to port this script to python3 and add some examples of sending messages to tvs. I am having an issue with your rijndael encryption though. im not sure if you modified the rijndael function in this lib but i am unable to reproduce the output that your class gives. Take this code for instance using your class

import rijndael

trans_raw = '6c9474469ddf7578f3e5ad8a4c703d99'
raw_prime = '583423bbbf900e9a211664861e28c9f347835017'

transkey = trans_raw.decode('hex')
prime = raw_prime.decode('hex')[:16]

r = rijndael.rijndael(transkey)
result = r.encrypt(prime).encode('hex')

print result

#result = fa016bdda2f884d9126fc746f5a00714

No matter what implementation i use i am completely unable to get 'fa016bdda2f884d9126fc746f5a00714' from the 2 input numbers. for example: http://rijndael.online-domain-tools.com/run/?inputType=frm-text&text=583423bbbf900e9a211664861e28c9f347835017&text_type=hex&function=rijndael-256&mode=ecb&key=6c9474469ddf7578f3e5ad8a4c703d99&key_type=hex&do=form-submit&encrypt=do

Do you have any advice on how i can achieve this encryption in python3?

eclair4151 commented 5 years ago

figured it out. it was because you manually changed the number of rounds to 3 :)