-
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
Implemented serialization of Fp2, Fp6, Fp12 and Gt #12
Conversation
Implemented the compressed variant just now; I would love your feedback concerning the array copying. |
This makes Fp6::sqrt twice as fast.
Fp6::sqrt, eliminate an exponentiation
Improves performance of Gt-compressed-lement deserialization by 30%.
Faster Fp6 exponentiation
Hi there, Apologies for the late review, my github notifications are a mess. I'm a little wary of including Gt serialization in this library until it has been standardized to avoid stepping on other people's toes. Do you know of any concurrent work in this area? |
As far as I know using the byte representation of Gt::c1 (y) is the way to go for compressed serialization. I have yet to see another implementation providing this. |
The outstanding question for me is whether people will be happy with an encoding based on the tower. Maybe in a standards process they'll want to encode it using a 12-th degree extension instead? I don't know... |
…t-serialisation
For an even prime power and odd characteristic, there is no way to make a choice of square independent of construction. I've written down a proof here. |
Disappointing. |
Fixes #10, and by proxy #11.
I still have to add a few tests. In expectation of a compressed
Gt
representation the corresponding methods are calledfrom_uncompressed
andto_uncompressed
.Before continuing however I would like to discuss my heavy use of
.copy_from_slice
. As it stands the hierarchical use ofFq2
,Fq6
andFq12
ensures that lots of bytes are copied around. This is due the inability to split fixed length arrays to smaller fixed length arrays in standard Rust. The only way around this copying with Rust is by either coercing at runtime (i.e.TryInto
) or using crates such asarrayref
. This crate implements compile-time coercion of fixed-length arrays usingunsafe
. Given this coercion we hope that LLVM is capable of optimizing the intermediate arrays away. We could also change the function prototype to accept&mut [u8; N]
array-references and write into those.Pending your opinions I prefer to use a crate like
arrayref
.