
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
convert an integer(can be a big number) with any base(radix), represented with any character
Convert an integer with any base(radix), represented with any character
You can conver a big number! Yeah, can be super big!
// constructor, by default base string will be all alphanumerics (base62)
NumBase(baseString='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
// encode, default base will be the baseString's length
NumBase::encode(number, base=baseString.length);
// decode, default base will be the baseString's length
NumBase::decode(encodedNumber, base=baseString.length);
install it with npm:
npm install numbase
then require it:
var Numbase = require('numbase');
You can include the script with script tag, or with amd/cmd(such as requirejs, commonjs ) loaders
// Setup an instance with default base string
var base = new NumBase();
// encode a super big number(you must pass it as a string) with default radix 62
base.encode('9999999999999999999999999999999999999999999999999999999999999999');
// returns 'isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh'
// then decode it with default radix 62
base.decode('isFUl3RMFVGKeLAbPmHOAA86LLjpGwei1jXh');
// returns '9999999999999999999999999999999999999999999999999999999999999999'
// Setup an instance with custom base string
base = new NumBase('中国上海市徐汇区');
// Encode an integer, use default radix 8
base.encode(19901230); // returns '国国海区上徐市徐汇'
// Decode a string, with default radix 8
base.decode('国国海区上徐市徐汇'); // returns '19901230'
// Encode an integer, with radix 7
base.encode(19901230, 7); // returns '海海国国中徐中海汇'
// Decode a string, with radix 7
base.decode('海海国国中徐中海汇', 7); // returns '19901230'
// And there is some thing else!
// setup an instance with common letters used in articles
base = new NumBase('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?_+= %&*()#@!$\',;.');
// then encode your words(like lover letters), encode it into numbers!
// you should use decode to encode your words, strange?
base.decode('The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don\'t know that I love you!');
// returns '57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074'
// and when decode the numbers, people will see the truth
// use encode to decode numbers to words
base.encode('57031381561275606392394756616992749156901193715383571159265195685821406415964188213571176381421833854362042612855929981904540567614578869806954870724353288627661399322034962143689960167076321231141725990698446223883841721866243690267975268687767453140124074');
// returns "The furthest distance in the world, is not between life and death. But when I stand in front of you,Yet you don't know that I love you!"
FAQs
convert an integer(can be a big number) with any base(radix), represented with any character
We found that numbase demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.