Please decode this :=> a46fe47f78a4859de8313e27424a60a7 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Please decode this :=> a46fe47f78a4859de8313e27424a60a7

27th Jul 2021, 10:13 AM
Sylvie
Sylvie - avatar
4 Answers
+ 10
𝗜𝗻 𝗣𝘆𝘁𝗵𝗼𝗻, sum=0 a="a46fe47f78a4859de8313e27424a60a7" for i in range(len(a)-1,0,-1): sum+=16*i+(int(a[i]) if not a[i].isalpha() else 9+ord(a[i])-96) print(sum) All i did is conversion of the above hex string into integer. There are programming languages like python that provide function for this conversion without having to write all that code . For example , print(int(a, 16))
27th Jul 2021, 10:25 AM
Abhay
Abhay - avatar
+ 2
Sylvie if you run the code i posted in first comment, it gives a very different value than what you get from print(int(a, 16)) so obviously it was wrong that i corrected second time. And sorry, but i am not into the decoding field. You can open up a new question for that.
27th Jul 2021, 5:34 PM
Abhay
Abhay - avatar
+ 1
Sylvie Sorry , but there is a little mistake in calculating the value, here is the correct code for it . sum+=16**(len(a)-1-i)*(int(a[i]) if not a[i].isalpha() else 9+ord(a[i])-96)
27th Jul 2021, 2:36 PM
Abhay
Abhay - avatar
+ 1
First tell its encoding method
29th Jul 2021, 8:01 AM
Arnav Kumar [Less/Not Active]
Arnav Kumar [Less/Not Active] - avatar