Keats / jsonwebtoken

JWT lib in rust
MIT License
1.69k stars 271 forks source link

Derive Hash for Header #136

Closed giarc3 closed 4 years ago

giarc3 commented 4 years ago

Hi there, Would it be possible to derive Hash for the Header struct? This would also require Algorithm to implement Hash, but should otherwise be easy. And it wouldn't require any breaking changes.

I'd be willing to open a PR for this if you're interested.

Thanks.

Keats commented 4 years ago

I don't see a reason not to? What's the usecase for hashing the header?

giarc3 commented 4 years ago

Our usecase is pretty convoluted, but it boils down to generating Java bindings from our Rust structs, and we use the Rust implementation of PartialEq and Hash for Java's hashCode() and equals() functions. I admit it's not the most universal usecase, but as you said, I don't think there should be a reason not to.

giarc3 commented 4 years ago

I have opened a PR for this. Please look it over when you have the time, it is a very minor change. I would love if this could go out as 7.1.2 sometime soon. Thanks

Keats commented 4 years ago

It's done