sha256

Imports

Imports #

"crypto/internal/fips140deps/cpu"
"crypto/internal/impl"
"bytes"
"crypto/internal/fips140"
"errors"
"crypto/internal/fips140"
"crypto/internal/fips140deps/byteorder"
"errors"
"math/bits"
"crypto/internal/fips140deps/cpu"
"crypto/internal/impl"
"crypto/internal/fips140deps/godebug"
"crypto/internal/impl"
"crypto/internal/fips140deps/cpu"
"crypto/internal/impl"

Constants & Variables

_K var #

var _K = [...]uint32{...}

blockSize const #

The block size of SHA-256 and SHA-224 in bytes.

const blockSize = 64

chunk const #

const chunk = 64

init0 const #

const init0 = 0x6A09E667

init0_224 const #

const init0_224 = 0xC1059ED8

init1 const #

const init1 = 0xBB67AE85

init1_224 const #

const init1_224 = 0x367CD507

init2 const #

const init2 = 0x3C6EF372

init2_224 const #

const init2_224 = 0x3070DD17

init3 const #

const init3 = 0xA54FF53A

init3_224 const #

const init3_224 = 0xF70E5939

init4 const #

const init4 = 0x510E527F

init4_224 const #

const init4_224 = 0xFFC00B31

init5 const #

const init5 = 0x9B05688C

init5_224 const #

const init5_224 = 0x68581511

init6 const #

const init6 = 0x1F83D9AB

init6_224 const #

const init6_224 = 0x64F98FA7

init7 const #

const init7 = 0x5BE0CD19

init7_224 const #

const init7_224 = 0xBEFA4FA4

magic224 const #

const magic224 = "sha\x02"

magic256 const #

const magic256 = "sha\x03"

marshaledSize const #

const marshaledSize = *ast.BinaryExpr

ppc64sha2 var #

The POWER architecture doesn't have a way to turn off SHA-2 support at runtime with GODEBUG=cpu.something=off, so introduce a new GODEBUG knob for that. It's intentionally only checked at init() time, to avoid the performance overhead of checking it on every block.

var ppc64sha2 = *ast.BinaryExpr

size const #

The size of a SHA-256 checksum in bytes.

const size = 32

size224 const #

The size of a SHA-224 checksum in bytes.

const size224 = 28

useAVX2 var #

var useAVX2 = *ast.BinaryExpr

useSHA2 var #

var useSHA2 = cpu.ARM64HasSHA2

useSHA256 var #

var useSHA256 = cpu.S390XHasSHA256

useSHANI var #

var useSHANI = *ast.BinaryExpr

Structs

Digest struct #

Digest is a SHA-224 or SHA-256 [hash.Hash] implementation.

type Digest struct {
h [8]uint32
x [chunk]byte
nx int
len uint64
is224 bool
}

Functions

AppendBinary method #

func (d *Digest) AppendBinary(b []byte) ([]byte, error)

BlockSize method #

func (d *Digest) BlockSize() int

MarshalBinary method #

func (d *Digest) MarshalBinary() ([]byte, error)

New function #

New returns a new Digest computing the SHA-256 hash.

func New() *Digest

New224 function #

New224 returns a new Digest computing the SHA-224 hash.

func New224() *Digest

Reset method #

func (d *Digest) Reset()

Size method #

func (d *Digest) Size() int

Sum method #

func (d *Digest) Sum(in []byte) []byte

UnmarshalBinary method #

func (d *Digest) UnmarshalBinary(b []byte) error

Write method #

func (d *Digest) Write(p []byte) (nn int, err error)

block function #

func block(dig *Digest, p []byte)

block function #

func block(dig *Digest, p []byte)

block function #

go:noescape

func block(dig *Digest, p []byte)

block function #

func block(dig *Digest, p []byte)

block function #

func block(dig *Digest, p []byte)

block function #

func block(dig *Digest, p []byte)

blockAMD64 function #

go:noescape

func blockAMD64(dig *Digest, p []byte)

blockAVX2 function #

go:noescape

func blockAVX2(dig *Digest, p []byte)

blockGeneric function #

func blockGeneric(dig *Digest, p []byte)

blockPOWER function #

go:noescape

func blockPOWER(dig *Digest, p []byte)

blockS390X function #

go:noescape

func blockS390X(dig *Digest, p []byte)

blockSHA2 function #

go:noescape

func blockSHA2(dig *Digest, p []byte)

blockSHANI function #

go:noescape

func blockSHANI(dig *Digest, p []byte)

checkSum method #

func (d *Digest) checkSum() [size]byte

consumeUint32 function #

func consumeUint32(b []byte) ([]byte, uint32)

consumeUint64 function #

func consumeUint64(b []byte) ([]byte, uint64)

init function #

func init()

init function #

func init()

init function #

func init()

init function #

func init()

init function #

func init()

Generated with Arrow