-
Notifications
You must be signed in to change notification settings - Fork 180
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
Implement serialization / deserialization of Gt #10
Comments
There are You must verify the You'd implement this check in There are some papers about actually compressing this representation and presumably speeding up this check, like https://eprint.iacr.org/2004/032.pdf |
Also to @ebfull. I would love to get this merged and a version of this crate pushed to crates.io. |
@Wassasin Just published |
Meanwhile I have forked this crate into one of my crates as I am no longer able to wait on the release of this feature. I understand your reluctance but I have practical considerations that I need to address within short order. It might be possible to create my MR branch as a separate crate, but the current |
Is there any chance that this issue will be fixed ? |
I am also working on a bilinear Elgamal cipher that uses this crate and would love to hear some good news about the serialization of Gt elements. I don't see why you don't merge the uncompressed variants from the PR above, that would give us at least something to work with. Currently, there is no possibility to persistently store & retrieve Gt elements apart from forking this repo... |
About GT membership testing.
For the second test, the optimized squaring formulas of Granger-Scott ePrint 2009/565, PKC'2010 can be used, or Karabina compressed squarings MathComp 82(281) p.555-579 This appears in ePrint 2021/1029 Sect. 5. More on G1, G2 and GT membership testing in Mike Scott's preprint ePrint 2021/1130 and other nice tricks for BLS curves in Section 3 of ePrint 2021/1359, joint paper with @yelhousni |
Hi! I was wondering if there's any chance of this issue being addresses in the near future? It would have been extremely useful |
If you implement Fp12 serialization, it would be nice to do so on the using the canonical sextic representation, instead of one that depends on the tower chosen: supranational/blst#101 (comment) i.e. |
It looks like the broader effort to standardize the serialization of BLS12-381 stopped short of specifying how Gt would be serialized, at least as far as I can tell, which is not what I was expecting years ago when this issue first propped up. I was hoping multiple people (not me!) could either write a standard or at least come to a well-considered plan. This comment of mine which was thumbed-down by multiple people predicted that there would be a question of what order the coefficients should be in based on the tower, a dispute that did play out in another project and then which @mratsim points out a neat solution to in this thread years later. I didn't want to just hurriedly merge in the first serialization format that anyone could fathom and potentially preclude a superior standard. Anyway, here's a suggestion for how to serialize Gt elements which may or may not conform with other projects. Compressed serializationHere we would use the technique from this paper to compress the Fp12 elements (in Gt) into Fp6 elements. Then, we'd encode the resulting Fp2 coefficients in big endian order (highest degree coefficients first, like Fp2 is serialized). (As an aside, I'm worried that the implementation Supranational folks landed on placed the coefficients in ascending order, which would mean their serialization has a mixture of ascending (Fp12) and descending (Fp2) coefficients, which is goofy.) Uncompressed serializationSince we have to serialize Fp6 elements anyway for the compressed serialization, which forces us in the mindset of a 2 -> 6 -> 12 tower, I see no point in caring much about making the representation canonical after all. We'll just serialize Fp12 elements as the highest degree Fp6 coefficient and then the lowest degree Fp6 coefficient. If anyone has thoughts on this suggestion it would be helpful. I would also prefer to use a serialization that is common in the community rather than thinking up my own like I have here, but if the current state of things is that everyone rolled their own serialization different from each other, then it doesn't matter ultimately. |
There's another potential serialization question that I had considered a few years ago but forgot to mention, and it's another reason why I was hesitant to go ahead with a format myself without more deliberation. In some old standards document I remember reading they prescribe a serialization format for extension fields where an element |
IMHO: pick a serialisation used by another project (preferably a compressed one) and document it thoroughly. It doesn't much matter which one it is; the documentation is more important. |
It was IEEE Std 1363 or one of its extensions, and I thought it was weird at the time. It potentially shaves off a byte in some corner cases but it is absolutely not worth the complexity; let's not do that. |
Compared to just packing the field elements together, the IEEE Std 1363 approach actually doesn't even save a single byte for us whether or not we're talking about Fp6 (saves 1 bit) or Fp12 elements (saves 3 bits but it's not enough to save a byte), so yeah I agree. |
…kcrypto#11) * wip: Remove unnecessary copies in miller loop * finish zkvm version of addition_step (zkcrypto#10) * remove even more copies in Fp::sum_of_products * fix: Remove debug cycle-tracking prints --------- Co-authored-by: Arthur Paulino <arthurleonardo.ap@gmail.com>
For G1Affine and G2Affine we have the
to_uncompressed
andfrom_uncompressed
methods. I would like to serialize Gt as well.I'll start work on a PR.
The text was updated successfully, but these errors were encountered: