Skip to content

Commit

Permalink
Merge pull request #167 from zkemail/upstream-nozee
Browse files Browse the repository at this point in the history
Upstreaming ASCII from nozee
  • Loading branch information
Divide-By-0 committed Mar 29, 2024
2 parents 892d199 + 3401647 commit 689619b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/circuits/helpers/ascii.circom
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pragma circom 2.1.4;
include "circomlib/circuits/comparators.circom";

// from nozee (emmaguo13, sehyunc, kaylee)
// https://github.com/emmaguo13/zk-blind/blob/master/circuits/ascii.circom
// only converts ascii to numbers from 0-9
template AsciiToNum (max_input) {
signal input in[max_input];
signal output out;

var temp = in[0] - 48;

for (var i = 1; i < max_input; i++) {
temp *= 10;
temp += in[i] - 48;
}

out <== temp;
}
2 changes: 2 additions & 0 deletions packages/circuits/helpers/rsa.circom
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ template RSAPad(n, k) {
signal input base_message[k];
signal output padded_message[k];

// The extra 152 bits comes from 0x3031300d060960864801650304020105000420
// This is due to padding from the RSASSA-PKCS1-v1_5 standard
var base_len = 408;
var msg_len = 256;

Expand Down

0 comments on commit 689619b

Please sign in to comment.