sha256

package module
v0.0.0-...-775b97b Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

README

go-sha256-kernel

A library like crypto/sha256 using Linux kernel crypto API.

Benchmark

crpyto/sha256 is faster than this library :)

$ go test --bench . --benchmem 
goos: linux
goarch: amd64
pkg: github.com/nokute78/go-sha256-kernel
cpu: AMD Ryzen 7 PRO 3700U w/ Radeon Vega Mobile Gfx
BenchmarkGoSum256     	  689259	      1692 ns/op	       0 B/op	       0 allocs/op
BenchmarkKernelSum256 	   19651	     58921 ns/op	     656 B/op	      14 allocs/op
PASS
ok  	github.com/nokute78/go-sha256-kernel	2.970s

Reference

License

BSD 3-Clause "New" or "Revised" License

Documentation

Index

Constants

View Source
const BlockSize = 64
View Source
const Size = 32

Variables

This section is empty.

Functions

func New

func New() hash.Hash

func Sum256

func Sum256(data []byte) [Size]byte

func Sum256E

func Sum256E(data []byte) ([]byte, error)

Types

type Sha256Linux

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

func (Sha256Linux) BlockSize

func (s Sha256Linux) BlockSize() int

func (*Sha256Linux) Reset

func (s *Sha256Linux) Reset()

func (Sha256Linux) Size

func (s Sha256Linux) Size() int

func (*Sha256Linux) Sum

func (s *Sha256Linux) Sum(b []byte) []byte

func (*Sha256Linux) Write

func (s *Sha256Linux) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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