digest

package
v0.0.0-...-f003305 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package digest implements an instance which serializes to / from the Digest header per rfc3230 https://tools.ietf.org/html/rfc3230

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	crypto.Hash
	Digest string
}

Instance consists of the hash type and an internal digest value

func (*Instance) Calculate

func (d *Instance) Calculate(b []byte) string

Calculate but do not update the internal digest value for b. Subsequent calls to MarshalText, String, etc will not use the returned value.

func (*Instance) MarshalText

func (d *Instance) MarshalText() (text []byte, err error)

MarshalText returns the marshalled digest in HTTP Digest header format

func (*Instance) String

func (d *Instance) String() string

Return a string representation digest in HTTP Digest header format

func (*Instance) UnmarshalText

func (d *Instance) UnmarshalText(text []byte) (err error)

UnmarshalText parses the digest from HTTP Digest header format

func (*Instance) Update

func (d *Instance) Update(b []byte)

Update (after calculating) the internal digest value for b. Subsequent calls to MarshalText, String, etc will use the updated value.

func (*Instance) Verify

func (d *Instance) Verify(b []byte) bool

Verify by calculating the digest value for b and checking against the internal digest value. Returns true if the digest values match.

Jump to

Keyboard shortcuts

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