Skip to content

o0101/abacus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔟 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.

About

🔟 abacus - bit arithmetic package to add, subtract, multiply, euclidean divide, and modexp bit arrays of any size

Resources

License

Stars

Watchers

Forks

Packages

No packages published