Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: public key compression #77

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

RajeshRk18
Copy link
Contributor

Fixes #14

@0xmad 0xmad changed the title Refactor publickey compression refactor: public key compression Nov 19, 2023
Copy link
Collaborator

@0xmad 0xmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @RajeshRk18. Just left some comments.

Comment on lines 281 to 287
if (i == 1) {
binary[33*i + j] = Num2Bits(8);
binary[33*i + j].in <== pk_compressed[j];
} else {
binary[33*i + j] = Num2Bits(8);
binary[33*i + j].in <== compressors[i].compressed[j];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting should be fixed here


for (var i = 0; i < 2; i++) {
for (var j = 0; j < k; j++) {
c_sha256.coordinates[i][j] <== g[i][j];
c_sha256.coordinates[2+i][j] <== pk[i][j];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it expected as removed line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pk is passed as input right before in compressed form

@@ -144,7 +151,7 @@ template check_ec_equations(n, k, message_length) {
signal input c[k];
signal input s[k];
signal input plume_message[message_length];
signal input pk[2][k];
signal input pk_compressed[33];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it fixed magic value 33?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compressed point is 33bytes

signal input preimage_bit_length;
signal output out[256];

// compress coordinates
component compressors[6];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change it and why is it magic variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need 5 compressors as pk is already compressed

@0xmad
Copy link
Collaborator

0xmad commented Nov 19, 2023

@RajeshRk18 please rebase with current main branch so PR has only commits related to this issue.

@RajeshRk18 RajeshRk18 force-pushed the refactor-publickey-compression branch from 6bef811 to aa30849 Compare December 9, 2023 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Public key compressed twice
2 participants