resumable

package module
v0.0.0-...-22b14a5 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: BSD-3-Clause Imports: 2 Imported by: 213

README

DEPRECATED: This package is now deprecated. Just use the crypto/sha256 package in the standard library. See an example in the tests.

resumable

A Subset of the Go crypto Package with a Resumable Hash Interface

Documentation

GoDocs: http://godoc.org/github.com/stevvooe/resumable

Documentation

Overview

Package resumable registers resumable versions of hash functions. Resumable varieties of hash functions are available via the standard crypto package. Support can be checked by type assertion against the resumable.Hash interface.

While one can use these sub-packages directly, it makes more sense to register them using side-effect imports:

import _ "github.com/stevvooe/resumable/sha256"

This will make the resumable hashes available to the application through the standard crypto package. For example, if a new sha256 is required, one should use the following:

h := crypto.SHA256.New()

Such a features allows one to control the inclusion of resumable hash support in a single file. Applications that require the resumable hash implementation can type switch to detect support, while other parts of the application can be completely oblivious to the presence of the alternative hash functions.

Also note that the implementations available in this package are completely untouched from their Go counterparts in the standard library. Only an extra file is added to each package to implement the extra resumable hash functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadState is returned if Restore fails post-unmarshaling validation.
	ErrBadState = fmt.Errorf("bad hash state")
)

Functions

This section is empty.

Types

type Hash

type Hash interface {
	hash.Hash

	// Len returns the number of bytes written to the Hash so far.
	Len() int64

	// State returns a snapshot of the state of the Hash.
	State() ([]byte, error)

	// Restore resets the Hash to the given state.
	Restore(state []byte) error
}

Hash is the common interface implemented by all resumable hash functions.

Directories

Path Synopsis
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.
Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4.
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.
Package sha512 implements the SHA-384, SHA-512, SHA-512/224, and SHA-512/256 hash algorithms as defined in FIPS 180-4.

Jump to

Keyboard shortcuts

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