Skip to content

Commit 8300a9d

Browse files
committed
Fix bug in generate.js for pre-garbling
1 parent 49cd461 commit 8300a9d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.DS_Store
33
node_modules
44
package-lock.json
5+
circuits/gg

test/suite/generate.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
'use strict';
77

8-
const fs = require('fs').promises;
8+
const fs = require('fs');
99

1010
const circuit = require('../../src/data/circuit');
1111
const garble = require('../../src/garble');
@@ -26,16 +26,16 @@ async function generateGarbledGates(filenames, index) {
2626
}
2727

2828
var timeStart = (new Date()).getTime();
29-
let raw = await fs.readFile('./circuits/bristol/' + filenames[index] + '.txt', 'utf8');
29+
let raw = await fs.promises.readFile('./circuits/bristol/' + filenames[index] + '.txt', 'utf8');
3030
let c = circuit.fromBristolFashion(raw);
3131

3232
let wToLs_G = garble.generateWireToLabelsMap(c);
3333
let assignmentPathAndFile = './circuits/gg/' + filenames[index] + '.assignment.json';
34-
fs.writeFile(assignmentPathAndFile, wToLs_G.toJSONString());
34+
fs.promises.writeFile(assignmentPathAndFile, wToLs_G.toJSONString());
3535

3636
let gatesGarbled_G = garble.garbleGates(c, wToLs_G);
3737
let ggPathAndFile = './circuits/gg/' + filenames[index] + '.gg.json';
38-
fs.writeFile(ggPathAndFile, gatesGarbled_G.toJSONString());
38+
fs.promises.writeFile(ggPathAndFile, gatesGarbled_G.toJSONString());
3939

4040
var timeEnd = (new Date()).getTime();
4141
console.log(' * generated ' + filenames[index] + '.*.json (' + (timeEnd-timeStart) + 'ms)')

0 commit comments

Comments
 (0)