digest

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: MIT Imports: 17 Imported by: 0

README

digest

GoDoc

Documentation

Overview

Package digest implements HTTP Digest support according to RFC 3230 https://tools.ietf.org/html/rfc3230

Index

Constants

View Source
const Header = "Digest"

Header is the HTTP header used

Variables

This section is empty.

Functions

func VerifyHeader

func VerifyHeader(req *http.Request) error

VerifyHeader parses the HTTP Digest header and verifies it against the body of the request

Types

type Algorithm

type Algorithm int

Algorithm represents the type of HTTP Digest to use

const (
	Unknown Algorithm = iota
	ADLER32
	CRC32c
	MD5
	SHA
	SHA256
	SHA512
	UNIXsum
	UNIXcksum
)

These are the available Algorithms. Note that UNIXsum and UNIXcksum are not fully supported.

func ParseAlgorithm

func ParseAlgorithm(val string) Algorithm

ParseAlgorithm parses a string into an Algorithm

func ParseHeader

func ParseHeader(req *http.Request) (Algorithm, []byte, error)

ParseHeader parses the HTTP Digest header and extracts the Algorithm and hash of the request body

func (Algorithm) Hash

func (a Algorithm) Hash(req *http.Request) ([]byte, error)

Hash returns a hash for the body of the request

func (Algorithm) SetHeader

func (a Algorithm) SetHeader(req *http.Request) error

SetHeader sets the HTTP Digest header to the hash of the body of the request

func (Algorithm) String

func (a Algorithm) String() string

func (Algorithm) Verify

func (a Algorithm) Verify(req *http.Request, hash []byte) error

Verify the hash of the body of the request

Jump to

Keyboard shortcuts

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