Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions cng/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package cng
import (
"bytes"
"crypto"
"errors"
"hash"
"runtime"
"unsafe"
Expand Down Expand Up @@ -250,6 +251,18 @@ func (h *hashX) BlockSize() int {
return int(h.alg.blockSize)
}

func (hx *hashX) MarshalBinary() ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (hx *hashX) AppendBinary(b []byte) ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (hx *hashX) UnmarshalBinary(data []byte) error {
return errors.New("cng: hash state is not marshallable")
}

// hashData writes p to ctx. It panics on error.
func hashData(ctx bcrypt.HASH_HANDLE, p []byte) {
var n int
Expand Down
25 changes: 25 additions & 0 deletions cng/sha3.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package cng

import (
"errors"
"hash"
"runtime"
"unsafe"
Expand Down Expand Up @@ -164,6 +165,18 @@ func (h *DigestSHA3) BlockSize() int {
return int(h.alg.blockSize)
}

func (ds *DigestSHA3) MarshalBinary() ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (ds *DigestSHA3) AppendBinary(b []byte) ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (ds *DigestSHA3) UnmarshalBinary(data []byte) error {
return errors.New("cng: hash state is not marshallable")
}

// NewSHA3_256 returns a new SHA256 hash.
func NewSHA3_256() *DigestSHA3 {
return newDigestSHA3(bcrypt.SHA3_256_ALGORITHM)
Expand Down Expand Up @@ -284,3 +297,15 @@ func (s *SHAKE) Reset() {
func (s *SHAKE) BlockSize() int {
return int(s.blockSize)
}

func (s *SHAKE) MarshalBinary() ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (s *SHAKE) AppendBinary(b []byte) ([]byte, error) {
return nil, errors.New("cng: hash state is not marshallable")
}

func (s *SHAKE) UnmarshalBinary(data []byte) error {
return errors.New("cng: hash state is not marshallable")
}