-
Notifications
You must be signed in to change notification settings - Fork 12
Tracking issue for supporting all variants at the same time #21
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
Comments
I have started the work on this back in June in https://github.com/dkales/classic-mceliece-rust/tree/feature/correct_rust_feature_use, but this needs to be rebased onto the current v2 changes and it might be better to start from scratch once the API for this is finalized. I would suggest to either have something like Another API could look like use classic_mceliece_rust::parameters::McEliece348864;
use classic_mceliece_rust::{keypair,encapsulate,decapsulate};
let (sk,pk) = keypair::<McEliece348864>(&mut rng); |
If we can solve it with traits and generics I think that looks nicer. Expose a single set of If we expose it as separate functions in different modules the API surface becomes much larger and messier IMO. And probably a lot more boilerplate code in the crate itself. |
Do we even need to feature gate variants? How much more code is added to the library if all are enabled compared to just one? I have not looked at it, but unless shown to be bloaty it feels like unnecessary complexity to feature gate them. |
There is a lot of code duplication but it is probably best to do some concrete experiments later. One problem with the trait + generic approach is that const generics are not at the point yet where one can use associated constants to then define array sizes. i.e., this does not work without unstable features. trait McEliece {
const PUBKEY_BYTES: usize;
fn keypair() -> [u8; Self::PUBKEY_BYTES];
} |
For the record: Two years later, this is still not possible. Hence, no trait-based implementation is possible. One can, of course, implement each variant with the same interface, but the equivalence is not represented in the type system then. Since there seems to be little interest, I am not investing the time to implement this as of now. |
I want to use this crate in the implementation of further systems (I discovered this cryptosystem and thus this crate recently), and do not want to invalidate other crates using Classic McEliece. We could implement this via |
I'd like to be able to configure the variant at runtime in my project. So I need the crate to not compile down to just a single variant.
This has been mentioned in other threads. But I felt like it should have it's own tracking issue. Easier to discover, and easier to keep track of work left until
v2
can be released.I think we should play with how this can be implemented once #16 or #20 has been merged. Those are huge API changes, and we probably want to settle on one of those solutions before tinkering with this.
The text was updated successfully, but these errors were encountered: