Skip to content

Instantly share code, notes, and snippets.

@MRuy
Created January 2, 2019 23:55
Show Gist options
  • Save MRuy/4400d8141f99eecfd806737b11ba4294 to your computer and use it in GitHub Desktop.
Save MRuy/4400d8141f99eecfd806737b11ba4294 to your computer and use it in GitHub Desktop.
Converting steam32 id to steam64 with native BigInt in ES6
function steam32To64(steam32) {
const SteamID64Identifier = 76561197960265728n;
const sidSplit = steam32.split(':');
const z = BigInt(sidSplit[2]);
const y = BigInt(sidSplit[1]);
return (SteamID64Identifier + (z * 2n) + y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment