Socket
Socket
Sign inDemoInstall

r1csfile

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

r1csfile - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

3

package.json
{
"name": "r1csfile",
"version": "0.0.4",
"version": "0.0.5",
"description": "r1cs file format parser",

@@ -31,2 +31,3 @@ "main": "index.js",

"dependencies": {
"fastfile": "0.0.1",
"ffjavascript": "0.1.0"

@@ -33,0 +34,0 @@ },

const Scalar = require("ffjavascript").Scalar;
const fs = require("fs");
const assert = require("assert");
const ZqField = require("ffjavascript").ZqField;
const fastFile = require("fastfile");

@@ -10,6 +10,5 @@ module.exports.loadR1cs = loadR1cs;

const res = {};
const fd = await fs.promises.open(fileName, "r");
const fd = await fastFile.readExisting(fileName);
const b = Buffer.allocUnsafe(4);
await fd.read(b, 0, 4, 0);
const b = await fd.read(0, 4);

@@ -97,4 +96,3 @@ if (b.toString() != "r1cs") assert(false, "Invalid File format");

async function readU32() {
const b = Buffer.allocUnsafe(4);
await fd.read(b, 0, 4, p);
const b = await fd.read(p, 4);

@@ -107,4 +105,3 @@ p+=4;

async function readU64() {
const b = Buffer.allocUnsafe(8);
await fd.read(b, 0, 8, p);
const b = await fd.read(p, 8);

@@ -120,15 +117,10 @@ p+=8;

async function readBigInt() {
const n32 = n8/4;
const b = Buffer.allocUnsafe(n8);
await fd.read(b, 0, n8, p);
const buff = await fd.read(p, n8);
assert(buff.length == n8);
const buffR = Buffer.allocUnsafe(n8);
for (let i=0; i<n8; i++) buffR[i] = buff[n8-1-i];
p += n8;
const arr = new Array(n32);
for (let i=0; i<n32; i++) {
arr[n32-1-i] = b.readUInt32LE(i*4);
}
const n = Scalar.fromArray(arr, 0x100000000);
return n;
return Scalar.fromString(buffR.toString("hex"), 16);
}

@@ -135,0 +127,0 @@

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