Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.

Add constructors for G1Compressed/G2Compressed #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

webmaster128
Copy link

Closes #17
Closes #23

This is an alternative to #23. It is probably a bit more idiomatic and keeps G1Compressed/G2Compressed's data internal.

@webmaster128 webmaster128 force-pushed the G12Compressed-constructors branch from 3ee8e70 to 6fe4bdb Compare February 3, 2021 08:11
@dignifiedquire
Copy link

I think it would be good to instead of using the From trait, have a method called from_bytes_unchecked to clearly signal that there are no validations done, and this could result in invalid state.

@webmaster128
Copy link
Author

Yeah, makes sense. I adapted the PR accordingly.

@@ -193,6 +193,12 @@ impl fmt::Debug for G1Compressed {
}
}

impl G1Compressed {
fn from_bytes_unchecked(original: [u8; 48]) -> Self {

Choose a reason for hiding this comment

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

these need to be declared pub, otherwise nobody can use them.
can you also add a doc string descring what this does please

Copy link
Author

Choose a reason for hiding this comment

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

Done. Hope those docs are helpful. Let me know if something is missing or misleading.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to read G1Affine/G2Affine from compressed bytes
2 participants