package crypto
import "github.com/docker/distribution/Godeps/_workspace/src/github.com/jlhawn/go-crypto"
Package crypto is a Subset of the Go `crypto` Package with a Resumable Hash
Index ¶
- func RegisterHash(h Hash, f func() ResumableHash)
- type Hash
- func (h Hash) Available() bool
- func (h Hash) HashFunc() Hash
- func (h Hash) New() ResumableHash
- func (h Hash) Size() int
- type ResumableHash
Functions ¶
func RegisterHash ¶
func RegisterHash(h Hash, f func() ResumableHash)
RegisterHash registers a function that returns a new instance of the given hash function. This is intended to be called from the init function in packages that implement hash functions.
Types ¶
type Hash ¶
type Hash uint
Hash identifies a cryptographic hash function that is implemented in another package.
const ( SHA224 Hash = 1 + iota // import crypto/sha256 SHA256 // import crypto/sha256 SHA384 // import crypto/sha512 SHA512 // import crypto/sha512 )
func (Hash) Available ¶
Available reports whether the given hash function is linked into the binary.
func (Hash) HashFunc ¶
HashFunc simply returns the value of h so that Hash implements SignerOpts.
func (Hash) New ¶
func (h Hash) New() ResumableHash
New returns a new ResumableHash calculating the given hash function. New panics if the hash function is not linked into the binary.
func (Hash) Size ¶
Size returns the length, in bytes, of a digest resulting from the given hash function. It doesn't require that the hash function in question be linked into the program.
type ResumableHash ¶
type ResumableHash interface { // ResumableHash is a superset of hash.Hash hash.Hash // Len returns the number of bytes written to the Hash so far. Len() uint64 // 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 }
ResumableHash is the common interface implemented by all resumable hash functions.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Godeps/_workspace/src/github.com/jlhawn/go-crypto/sha256 | Package sha256 implements the SHA224 and SHA256 hash algorithms as defined in FIPS 180-4. |
Godeps/_workspace/src/github.com/jlhawn/go-crypto/sha512 | Package sha512 implements the SHA384 and SHA512 hash algorithms as defined in FIPS 180-2. |
- Version
- v2.0.0-rc.3+incompatible
- Published
- Apr 10, 2015
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- 1 hour ago –
Tools for package owners.