Documentation ¶
Index ¶
- Constants
- Variables
- type Hash
- func (h *Hash) Clone() *Hash
- func (h *Hash) CompareHash(other *Hash) bool
- func (*Hash) Descriptor() ([]byte, []int)
- func (m *Hash) GetHash() []byte
- func (m *Hash) GetHashType() HashType
- func (h *Hash) IsEmpty() bool
- func (h *Hash) MarshalDigest() []byte
- func (h *Hash) MarshalString() string
- func (*Hash) ProtoMessage()
- func (m *Hash) Reset()
- func (m *Hash) String() string
- func (h *Hash) Validate() error
- func (h *Hash) VerifyData(data []byte) ([]byte, error)
- func (m *Hash) XXX_DiscardUnknown()
- func (m *Hash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Hash) XXX_Merge(src proto.Message)
- func (m *Hash) XXX_Size() int
- func (m *Hash) XXX_Unmarshal(b []byte) error
- type HashType
Constants ¶
View Source
const RecommendedHashType = HashType_HashType_BLAKE3
RecommendedHashType is the hash type recommended to use. Note: not guaranteed to stay the same between Bifrost versions.
Variables ¶
View Source
var ErrHashMismatch = errors.New("hash mismatch")
ErrHashMismatch is returned when hashes mismatch.
View Source
var HashType_name = map[int32]string{
0: "HashType_UNKNOWN",
1: "HashType_SHA256",
2: "HashType_SHA1",
3: "HashType_BLAKE3",
}
View Source
var HashType_value = map[string]int32{
"HashType_UNKNOWN": 0,
"HashType_SHA256": 1,
"HashType_SHA1": 2,
"HashType_BLAKE3": 3,
}
View Source
var SupportedHashTypes = []HashType{ HashType_HashType_SHA256, HashType_HashType_SHA1, HashType_HashType_BLAKE3, }
SupportedHashTypes is the list of built-in hash types.
Functions ¶
This section is empty.
Types ¶
type Hash ¶
type Hash struct { // HashType is the hash type in use. HashType HashType `protobuf:"varint,1,opt,name=hash_type,json=hashType,proto3,enum=hash.HashType" json:"hash_type,omitempty"` // Hash is the hash value. Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Hash is a hash of a binary blob.
func (*Hash) CompareHash ¶
CompareHash compares two hashes.
func (*Hash) Descriptor ¶
func (*Hash) GetHashType ¶
func (*Hash) MarshalDigest ¶
MarshalDigest marshals the hash to a binary slice.
func (*Hash) MarshalString ¶
MarshalString marshals the hash to a string.
func (*Hash) ProtoMessage ¶
func (*Hash) ProtoMessage()
func (*Hash) VerifyData ¶
VerifyData verifies data against the sum. Returns the hash of the data, hash type, and error Returns an error if failed to validate.
func (*Hash) XXX_DiscardUnknown ¶
func (m *Hash) XXX_DiscardUnknown()
func (*Hash) XXX_Unmarshal ¶
type HashType ¶
type HashType int32
HashType identifies the hash type in use.
const ( // HashType_UNKNOWN is an unknown hash type. HashType_HashType_UNKNOWN HashType = 0 // HashType_SHA256 is the sha256 hash type. HashType_HashType_SHA256 HashType = 1 // HashType_SHA1 is the sha1 hash type. // Note: this is not recommended for use outside of backwards-compat. HashType_HashType_SHA1 HashType = 2 // HashType_BLAKE3 is the blake3 hash type. // Uses a 32-byte digest size. HashType_HashType_BLAKE3 HashType = 3 )
func (HashType) BuildHasher ¶
BuildHasher builds the hasher for the hash type.
func (HashType) EnumDescriptor ¶
Click to show internal directories.
Click to hide internal directories.