Closed andreas-bulling closed 5 years ago
in the crypto.py file add this
print(hex(pow(bnPGx, bnPrivateKey, bnPrime)))
before this line
secret = bytes.fromhex(hex(pow(bnPGx, bnPrivateKey, bnPrime)).rstrip("L").lstrip("0x"))
and paste the output for me please.
It only happens sometimes - now I instead always see https://github.com/kdschlosser/samsungctl/issues/73 again and can't reproduce the problem mentioned above. Will continue trying and paste the output when I hit that error again.
OK I will fix #73 shortly.
now this error occurred again
ok great. did you add that print statement?? do you have a printout???
I know exactly what causes this random issue. It was an issue also in the original code. I made a fix for this and will be released when I will made a PR of my branch that adds the full compatibility with python 2. However this should fix it:
secret = hex(pow(bnPGx, bnPrivateKey, bnPrime)).rstrip("L").lstrip("0x")
secret = ((len(secret)%2)*'0')+secret
secret = bytes.fromhex(secret)
As I said this fix will be in my PR (slightly modified because, as it is, it is only python 3 compatible).
@p3g4asus do a separate PR for this fix please. remember the ability to reverse changes. makes it easier with more commits to narrow down where an issue may be.
TY for coming up with a solution. Makes it easier when you have the TV..