Andre-Schuiki / esphome_im350

GNU General Public License v3.0
13 stars 8 forks source link

Different results when using decrypt_with_cryptography.py and decrypt_with_gurux.py #4

Open alexwala opened 2 years ago

alexwala commented 2 years ago

Hi

Having a Siemen IM 350. Currently testing one message captured from device (inserted in message_hex_string).

decrypt_with_gurux.py gives me the correct output decrypt_with_cryptography.py gives different/wrong output - all values seem to be very high

shouldn't both programs deliver the same result when using the same input for message_hex_string and decryption_key_hex_string ?

thx

alexwala commented 2 years ago

modifying indexes gives me the same result:

counter_reading_p_in = int.from_bytes(ciphertext_decrypted[53:57], byteorder="big")
counter_reading_p_out = int.from_bytes(ciphertext_decrypted[58:62], byteorder="big")
counter_reading_q_in = int.from_bytes(ciphertext_decrypted[63:67], byteorder="big")
counter_reading_q_out = int.from_bytes(ciphertext_decrypted[68:72], byteorder="big")
current_power_usage_in = int.from_bytes(ciphertext_decrypted[73:77], byteorder="big")
current_power_usage_out = int.from_bytes(ciphertext_decrypted[78:82], byteorder="big")