@@ -81,6 +81,20 @@ func SHA512(p []byte) (sum [64]byte) {
8181 return
8282}
8383
84+ func SHA512_224 (p []byte ) (sum [28 ]byte ) {
85+ if ! hashOneShot (crypto .SHA512_224 , p , sum [:]) {
86+ panic ("openssl: SHA512 failed" )
87+ }
88+ return
89+ }
90+
91+ func SHA512_256 (p []byte ) (sum [32 ]byte ) {
92+ if ! hashOneShot (crypto .SHA512_256 , p , sum [:]) {
93+ panic ("openssl: SHA512_256 failed" )
94+ }
95+ return
96+ }
97+
8498// cacheHashSupported is a cache of crypto.Hash support.
8599var cacheHashSupported sync.Map
86100
@@ -171,6 +185,16 @@ func NewSHA512() hash.Hash {
171185 return newEvpHash (crypto .SHA512 )
172186}
173187
188+ // NewSHA512_224 returns a new SHA512_224 hash.
189+ func NewSHA512_224 () hash.Hash {
190+ return newEvpHash (crypto .SHA512_224 )
191+ }
192+
193+ // NewSHA512_256 returns a new SHA512_256 hash.
194+ func NewSHA512_256 () hash.Hash {
195+ return newEvpHash (crypto .SHA512_256 )
196+ }
197+
174198// NewSHA3_224 returns a new SHA3-224 hash.
175199func NewSHA3_224 () hash.Hash {
176200 return newEvpHash (crypto .SHA3_224 )
@@ -383,6 +407,10 @@ func (d *evpHash) AppendBinary(buf []byte) ([]byte, error) {
383407 appender = (* sha512State )(state )
384408 case crypto .SHA512 :
385409 appender = (* sha512State )(state )
410+ case crypto .SHA512_224 :
411+ appender = (* sha512State )(state )
412+ case crypto .SHA512_256 :
413+ appender = (* sha512State )(state )
386414 default :
387415 panic ("openssl: unsupported hash function: " + strconv .Itoa (int (d .alg .ch )))
388416 }
@@ -421,6 +449,10 @@ func (d *evpHash) UnmarshalBinary(b []byte) error {
421449 unmarshaler = (* sha512State )(state )
422450 case crypto .SHA512 :
423451 unmarshaler = (* sha512State )(state )
452+ case crypto .SHA512_224 :
453+ unmarshaler = (* sha512State )(state )
454+ case crypto .SHA512_256 :
455+ unmarshaler = (* sha512State )(state )
424456 default :
425457 panic ("openssl: unsupported hash function: " + strconv .Itoa (int (d .alg .ch )))
426458 }
0 commit comments