@zkfs/safe-math
TypeScript icon, indicating that this package has built-in type declarations

0.1.1-develop.275 • Public • Published

Safe Math Library for Snarkyjs

This npm package provides a safe math library for developers working with Snarkyjs.

The library is designed to ensure that all math calculations are performed securely, without having to worry about potential security issues, such as underflows or division by zero.

Quickstart

npm install @zkfs/safe-math

Usage

import { UInt64 } from 'snarkyjs';

// subtraction
safeUint64Sub(UInt64.from(2), UInt64.from(1)) // returns 1
safeUint64Sub(UInt64.from(1), UInt64.from(2)) // returns 0

// division
safeUint64Div(UInt64.from(10), UInt64.from(5)) // returns 2
safeUint64Div(UInt64.from(10), UInt64.from(0)) // returns 0

Readme

Keywords

Package Sidebar

Install

npm i @zkfs/safe-math

Weekly Downloads

4

Version

0.1.1-develop.275

License

Apache-2.0

Unpacked Size

17.7 kB

Total Files

15

Last publish

Collaborators

  • maht0rz