Interesting. I am not able to reproduce this with Javascript. Because your last method is a binary2hex conversion but the outcome from the base62 decode is not a binary representation from what I understand.
From a JS perspective I found the following stuff helpful:
https://www.npmjs.com/package/aybabtu
function fromBase62(s) {
var digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var result = 0;
for (var i = 0; i < s.length; i++) {
var p = digits.indexOf(s[i]);
if (p < 0) {
return NaN;
}
result += p * Math.pow(digits.length, s.length - i - 1);
}
return result;
}
Unfortunately neither the bin2hex nor dec2hex methods help, when I use your input strings.
I created a codesandbox for that problem if someone is interested to play around with it. The final value is 1 for my input string which is wrong ;(
https://codesandbox.io/s/kind-hypatia-dp5vh0?file=/src/index.js
Thanks