sm3

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data []byte) []byte

Hash return hash of data

func New

func New() hash.Hash

New to get a sm3 hash function

func NewWithID

func NewWithID() hash.Hash

NewWithID add ID hash

func SignHashSM3

func SignHashSM3(X, Y []byte, msg []byte) []byte

SignHashSM3 To verify SM2 signatures, digest should be padded by the follow method X, Y: the byte form of points X, Y in an SM2 public key BenchmarkVerify2-4 3000 405031 ns/op

Types

type SM3

type SM3 struct {
	// contains filtered or unexported fields
}

SM3 to hash msg

func (*SM3) BlockSize

func (sm3 *SM3) BlockSize() int

BlockSize required by the hash.Hash interface.BlockSize returns the hash's underlying block size.

func (*SM3) Debug

func (sm3 *SM3) Debug() string

Debug printf state of sm3

func (*SM3) Reset

func (sm3 *SM3) Reset()

Reset clears the internal state by zeroing bytes in the state buffer. This can be skipped for a newly-created hash state; the default zero-allocated state is correct.

func (*SM3) Size

func (sm3 *SM3) Size() int

Size required by the hash.Hash interface. Size returns the number of bytes Sum will return.

func (*SM3) Sum

func (sm3 *SM3) Sum(in []byte) []byte

Sum appends the current hash to in and returns the resulting slice. if cap(in) -len(in) >= 32, otherwise the it will not change ,and you can get hash from return value

func (*SM3) Write

func (sm3 *SM3) Write(p []byte) (int, error)

Write required by the hash.Hash interface. Write (via the embedded io.Writer interface) adds more data to the running hash. It never returns an error.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL