File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11use alloc:: vec:: Vec ;
2- use core:: ops:: Deref ;
2+ use core:: {
3+ hash:: { Hash , Hasher } ,
4+ ops:: Deref ,
5+ } ;
36use num_bigint:: traits:: ModInverse ;
47use num_bigint:: Sign :: Plus ;
58use num_bigint:: { BigInt , BigUint } ;
@@ -40,6 +43,7 @@ pub struct RsaPrivateKey {
4043 pub ( crate ) precomputed : Option < PrecomputedValues > ,
4144}
4245
46+ impl Eq for RsaPrivateKey { }
4347impl PartialEq for RsaPrivateKey {
4448 #[ inline]
4549 fn eq ( & self , other : & RsaPrivateKey ) -> bool {
@@ -49,7 +53,13 @@ impl PartialEq for RsaPrivateKey {
4953 }
5054}
5155
52- impl Eq for RsaPrivateKey { }
56+ impl Hash for RsaPrivateKey {
57+ fn hash < H : Hasher > ( & self , state : & mut H ) -> ( ) {
58+ // Domain separator for RSA private keys
59+ state. write ( b"RsaPrivateKey" ) ;
60+ Hash :: hash ( & self . pubkey_components , state) ;
61+ }
62+ }
5363
5464impl Zeroize for RsaPrivateKey {
5565 fn zeroize ( & mut self ) {
You can’t perform that action at this time.
0 commit comments