Created
April 28, 2021 14:26
-
-
Save reosablo/3adea54cfbe65757048886ac8a9c34ea to your computer and use it in GitHub Desktop.
JavaScript: BigInt <=> BASE64 (Little Endian) Codec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default a=>[...atob(a)].reduceRight((n,b)=>(n<<8n)+BigInt(b.charCodeAt(0)),0n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default n=>{let b='';do{b+=String.fromCharCode(Number(n%256n))}while(n>>=8n);return btoa(b)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment