opaque-id
opaque-id copied to clipboard
Obfuscate 64-bit integers
Hello and thank you for this great package :)
I tried to leverage it with 64-bit integers but I'm not expert enough with bitwise operations to make it work, any suggestions on how this would be possible?
Thank you in advance :)
Also there are 2 questions I'd like to ask you:
- why are we multiplying the salted integer by
0x9e3b
intransform()
? - we are keeping only the first 6 characters of the base64 encoded binary, what makes this algorithm work without the full base64 string?
Thank you for your time ❤️
I ended up with this solution: https://gist.github.com/cerbero90/fb99f79570c413a05c5efa5aab6dd72e it supports 32bit and 64bit integers but does not support negative integers, feedback is more than welcome :)
Regarding the question 2, base64 representation is enough to cover all 32bit integers with 6 characters, so we can safely remove the extra =
symbols (correct me if I'm wrong).
Re question 1, I still haven't understood why we multiply by 0x9e3b