File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed
Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88## 0.5.0 (UNRELEASED)
99### Added
1010- ` alloc ` crate feature ([ #678 ] )
11+ - ` oid ` crate feature and ` AssociatedOid ` trait implementation ([ #706 ] )
1112
1213### Changed
1314- Edition changed to 2024 and MSRV bumped to 1.85 ([ #652 ] )
@@ -20,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2021
2122[ #652 ] : https://github.com/RustCrypto/hashes/pull/652
2223[ #678 ] : https://github.com/RustCrypto/hashes/pull/678
24+ [ #706 ] : https://github.com/RustCrypto/hashes/pull/706
2325
2426## 0.4.2 (2023-05-16)
2527### Changed
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ hex-literal = "1"
2121base16ct = { version = " 0.2" , features = [" alloc" ] }
2222
2323[features ]
24- default = [" alloc" ]
24+ default = [" alloc" , " oid " ]
2525alloc = [" digest/alloc" ]
26+ oid = [" digest/oid" ] # Enable OID support
2627zeroize = [" digest/zeroize" ]
2728
2829[package .metadata .docs .rs ]
Original file line number Diff line number Diff line change @@ -20,5 +20,8 @@ pub use block_api::Sm3Core;
2020digest:: buffer_fixed!(
2121 /// ShangMi 3 (SM3) hasher.
2222 pub struct Sm3 ( block_api:: Sm3Core ) ;
23+ // Note that we use the GM/T OID here.
24+ // SM3 has also an alternative ISO OID assigned to it.
25+ oid: "1.2.156.10197.1.401" ;
2326 impl : FixedHashTraits ;
2427) ;
Original file line number Diff line number Diff line change @@ -29,3 +29,13 @@ fn sm3_rand() {
2929 hex!( "ad154967b08d636a148dd4c688a6df7add1ed1946af18eb358a9b320de2aca86" ) ,
3030 ) ;
3131}
32+
33+ #[ cfg( feature = "oid" ) ]
34+ #[ test]
35+ fn sm3_oid ( ) {
36+ use sm3:: digest:: const_oid:: { AssociatedOid , ObjectIdentifier } ;
37+ assert_eq ! (
38+ Sm3 :: OID ,
39+ ObjectIdentifier :: new_unwrap( "1.2.156.10197.1.401" )
40+ ) ;
41+ }
You can’t perform that action at this time.
0 commit comments