sha1

package
v0.0.0-...-4c66e5e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package sha1 implements a non-standard compliant SHA-1 hash algorithm, as used by Diablo 1.

Index

Constants

View Source
const (
	// The blocksize of SHA-1 in bytes.
	BlockSize = 64
	// The size of a SHA-1 checksum in bytes.
	Size = 20
)

Variables

View Source
var (
	// ref: 0x69EFB0
	Contexts = (*[3]Context)(unsafe.Pointer(uintptr(0x69EFB0)))
)

Global variables.

Functions

func Sum

func Sum(data []byte) []byte

Sum returns the SHA-1 checksum of the data.

Types

type Context

type Context struct {
	State  [5]uint32
	Count  [2]int32
	Buffer [BlockSize]uint8
}

Context holds the context of a SHA-1 running hashsum. Context implements the hash.Hash interface.

func New

func New() *Context

New returns a new initialized SHA-1 context.

func (*Context) BlockSize

func (ctx *Context) BlockSize() int

BlockSize returns the blocksize of SHA-1 in bytes.

func (*Context) Final

func (ctx *Context) Final(digest []byte)

Final copies the message digest of the given SHA-1 context to dst.

ref: 0x456A2B

func (*Context) Init

func (ctx *Context) Init()

Init initializes the given SHA-1 context.

ref: 0x456C82

func (*Context) Reset

func (ctx *Context) Reset()

Reset resets the Hash to its initial state.

func (*Context) Size

func (ctx *Context) Size() int

Size returns the size of a SHA-1 checksum in bytes.

func (*Context) Sum

func (ctx *Context) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.

func (*Context) Transform

func (ctx *Context) Transform()

Transform performs a SHA-1 transformation on the 64-byte block of the given SHA-1 context.

ref: 0x456AC4

func (*Context) Update

func (ctx *Context) Update(data []byte)

Update adds the data to the running hash of the given SHA-1 context.

ref: 0x456A73

func (*Context) Write

func (ctx *Context) Write(data []byte) (n int, err error)

Write writes data to the running SHA-1 hashsum. It never returns an error.

Jump to

Keyboard shortcuts

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