New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bigint-crypto-utils

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bigint-crypto-utils

Arbitrary precision modular arithmetic, cryptographically secure random numbers and strong probable prime generation/testing. It works in modern browsers, Angular, React, Node.js, etc. since it uses the native JS implementation of BigInt

  • 3.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
164K
increased by45.96%
Maintainers
1
Weekly downloads
 
Created

What is bigint-crypto-utils?

The bigint-crypto-utils npm package provides utility functions for cryptographic operations using BigInt. It includes functions for prime number generation, modular arithmetic, and other cryptographic utilities.

What are bigint-crypto-utils's main functionalities?

Prime Number Generation

This feature allows you to generate large prime numbers of a specified bit length. The code sample demonstrates generating a 512-bit prime number.

const { prime } = require('bigint-crypto-utils');

(async () => {
  const p = await prime(512);
  console.log(`Generated prime: ${p}`);
})();

Modular Exponentiation

This feature provides a function for performing modular exponentiation, which is a common operation in cryptographic algorithms. The code sample demonstrates calculating (2^10) % 17.

const { modPow } = require('bigint-crypto-utils');

const base = 2n;
const exponent = 10n;
const modulus = 17n;
const result = modPow(base, exponent, modulus);
console.log(`Result of modular exponentiation: ${result}`);

Greatest Common Divisor (GCD)

This feature provides a function to compute the greatest common divisor of two BigInt numbers. The code sample demonstrates calculating the GCD of 48 and 18.

const { gcd } = require('bigint-crypto-utils');

const a = 48n;
const b = 18n;
const result = gcd(a, b);
console.log(`GCD of 48 and 18: ${result}`);

Other packages similar to bigint-crypto-utils

Keywords

FAQs

Package last updated on 29 Jun 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc