Compare commits

...

5 Commits

Author SHA1 Message Date
Jordi Baylina
9bf1354bf1 0.5.30 2020-10-14 09:50:22 +02:00
Jordi Baylina
ed4c4b4de0 Merge branch 'master' of github.com:iden3/circom 2020-10-14 09:49:51 +02:00
Jordi Baylina
a1f3f714ea 0.5.29 2020-10-14 09:49:29 +02:00
Jordi Baylina
dafc9db614 fix fasfile pageSize 2020-10-14 09:49:13 +02:00
Marta Bellés
6e4a192c6a Update README.md 2020-10-05 10:12:00 +02:00
6 changed files with 21 additions and 12 deletions

View File

@@ -1,12 +1,15 @@
# Circom # Circom
Circom is a language designed to write arithmetic circuits that can be used in zero knowledge proofs. Circom is a language designed to write arithmetic circuits that can be used in zero-knowledge proofs.
In particular, it is designed to work in [zksnarks JavaScript library](https://github.com/iden3/zksnark). In particular, it is designed to work in [zksnarks JavaScript library](https://github.com/iden3/zksnark).
## Usage ## Usage
### Circom Docs
You can read the details of circom in [the documentation webpage](https://docs.circom.io/).
### Tutorial ### Tutorial
A good starting point [is this tutorial](https://github.com/iden3/circom/blob/master/TUTORIAL.md) A good starting point [is this tutorial](https://github.com/iden3/circom/blob/master/TUTORIAL.md)

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "circom", "name": "circom",
"version": "0.5.28", "version": "0.5.30",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "circom", "name": "circom",
"version": "0.5.28", "version": "0.5.30",
"description": "Language to generate logic circuits", "description": "Language to generate logic circuits",
"main": "index.js", "main": "index.js",
"directories": { "directories": {

View File

@@ -661,11 +661,6 @@ class BuilderC {
async _buildCircuitVar(fdData) { async _buildCircuitVar(fdData) {
const pP = fdData.pos;
const strBuff = new TextEncoder("utf-8").encode(this.header.P.toString());
await fdData.write(strBuff);
const buff = new Uint8Array(72); const buff = new Uint8Array(72);
const buffV = new DataView(buff.buffer); const buffV = new DataView(buff.buffer);
@@ -673,7 +668,7 @@ class BuilderC {
utils.setUint64(buffV, 8, this.pComponents, true); utils.setUint64(buffV, 8, this.pComponents, true);
utils.setUint64(buffV, 16, this.pMapIsInput, true); utils.setUint64(buffV, 16, this.pMapIsInput, true);
utils.setUint64(buffV, 24, this.pConstants, true); utils.setUint64(buffV, 24, this.pConstants, true);
utils.setUint64(buffV, 32, pP, true); utils.setUint64(buffV, 32, this.pPriemStr, true);
utils.setUint64(buffV, 40, this.pCets, true); utils.setUint64(buffV, 40, this.pCets, true);
buffV.setUint32(48, this.header.NSignals, true); buffV.setUint32(48, this.header.NSignals, true);
@@ -688,6 +683,16 @@ class BuilderC {
await fdData.write(buff); await fdData.write(buff);
} }
async _buildPrimeStr(fdData) {
this.pPriemStr = fdData.pos;
const strBuff = new TextEncoder("utf-8").encode(this.header.P.toString());
await fdData.write(strBuff);
const zB = new Uint8Array(1);
zB[0] =0;
await fdData.write(zB);
}
async build(fdCode, fdData) { async build(fdCode, fdData) {
const encoder = new TextEncoder("utf-8"); const encoder = new TextEncoder("utf-8");
@@ -696,6 +701,7 @@ class BuilderC {
const code=new BigArray(); const code=new BigArray();
this._buildHeader(code); this._buildHeader(code);
await this._buildPrimeStr(fdData);
await this._buildSizes(fdData); await this._buildSizes(fdData);
await this._buildConstants(fdData); await this._buildConstants(fdData);
await this._buildHashMaps(fdData); await this._buildHashMaps(fdData);

View File

@@ -473,7 +473,7 @@ module.exports = function buildRuntime(module, builder) {
); );
f.addCode( f.addCode(
c.if( // If ( mapIsInput[s >> 5] & 1 << (s & 0x1f) ) c.if( // If ( mapIsInput[s >> 5] & (1 << (s & 0x1f)) )
c.i32_and( c.i32_and(
c.i32_load( c.i32_load(
c.i32_add( c.i32_add(

View File

@@ -8,7 +8,7 @@ module.exports.buildR1cs = buildR1cs;
async function buildR1cs(ctx, fileName) { async function buildR1cs(ctx, fileName) {
const fd = await fastFile.createOverride(fileName, 1<<22, 1<<24); const fd = await fastFile.createOverride(fileName, 1<<24, 1<<22);
const buffBigInt = new Uint8Array(ctx.F.n8); const buffBigInt = new Uint8Array(ctx.F.n8);