Reputation: 63
I want to convert a TRON address in the HEX format into Base58 one without TronWeb. I can't use JS or Python either. I want to understand the algorithm to then implement it in a language of my choice.
//(1)
address = 41||sha3[12,32): 415a523b449890854c8fc460ab602df9f31fe4293f
//(2)
sha256_0 = sha256(address): 06672d677b33045c16d53dbfb1abda1902125cb3a7519dc2a6c202e3d38d3322
//(3)
sha256_1 = sha256(sha256_0): 9b07d5619882ac91dbe59910499b6948eb3019fafc4f5d05d9ed589bb932a1b4
checkSum = sha256_1[0, 4): 9b07d561
addchecksum = address || checkSum: 415a523b449890854c8fc460ab602df9f31fe4293f9b07d561
//last step
base58Address = Base58(addchecksum): TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW
However, SHA3-256 applied to 415a523b449890854c8fc460ab602df9f31fe4293f
won't generate anything remotely similar to
//(2)
06672d677b33045c16d53dbfb1abda1902125cb3a7519dc2a6c202e3d38d3322`
For instance, using an online converter
https://md5calc.com/hash/sha3-256/415a523b449890854c8fc460ab602df9f31fe4293f
SHA3-256(415a523b449890854c8fc460ab602df9f31fe4293f)
will produce
64a35f3345223990cc06d1b356e5ac7421f5e15f4dbe0fd934957fb9f0aab76e
and there's no part in it iidentical to the one in TRON documenation.
What's the matter?
update1
The 1st 2 commands have produced the correct results after I've replace HEX representation with the bytes.
But the //last step
still hasn't:
//actual HEX string, not bytes
Base58.encode("415a523b449890854c8fc460ab602df9f31fe4293f9b07d561")
===>
eJJL2m8pSeN7rACLEzRb5JMoJsZSXfFLZgGmC6LbKpdrALZMqKW6MDShkwh5xotJX4vc
Upvotes: 0
Views: 1278