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

Enable generic-array's more_lengths feature (digest crate) #890

Closed
wtfsck opened this issue Jan 17, 2022 · 3 comments · Fixed by #849
Closed

Enable generic-array's more_lengths feature (digest crate) #890

wtfsck opened this issue Jan 17, 2022 · 3 comments · Fixed by #849

Comments

@wtfsck
Copy link

wtfsck commented Jan 17, 2022

generic-array's feature more_lengths enables more Into<[T; $n]> implementations which are useful when converting the result to an array. Right now it's only possible to do this if the hash size is at most 32 bytes. With this feature it's possible to also do it up to size 64 and some select sizes > 64, see the code below.

https://github.com/fizyk20/generic-array/blob/d4d63b7ea425f42a7e373510f95eb36ed17d34c4/src/impls.rs#L218-L251

generic-array = "0.14.4"

@tarcieri
Copy link
Member

You are free to enable it yourself if you wish. That's how cargo features work.

@newpavlov
Copy link
Member

It may be worth to enable this feature in crypto-common. It could simplify some of our code and improve user ergonomics, while impact on compile time should be negligible (assuming that the linked impls is the only thing enabled by this feature).

@wtfsck
Copy link
Author

wtfsck commented Jan 17, 2022

You are free to enable it yourself if you wish. That's how cargo features work.

I'm not using generic-array directly, only indirectly through the sha2 crate. It depends on digest which does not enable the feature.

Adding generic-array to my own crate so this feature can be enabled in a dependency of a dependency works but is a hack, and it will probably stop working when digest bumps its generic-array dependency version to eg. 0.15 while my crate still uses 0.14 (latest at this time).

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 a pull request may close this issue.

3 participants