
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
A JavaScript Base62 encode/decoder
Base62 encoding converts numbers to ASCII strings (0-9, a-z and A-Z) and vice versa, which typically results in comparatively short strings. Such identifiers also tend to more readily identifiable by humans.
999 ≙ "g7"9999 ≙ "2Bh"238327 ≙ "ZZZ"npm install base62
alternatively using Yarn:
yarn add base62
For backwards compatibility, Base62.js exposes v1.x's API by default – see Legacy API below. For efficiency, v2.x's modernized API allows selectively importing individual modules instead:
var base62 = require("base62/lib/ascii");
base62.encode(999); // "g7"
base62.decode("g7"); // 999
This uses the default ASCII character set for encoding/decoding.
It's also possible to define a custom character set instead:
var base62 = require("base62/lib/custom");
var charset = "~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-=";
charset = base62.indexCharset(charset);
base62.encode(999, charset); // "F3"
base62.decode("F3", charset); // 999
Note that indexCharset typically expects the respective string to contain
exactly 62 unique character, but does not validate this for efficieny. In fact,
it's also possible to use characters sets with more than 62 characters in order
to achieve shorter identifiers for large numbers.
Base62.js v1.x's API is maintained for backwards compatibility.
var base62 = require("base62");
base62.encode(999); // "g7"
base62.decode("g7"); // 999
This uses the default ASCII character set for encoding/decoding.
It's also possible to define a custom character set instead:
var base62 = require("base62");
var charset = "~9876543210ABCDEFGHIJKLMNOPQRSTU$#@%!abcdefghijklmnopqrstuvw-=";
base62.setCharacterSet(charset);
base62.encode(999); // "F3"
base62.decode("F3"); // 999
setCharacterSet ensures that the respective string contains exactly 62 unique
characters.
Source code is hosted on GitHub. Please report issues or feature requests in GitHub Issues.
package.json.git tag -am "1.2.3" v1.2.3).git push --tags origin master and npm publish.Copyright (c) 2016 Andrew Nesbitt. See LICENSE for details.
The base-x package is a versatile encoding library that supports custom base encoding schemes, including Base62. It is more flexible than base62 as it allows you to define your own character set for encoding and decoding.
The base64url package provides Base64 URL-safe encoding and decoding. While it focuses on Base64 rather than Base62, it is useful for similar applications where URL-safe encoding is required.
The btoa package provides Base64 encoding and decoding for Node.js. It is a simple and lightweight alternative for Base64 encoding, but does not support Base62.
FAQs
JavaScript Base62 encode/decoder
The npm package base62 receives a total of 248,480 weekly downloads. As such, base62 popularity was classified as popular.
We found that base62 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.