🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

bitmath

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitmath

add, subtract, multiply, euclidean divide bit arrays of any size

1.1.2
latest
Source
npm
Version published
Weekly downloads
6
-14.29%
Maintainers
1
Weekly downloads
 
Created
Source

:keycap_ten: abacus npm downloads version

bit arithmetic package to add, subtract, multiply, euclidean divide bit arrays of any size.

Uses Uint1Array.

get

npm i --save bitmath

api

import m from 'bitmath';
import Uint1Array from 'uint1array';

x = m.from(28);               // create bit field from number 28
y = Uint1Array.of(1,1,1);     // or just create using Uint1Array TypedArray
z = Uint1Array.of(0,1);

m.add(x,y)
m.mul(x,y)
m.div(x,y)
m.dif(x,y)                    // subtract (note: sign is omitted)
m.mod(x,y)
m.modexp(x,y,x)

Timesafe Notes

Modexp using repeated squaring in a (trying to be) timesafe way is implemented.

Keywords

bitmath

FAQs

Package last updated on 19 Jan 2020

Did you know?

Socket

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.

Install

Related posts