shasher

package
v0.0.0-...-68a96c4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2017 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SignatureSize = sha256.Size
)

Variables

This section is empty.

Functions

func Parse

func Parse(r io.ReadSeeker, w io.Writer) (sig [SignatureSize]byte, bytesWritten int64, err error)

Parse is shorthand for ParseWithToken(nil, r, w).

func ParseWithToken

func ParseWithToken(token []byte, r io.ReadSeeker, w io.Writer) (sig [SignatureSize]byte, bytesWritten int64, err error)

ParseWithToken parses the r input and verifies it starts with the token then writes the data to w and verifies the signature. returns the sha256 signature of the whole message, number of actual data bytes (excluding token and signature) or an err.

Types

type HashWriter

type HashWriter struct {
	// contains filtered or unexported fields
}

func New

func New(w io.Writer) *HashWriter

func NewWithToken

func NewWithToken(w io.Writer, token []byte) (*HashWriter, error)

func (*HashWriter) HashOnly

func (hw *HashWriter) HashOnly(p []byte) (int, error)

func (*HashWriter) Sign

func (hw *HashWriter) Sign() (sig [SignatureSize]byte, err error)

func (*HashWriter) Size

func (hw *HashWriter) Size() int64

func (*HashWriter) Write

func (hw *HashWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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