Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ffjavascript

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ffjavascript - npm Package Compare versions

Comparing version 0.2.22 to 0.2.23

4

package.json
{
"name": "ffjavascript",
"type": "module",
"version": "0.2.22",
"version": "0.2.23",
"description": "Finite Field Library in Javascript",

@@ -18,3 +18,3 @@ "main": "./build/main.cjs",

"type": "git",
"url": "git+https://github.com/iden3/ffjs.git"
"url": "https://github.com/iden3/ffjavascript.git"
},

@@ -21,0 +21,0 @@ "keywords": [

@@ -7,3 +7,3 @@ import wasmcurves from "wasmcurves";

export default async function buildBls12381() {
export default async function buildBls12381(singleThread) {

@@ -20,3 +20,3 @@ if (curve) return curve;

cofactorG2: Scalar.e("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5", 16),
singleThread: false
singleThread: singleThread ? true : false
};

@@ -23,0 +23,0 @@

@@ -7,3 +7,3 @@ import wasmcurves from "wasmcurves";

export default async function buildBn128() {
export default async function buildBn128(singleThread) {

@@ -19,3 +19,3 @@ if (curve) return curve;

cofactorG2: Scalar.e("30644e72e131a029b85045b68181585e06ceecda572a2489345f2299c0f9fa8d", 16),
singleThread: false
singleThread: singleThread ? true : false
};

@@ -22,0 +22,0 @@

@@ -11,8 +11,8 @@ import * as Scalar from "./scalar.js";

export async function getCurveFromR(r) {
export async function getCurveFromR(r, singleThread) {
let curve;
if (Scalar.eq(r, bn128r)) {
curve = await buildBn128();
curve = await buildBn128(singleThread);
} else if (Scalar.eq(r, bls12381r)) {
curve = await buildBls12381();
curve = await buildBls12381(singleThread);
} else {

@@ -24,8 +24,8 @@ throw new Error(`Curve not supported: ${Scalar.toString(r)}`);

export async function getCurveFromQ(q) {
export async function getCurveFromQ(q, singleThread) {
let curve;
if (Scalar.eq(q, bn128q)) {
curve = await buildBn128();
curve = await buildBn128(singleThread);
} else if (Scalar.eq(q, bls12381q)) {
curve = await buildBls12381();
curve = await buildBls12381(singleThread);
} else {

@@ -37,9 +37,9 @@ throw new Error(`Curve not supported: ${Scalar.toString(q)}`);

export async function getCurveFromName(name) {
export async function getCurveFromName(name, singleThread) {
let curve;
const normName = normalizeName(name);
if (["BN128", "BN254", "ALTBN128"].indexOf(normName) >= 0) {
curve = await buildBn128();
curve = await buildBn128(singleThread);
} else if (["BLS12381"].indexOf(normName) >= 0) {
curve = await buildBls12381();
curve = await buildBls12381(singleThread);
} else {

@@ -46,0 +46,0 @@ throw new Error(`Curve not supported: ${name}`);

@@ -7,2 +7,4 @@ /* global BigInt */

return o.toString(10);
} else if (o instanceof Uint8Array) {
return Scalar.fromRprLE(o, 0);
} else if (Array.isArray(o)) {

@@ -9,0 +11,0 @@ return o.map(stringifyBigInts);

Sorry, the diff of this file is not supported yet

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