Documentation ¶
Index ¶
- Variables
- type AsyncHash
- type BasicHasher
- type Digest
- type DigestMatcher
- type GitShaDigest
- func (d GitShaDigest) Base64() string
- func (GitShaDigest) BlockSize() int
- func (d GitShaDigest) Bytes() []byte
- func (d GitShaDigest) IsZero() bool
- func (d *GitShaDigest) MarshalBinary() ([]byte, error)
- func (d GitShaDigest) MarshalYAML() (interface{}, error)
- func (d GitShaDigest) Raw() [20]byte
- func (GitShaDigest) Reset()
- func (d GitShaDigest) Size() int
- func (d GitShaDigest) String() string
- func (d GitShaDigest) Sum(in []byte) []byte
- func (d GitShaDigest) Sum64() uint64
- func (d *GitShaDigest) UnmarshalBinary(data []byte) error
- func (d *GitShaDigest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (GitShaDigest) Write([]byte) (int, error)
- type GitShaHasher
- type Highway128Digest
- func (d Highway128Digest) Base64() string
- func (d Highway128Digest) Bytes() []byte
- func (d Highway128Digest) IsZero() bool
- func (d *Highway128Digest) MarshalBinary() ([]byte, error)
- func (d Highway128Digest) MarshalYAML() (interface{}, error)
- func (d Highway128Digest) SRI() string
- func (d Highway128Digest) Size() int
- func (d Highway128Digest) String() string
- func (d Highway128Digest) Sum(in []byte) []byte
- func (Highway128Digest) TypeName() string
- func (d *Highway128Digest) UnmarshalBinary(data []byte) error
- func (d *Highway128Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Highway128Hasher
- type Highway256Digest
- func (d Highway256Digest) Base64() string
- func (Highway256Digest) BlockSize() int
- func (d Highway256Digest) Bytes() []byte
- func (d Highway256Digest) IsZero() bool
- func (d *Highway256Digest) MarshalBinary() ([]byte, error)
- func (d Highway256Digest) MarshalYAML() (interface{}, error)
- func (Highway256Digest) Reset()
- func (d Highway256Digest) SRI() string
- func (d Highway256Digest) Size() int
- func (d Highway256Digest) String() string
- func (d Highway256Digest) Sum(in []byte) []byte
- func (Highway256Digest) TypeName() string
- func (d *Highway256Digest) UnmarshalBinary(data []byte) error
- func (d *Highway256Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (Highway256Digest) Write([]byte) (int, error)
- type Highway256Hasher
- type Highway64Digest
- func (d Highway64Digest) Base64() string
- func (Highway64Digest) BlockSize() int
- func (d Highway64Digest) Bytes() []byte
- func (d Highway64Digest) IsZero() bool
- func (d *Highway64Digest) MarshalBinary() ([]byte, error)
- func (d Highway64Digest) MarshalYAML() (interface{}, error)
- func (Highway64Digest) Reset()
- func (d Highway64Digest) SRI() string
- func (Highway64Digest) Size() int
- func (d Highway64Digest) String() string
- func (d Highway64Digest) Sum(in []byte) []byte
- func (d Highway64Digest) Sum64() uint64
- func (Highway64Digest) TypeName() string
- func (d *Highway64Digest) UnmarshalBinary(data []byte) error
- func (d *Highway64Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (Highway64Digest) Write([]byte) (int, error)
- type Highway64Hasher
- type MD5Digest
- func (d MD5Digest) Base64() string
- func (d MD5Digest) Bytes() []byte
- func (d MD5Digest) IsZero() bool
- func (d *MD5Digest) MarshalBinary() ([]byte, error)
- func (d MD5Digest) MarshalYAML() (interface{}, error)
- func (md5 MD5Digest) SRI() string
- func (d MD5Digest) Size() int
- func (d MD5Digest) String() string
- func (d MD5Digest) Sum(in []byte) []byte
- func (MD5Digest) TypeName() string
- func (d *MD5Digest) UnmarshalBinary(data []byte) error
- func (d *MD5Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- type MD5Hasher
- type SHA1Digest
- func (d SHA1Digest) Base64() string
- func (SHA1Digest) BlockSize() int
- func (d SHA1Digest) Bytes() []byte
- func (d SHA1Digest) IsZero() bool
- func (d *SHA1Digest) MarshalBinary() ([]byte, error)
- func (d SHA1Digest) MarshalYAML() (interface{}, error)
- func (SHA1Digest) Reset()
- func (sha1 SHA1Digest) SRI() string
- func (d SHA1Digest) Size() int
- func (d SHA1Digest) String() string
- func (d SHA1Digest) Sum(in []byte) []byte
- func (SHA1Digest) TypeName() string
- func (d *SHA1Digest) UnmarshalBinary(data []byte) error
- func (d *SHA1Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (SHA1Digest) Write([]byte) (int, error)
- type SHA1Hasher
- type SHA256Digest
- func (d SHA256Digest) Base64() string
- func (SHA256Digest) BlockSize() int
- func (d SHA256Digest) Bytes() []byte
- func (d SHA256Digest) IsZero() bool
- func (d *SHA256Digest) MarshalBinary() ([]byte, error)
- func (d SHA256Digest) MarshalYAML() (interface{}, error)
- func (SHA256Digest) Reset()
- func (sha256 SHA256Digest) SRI() string
- func (d SHA256Digest) Size() int
- func (d SHA256Digest) String() string
- func (d SHA256Digest) Sum(in []byte) []byte
- func (SHA256Digest) TypeName() string
- func (d *SHA256Digest) UnmarshalBinary(data []byte) error
- func (d *SHA256Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (SHA256Digest) Write([]byte) (int, error)
- type SHA256Hasher
- type SHA384Digest
- func (d SHA384Digest) Base64() string
- func (SHA384Digest) BlockSize() int
- func (d SHA384Digest) Bytes() []byte
- func (d SHA384Digest) IsZero() bool
- func (d *SHA384Digest) MarshalBinary() ([]byte, error)
- func (d SHA384Digest) MarshalYAML() (interface{}, error)
- func (SHA384Digest) Reset()
- func (sha384 SHA384Digest) SRI() string
- func (d SHA384Digest) Size() int
- func (d SHA384Digest) String() string
- func (d SHA384Digest) Sum(in []byte) []byte
- func (SHA384Digest) TypeName() string
- func (d *SHA384Digest) UnmarshalBinary(data []byte) error
- func (d *SHA384Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (SHA384Digest) Write([]byte) (int, error)
- type SHA384Hasher
- type SHA512Digest
- func (d SHA512Digest) Base64() string
- func (SHA512Digest) BlockSize() int
- func (d SHA512Digest) Bytes() []byte
- func (d SHA512Digest) IsZero() bool
- func (d *SHA512Digest) MarshalBinary() ([]byte, error)
- func (d SHA512Digest) MarshalYAML() (interface{}, error)
- func (SHA512Digest) Reset()
- func (sha SHA512Digest) SRI() string
- func (d SHA512Digest) Size() int
- func (d SHA512Digest) String() string
- func (d SHA512Digest) Sum(in []byte) []byte
- func (SHA512Digest) TypeName() string
- func (d *SHA512Digest) UnmarshalBinary(data []byte) error
- func (d *SHA512Digest) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (SHA512Digest) Write([]byte) (int, error)
- type SHA512Hasher
Constants ¶
This section is empty.
Variables ¶
var BinprintHighwayKey = []byte{0xed, 0x73, 0xad, 0xab, 0x57, 0xd, 0x4f, 0x16, 0xc8, 0xd0, 0xa8, 0xac, 0x81, 0x47, 0x4a, 0xe3, 0xd5, 0xf8, 0x7f, 0x8, 0x7d, 0xfd, 0xcb, 0x91, 0x90, 0x94, 0x3a, 0x66, 0xfd, 0xf0, 0x40, 0xd6}
BinprintHighwayKey is the hashing key used by all binprint hashes calculated with the Highway Hash algorithm
Functions ¶
This section is empty.
Types ¶
type AsyncHash ¶
AsyncHash is a wrapper for hash.Hash that operates asynchronously by using a buffering pipe to accept input and a channel to provide the final digest
type BasicHasher ¶
BasicHasher is a hash.AsyncHasher that calculates a sha1sum using the same salting mechanism as git does when storing blob objects
func (BasicHasher) Close ¶
func (sh BasicHasher) Close() error
Close closes the underlying pipe and finalizes the hash
func (BasicHasher) Digest ¶
func (sh BasicHasher) Digest() Digest
Digest returns the calculated Digest. This consumes the channel returned by Done(), but will always return the same Digest afterwards.
func (BasicHasher) Done ¶
func (sh BasicHasher) Done() <-chan Digest
Done returns a Digest channel, satisfying the AsyncHasher interface
type Digest ¶
type Digest interface { // A Digest is a hash.Hash that has already been finalized and is // essentially a wrapper around the fixed length checksum result // hash.Hash Sum(b []byte) []byte // Reset() Size() int // IsZero returns true for Digests that are the zero-value of their type // (aka, all 0s) IsZero() bool // String returns the hex string representing the checksum String() string // Base64 returns the checksum as a base64 string Base64() string // Bytes returns the finalized checksum bytes, similar to Sum(), but // simplified for hashes that have already been finalized Bytes() []byte }
Digest is a finalized hash.Hash. It conforms to the hash.Hash interface, but it does not support operations that modify the finalized checksum
type DigestMatcher ¶
DigestMatcher is a multi-hash comparison operand allowing Digest objects to be matched against.
func NewDigestMatcher ¶
func NewDigestMatcher(pat string) (DigestMatcher, error)
NewDigestMatcher creates a new DigestMatcher by parsing the provided string
func (DigestMatcher) Match ¶
func (matcher DigestMatcher) Match(hash Digest) bool
Match compares the DigestMatcher against a given Digest, either by string representation or direct byte comparison if the provided string was an even number of hex digits.
type GitShaDigest ¶
type GitShaDigest struct {
// contains filtered or unexported fields
}
GitShaDigest is the variant of sha1 used by Git to identify blobs
func GitShaDigestFromRaw ¶
func GitShaDigestFromRaw(raw [20]byte) GitShaDigest
func NewGitShaDigest ¶
func NewGitShaDigest(h hash.Hash) *GitShaDigest
func (*GitShaDigest) MarshalBinary ¶
func (GitShaDigest) MarshalYAML ¶
func (d GitShaDigest) MarshalYAML() (interface{}, error)
func (d digest160) Len() int { return len(d) }
func (GitShaDigest) Raw ¶
func (d GitShaDigest) Raw() [20]byte
func (GitShaDigest) Sum64 ¶
func (d GitShaDigest) Sum64() uint64
func (*GitShaDigest) UnmarshalBinary ¶
func (*GitShaDigest) UnmarshalYAML ¶
type GitShaHasher ¶
type GitShaHasher struct { BasicHasher // contains filtered or unexported fields }
GitShaHasher is a hash.AsyncHasher that calculates a sha1sum using the same salting mechanism as git does when storing blob objects
func NewGitShaHasher ¶
func NewGitShaHasher(oType string, size int64) *GitShaHasher
NewGitShaHasher returns a hash.Hash that will compute a variant sha1 digest as though the input was a git blob object
func (*GitShaHasher) Close ¶
func (gh *GitShaHasher) Close() error
func (*GitShaHasher) Done ¶
func (gh *GitShaHasher) Done() <-chan Digest
type Highway128Digest ¶
type Highway128Digest struct {
// contains filtered or unexported fields
}
func NewHighway128Digest ¶
func NewHighway128Digest(h hash.Hash) Highway128Digest
func (*Highway128Digest) MarshalBinary ¶
func (Highway128Digest) MarshalYAML ¶
func (d Highway128Digest) MarshalYAML() (interface{}, error)
func (d digest128) Len() int { return len(d) }
func (Highway128Digest) SRI ¶
func (d Highway128Digest) SRI() string
func (Highway128Digest) Size ¶
func (d Highway128Digest) Size() int
func (digest128) BlockSize() int { defer panic("Unimplemented"); return 0 }
func (Highway128Digest) TypeName ¶
func (Highway128Digest) TypeName() string
func (*Highway128Digest) UnmarshalBinary ¶
func (*Highway128Digest) UnmarshalYAML ¶
type Highway128Hasher ¶
type Highway128Hasher struct {
BasicHasher
}
func NewHighway128Hasher ¶
func NewHighway128Hasher() Highway128Hasher
type Highway256Digest ¶
type Highway256Digest struct {
// contains filtered or unexported fields
}
func NewHighway256Digest ¶
func NewHighway256Digest(h hash.Hash) Highway256Digest
func (*Highway256Digest) MarshalBinary ¶
func (Highway256Digest) MarshalYAML ¶
func (d Highway256Digest) MarshalYAML() (interface{}, error)
func (d digest256) Len() int { return len(d) }
func (Highway256Digest) SRI ¶
func (d Highway256Digest) SRI() string
func (Highway256Digest) TypeName ¶
func (Highway256Digest) TypeName() string
func (*Highway256Digest) UnmarshalBinary ¶
func (*Highway256Digest) UnmarshalYAML ¶
type Highway256Hasher ¶
type Highway256Hasher struct {
BasicHasher
}
func NewHighway256Hasher ¶
func NewHighway256Hasher() Highway256Hasher
type Highway64Digest ¶
type Highway64Digest struct {
// contains filtered or unexported fields
}
func NewHighway64Digest ¶
func NewHighway64Digest(h hash.Hash) Highway64Digest
func (*Highway64Digest) MarshalBinary ¶
func (Highway64Digest) MarshalYAML ¶
func (d Highway64Digest) MarshalYAML() (interface{}, error)
func (d digest64) Len() int { return len(d) }
func (Highway64Digest) SRI ¶
func (d Highway64Digest) SRI() string
func (Highway64Digest) Sum64 ¶
func (d Highway64Digest) Sum64() uint64
Sum64 satisfies the hash.Hash64 interface
func (Highway64Digest) TypeName ¶
func (Highway64Digest) TypeName() string
func (*Highway64Digest) UnmarshalBinary ¶
func (*Highway64Digest) UnmarshalYAML ¶
type Highway64Hasher ¶
type Highway64Hasher struct {
BasicHasher
}
Highway64Hasher implements HighwayHash64 using the AsyncHasher interface, which is a superset of the hash.Hash interface
func NewHighway64Hasher ¶
func NewHighway64Hasher() Highway64Hasher
func (Highway64Hasher) Sum64 ¶
func (h Highway64Hasher) Sum64() uint64
type MD5Digest ¶
type MD5Digest struct {
// contains filtered or unexported fields
}
func NewMD5Digest ¶
func (*MD5Digest) MarshalBinary ¶
func (MD5Digest) MarshalYAML ¶
func (d MD5Digest) MarshalYAML() (interface{}, error)
func (d digest128) Len() int { return len(d) }
func (MD5Digest) Size ¶
func (d MD5Digest) Size() int
func (digest128) BlockSize() int { defer panic("Unimplemented"); return 0 }
func (*MD5Digest) UnmarshalBinary ¶
func (*MD5Digest) UnmarshalYAML ¶
type MD5Hasher ¶
type MD5Hasher struct {
BasicHasher
}
func NewMD5Hasher ¶
func NewMD5Hasher() MD5Hasher
NewMD5Hasher creates a new async hasher for generating md5sums
type SHA1Digest ¶
type SHA1Digest struct {
// contains filtered or unexported fields
}
func NewSHA1Digest ¶
func NewSHA1Digest(h hash.Hash) SHA1Digest
func (*SHA1Digest) MarshalBinary ¶
func (SHA1Digest) MarshalYAML ¶
func (d SHA1Digest) MarshalYAML() (interface{}, error)
func (d digest160) Len() int { return len(d) }
func (SHA1Digest) SRI ¶
func (sha1 SHA1Digest) SRI() string
func (SHA1Digest) TypeName ¶
func (SHA1Digest) TypeName() string
func (*SHA1Digest) UnmarshalBinary ¶
func (*SHA1Digest) UnmarshalYAML ¶
type SHA1Hasher ¶
type SHA1Hasher struct {
BasicHasher
}
func NewSHA1Hasher ¶
func NewSHA1Hasher() SHA1Hasher
NewSHA1Hasher creates a new async hasher for generating sha1sums
type SHA256Digest ¶
type SHA256Digest struct {
// contains filtered or unexported fields
}
func NewSHA256Digest ¶
func NewSHA256Digest(h hash.Hash) SHA256Digest
func (*SHA256Digest) MarshalBinary ¶
func (SHA256Digest) MarshalYAML ¶
func (d SHA256Digest) MarshalYAML() (interface{}, error)
func (d digest256) Len() int { return len(d) }
func (SHA256Digest) SRI ¶
func (sha256 SHA256Digest) SRI() string
func (SHA256Digest) TypeName ¶
func (SHA256Digest) TypeName() string
func (*SHA256Digest) UnmarshalBinary ¶
func (*SHA256Digest) UnmarshalYAML ¶
type SHA256Hasher ¶
type SHA256Hasher struct {
BasicHasher
}
func NewSHA256Hasher ¶
func NewSHA256Hasher() SHA256Hasher
NewSHA256Hasher creates a new async hasher for generating sha256sums
type SHA384Digest ¶
type SHA384Digest struct {
// contains filtered or unexported fields
}
func NewSHA384Digest ¶
func NewSHA384Digest(h hash.Hash) SHA384Digest
func (*SHA384Digest) MarshalBinary ¶
func (SHA384Digest) MarshalYAML ¶
func (d SHA384Digest) MarshalYAML() (interface{}, error)
func (d digest384) Len() int { return len(d) }
func (SHA384Digest) SRI ¶
func (sha384 SHA384Digest) SRI() string
func (SHA384Digest) TypeName ¶
func (SHA384Digest) TypeName() string
func (*SHA384Digest) UnmarshalBinary ¶
func (*SHA384Digest) UnmarshalYAML ¶
type SHA384Hasher ¶
type SHA384Hasher struct {
BasicHasher
}
func NewSHA384Hasher ¶
func NewSHA384Hasher() SHA384Hasher
NewSHA384Hasher creates a new async hasher for generating sha384sums
type SHA512Digest ¶
type SHA512Digest struct {
// contains filtered or unexported fields
}
SHA512Digest is a finalized SHA512 checksum
func NewSHA512Digest ¶
func NewSHA512Digest(h hash.Hash) SHA512Digest
func (*SHA512Digest) MarshalBinary ¶
func (SHA512Digest) MarshalYAML ¶
func (d SHA512Digest) MarshalYAML() (interface{}, error)
func (d digest512) Len() int { return len(d) }
func (SHA512Digest) SRI ¶
func (sha SHA512Digest) SRI() string
func (SHA512Digest) TypeName ¶
func (SHA512Digest) TypeName() string
TypeName returns the canonical short name of the digest type
func (*SHA512Digest) UnmarshalBinary ¶
func (*SHA512Digest) UnmarshalYAML ¶
type SHA512Hasher ¶
type SHA512Hasher struct {
BasicHasher
}
func NewSHA512Hasher ¶
func NewSHA512Hasher() SHA512Hasher
NewSHA512Hasher creates a new async hasher for generating sha512sums