File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ package cng
99import (
1010 "bytes"
1111 "crypto"
12+ "errors"
1213 "hash"
1314 "runtime"
1415 "unsafe"
@@ -250,6 +251,18 @@ func (h *hashX) BlockSize() int {
250251 return int (h .alg .blockSize )
251252}
252253
254+ func (hx * hashX ) MarshalBinary () ([]byte , error ) {
255+ return nil , errors .New ("cng: hash state is not marshallable" )
256+ }
257+
258+ func (hx * hashX ) AppendBinary (b []byte ) ([]byte , error ) {
259+ return nil , errors .New ("cng: hash state is not marshallable" )
260+ }
261+
262+ func (hx * hashX ) UnmarshalBinary (data []byte ) error {
263+ return errors .New ("cng: hash state is not marshallable" )
264+ }
265+
253266// hashData writes p to ctx. It panics on error.
254267func hashData (ctx bcrypt.HASH_HANDLE , p []byte ) {
255268 var n int
Original file line number Diff line number Diff line change 77package cng
88
99import (
10+ "errors"
1011 "hash"
1112 "runtime"
1213 "unsafe"
@@ -164,6 +165,18 @@ func (h *DigestSHA3) BlockSize() int {
164165 return int (h .alg .blockSize )
165166}
166167
168+ func (ds * DigestSHA3 ) MarshalBinary () ([]byte , error ) {
169+ return nil , errors .New ("cng: hash state is not marshallable" )
170+ }
171+
172+ func (ds * DigestSHA3 ) AppendBinary (b []byte ) ([]byte , error ) {
173+ return nil , errors .New ("cng: hash state is not marshallable" )
174+ }
175+
176+ func (ds * DigestSHA3 ) UnmarshalBinary (data []byte ) error {
177+ return errors .New ("cng: hash state is not marshallable" )
178+ }
179+
167180// NewSHA3_256 returns a new SHA256 hash.
168181func NewSHA3_256 () * DigestSHA3 {
169182 return newDigestSHA3 (bcrypt .SHA3_256_ALGORITHM )
@@ -284,3 +297,15 @@ func (s *SHAKE) Reset() {
284297func (s * SHAKE ) BlockSize () int {
285298 return int (s .blockSize )
286299}
300+
301+ func (s * SHAKE ) MarshalBinary () ([]byte , error ) {
302+ return nil , errors .New ("cng: hash state is not marshallable" )
303+ }
304+
305+ func (s * SHAKE ) AppendBinary (b []byte ) ([]byte , error ) {
306+ return nil , errors .New ("cng: hash state is not marshallable" )
307+ }
308+
309+ func (s * SHAKE ) UnmarshalBinary (data []byte ) error {
310+ return errors .New ("cng: hash state is not marshallable" )
311+ }
You can’t perform that action at this time.
0 commit comments