Documentation
¶
Index ¶
- Constants
- Variables
- type Hash
- func (h *Hash) Clone() *Hash
- func (m *Hash) CloneMessageVT() any
- func (m *Hash) CloneVT() *Hash
- func (h *Hash) CompareHash(other *Hash) bool
- func (this *Hash) EqualMessageVT(thatMsg any) bool
- func (this *Hash) EqualVT(that *Hash) bool
- func (x *Hash) GetHash() []byte
- func (x *Hash) GetHashType() HashType
- func (h *Hash) IsEmpty() bool
- func (h *Hash) IsNil() bool
- func (h *Hash) MarshalDigest() []byte
- func (x *Hash) MarshalJSON() ([]byte, error)
- func (x *Hash) MarshalProtoJSON(s *json.MarshalState)
- func (h *Hash) MarshalString() string
- func (m *Hash) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Hash) MarshalToVT(dAtA []byte) (int, error)
- func (m *Hash) MarshalVT() (dAtA []byte, err error)
- func (h *Hash) ParseFromB58(ref string) error
- func (*Hash) ProtoMessage()
- func (x *Hash) Reset()
- func (m *Hash) SizeVT() (n int)
- func (x *Hash) UnmarshalJSON(b []byte) error
- func (x *Hash) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Hash) UnmarshalVT(dAtA []byte) error
- func (h *Hash) Validate() error
- func (h *Hash) VerifyData(data []byte) ([]byte, error)
- type HashType
- func (h HashType) BuildHasher() (hash.Hash, error)
- func (x HashType) Enum() *HashType
- func (h HashType) GetHashLen() int
- func (x HashType) MarshalJSON() ([]byte, error)
- func (x HashType) MarshalProtoJSON(s *json.MarshalState)
- func (x HashType) MarshalText() ([]byte, error)
- func (x HashType) String() string
- func (h HashType) Sum(data []byte) ([]byte, error)
- func (x *HashType) UnmarshalJSON(b []byte) error
- func (x *HashType) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *HashType) UnmarshalText(b []byte) error
- func (h HashType) Validate() error
Constants ¶
const RecommendedHashType = HashType_HashType_BLAKE3
RecommendedHashType is the hash type recommended to use. Note: not guaranteed to stay the same between Bifrost versions.
Variables ¶
var ( HashType_name = map[int32]string{ 0: "HashType_UNKNOWN", 1: "HashType_SHA256", 2: "HashType_SHA1", 3: "HashType_BLAKE3", } HashType_value = map[string]int32{ "HashType_UNKNOWN": 0, "HashType_SHA256": 1, "HashType_SHA1": 2, "HashType_BLAKE3": 3, } )
Enum value maps for HashType.
var ErrHashMismatch = errors.New("hash mismatch")
ErrHashMismatch is returned when hashes mismatch.
var ErrHashTypeUnknown = errors.New("unknown hash type")
ErrHashTypeUnknown is returned when the hash type is unknown.
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" json:"hashType,omitempty"` // Hash is the hash value. Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` // contains filtered or unexported fields }
Hash is a hash of a binary blob.
func UnmarshalHashJSON ¶ added in v0.12.2
UnmarshalHashJSON unmarshals a hash from json.
func (*Hash) CloneMessageVT ¶ added in v0.15.6
func (*Hash) CompareHash ¶
CompareHash compares two hashes.
func (*Hash) EqualMessageVT ¶ added in v0.15.6
func (*Hash) GetHashType ¶
func (*Hash) MarshalDigest ¶
MarshalDigest marshals the hash to a binary slice.
func (*Hash) MarshalJSON ¶ added in v0.12.2
MarshalJSON marshals the Hash to JSON.
func (*Hash) MarshalProtoJSON ¶ added in v0.29.0
func (x *Hash) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Hash message to JSON.
func (*Hash) MarshalString ¶
MarshalString marshals the hash to a string.
func (*Hash) MarshalToSizedBufferVT ¶ added in v0.2.0
func (*Hash) ParseFromB58 ¶ added in v0.12.2
ParseFromB58 parses the object ref from a base58 string.
func (*Hash) ProtoMessage ¶
func (*Hash) ProtoMessage()
func (*Hash) UnmarshalJSON ¶ added in v0.12.2
UnmarshalJSON unmarshals the Hash from JSON.
func (*Hash) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *Hash) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Hash message from JSON.
func (*Hash) UnmarshalVT ¶ added in v0.2.0
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: Do not use SHA1 unless you absolutely have to for backwards compat! (Git) 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) MarshalJSON ¶ added in v0.29.0
MarshalJSON marshals the HashType to JSON.
func (HashType) MarshalProtoJSON ¶ added in v0.29.0
func (x HashType) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the HashType to JSON.
func (HashType) MarshalText ¶ added in v0.29.0
MarshalText marshals the HashType to text.
func (*HashType) UnmarshalJSON ¶ added in v0.29.0
UnmarshalJSON unmarshals the HashType from JSON.
func (*HashType) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *HashType) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the HashType from JSON.
func (*HashType) UnmarshalText ¶ added in v0.29.0
UnmarshalText unmarshals the HashType from text.