sha1

Imports

Imports #

"internal/cpu"
"crypto"
"crypto/internal/boring"
"crypto/internal/fips140only"
"errors"
"hash"
"internal/byteorder"
"math/bits"
"internal/cpu"
"internal/cpu"

Constants & Variables

BlockSize const #

The blocksize of SHA-1 in bytes.

const BlockSize = 64

Size const #

The size of a SHA-1 checksum in bytes.

const Size = 20

_K0 const #

const _K0 = 0x5A827999

_K1 const #

const _K1 = 0x6ED9EBA1

_K2 const #

const _K2 = 0x8F1BBCDC

_K3 const #

const _K3 = 0xCA62C1D6

chunk const #

const chunk = 64

init0 const #

const init0 = 0x67452301

init1 const #

const init1 = 0xEFCDAB89

init2 const #

const init2 = 0x98BADCFE

init3 const #

const init3 = 0x10325476

init4 const #

const init4 = 0xC3D2E1F0

k var #

var k = []uint32{...}

magic const #

const magic = "sha\x01"

marshaledSize const #

const marshaledSize = *ast.BinaryExpr

useAVX2 var #

var useAVX2 = *ast.BinaryExpr

useAsm var #

var useAsm = cpu.S390X.HasSHA1

Structs

digest struct #

digest represents the partial evaluation of a checksum.

type digest struct {
h [5]uint32
x [chunk]byte
nx int
len uint64
}

Functions

AppendBinary method #

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

BlockSize method #

func (d *digest) BlockSize() int

ConstantTimeSum method #

ConstantTimeSum computes the same result of [Sum] but in constant time

func (d *digest) ConstantTimeSum(in []byte) []byte

MarshalBinary method #

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

New function #

New returns a new [hash.Hash] computing the SHA1 checksum. The Hash also implements [encoding.BinaryMarshaler], [encoding.BinaryAppender] and [encoding.BinaryUnmarshaler] to marshal and unmarshal the internal state of the hash.

func New() hash.Hash

Reset method #

func (d *digest) Reset()

Size method #

func (d *digest) Size() int

Sum method #

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

Sum function #

Sum returns the SHA-1 checksum of the data.

func Sum(data []byte) [Size]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)

blockAMD64 function #

go:noescape

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

blockAVX2 function #

go:noescape

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

blockGeneric function #

blockGeneric is a portable, pure Go version of the SHA-1 block step. It's used by sha1block_generic.go and tests.

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

checkSum method #

func (d *digest) checkSum() [Size]byte

constSum method #

func (d *digest) constSum() [Size]byte

consumeUint32 function #

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

consumeUint64 function #

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

init function #

func init()

sha1block function #

go:noescape

func sha1block(h []uint32, p []byte, k []uint32)

Generated with Arrow