Documentation ¶
Index ¶
- Variables
- type HashConfig
- func (*HashConfig) Descriptor() ([]byte, []int)deprecated
- func (x *HashConfig) GetHashFunction() HashFunction
- func (x *HashConfig) GetHashOutputLengthBytes() uint32
- func (*HashConfig) ProtoMessage()
- func (x *HashConfig) ProtoReflect() protoreflect.Message
- func (x *HashConfig) Reset()
- func (x *HashConfig) String() string
- type HashFunction
- func (HashFunction) Descriptor() protoreflect.EnumDescriptor
- func (x HashFunction) Enum() *HashFunction
- func (HashFunction) EnumDescriptor() ([]byte, []int)deprecated
- func (x HashFunction) Number() protoreflect.EnumNumber
- func (x HashFunction) String() string
- func (HashFunction) Type() protoreflect.EnumType
- type HashFunctionOutputLength
- func (HashFunctionOutputLength) Descriptor() protoreflect.EnumDescriptor
- func (x HashFunctionOutputLength) Enum() *HashFunctionOutputLength
- func (HashFunctionOutputLength) EnumDescriptor() ([]byte, []int)deprecated
- func (x HashFunctionOutputLength) Number() protoreflect.EnumNumber
- func (x HashFunctionOutputLength) String() string
- func (HashFunctionOutputLength) Type() protoreflect.EnumType
- type Op
- type OpCode
- type Program
- type ProgramMetadata
- func (*ProgramMetadata) Descriptor() ([]byte, []int)deprecated
- func (x *ProgramMetadata) GetBranchingFactor() uint32
- func (x *ProgramMetadata) GetExpectedInputCount() uint32
- func (x *ProgramMetadata) GetHashConfig() *HashConfig
- func (*ProgramMetadata) ProtoMessage()
- func (x *ProgramMetadata) ProtoReflect() protoreflect.Message
- func (x *ProgramMetadata) Reset()
- func (x *ProgramMetadata) String() string
Constants ¶
This section is empty.
Variables ¶
var ( HashFunctionOutputLength_name = map[int32]string{ 0: "HASHFUNCTIONOUTPUTLENGTH_UNKNOWN", 1: "HASHFUNCTIONOUTPUTLENGTH_FIXED", 2: "HASHFUNCTIONOUTPUTLENGTH_VARIABLE", } HashFunctionOutputLength_value = map[string]int32{ "HASHFUNCTIONOUTPUTLENGTH_UNKNOWN": 0, "HASHFUNCTIONOUTPUTLENGTH_FIXED": 1, "HASHFUNCTIONOUTPUTLENGTH_VARIABLE": 2, } )
Enum value maps for HashFunctionOutputLength.
var ( HashFunction_name = map[int32]string{ 0: "HASHFUNCTION_UNKNOWN", 1: "HASHFUNCTION_SHA_256", 2: "HASHFUNCTION_SHA3_512", } HashFunction_value = map[string]int32{ "HASHFUNCTION_UNKNOWN": 0, "HASHFUNCTION_SHA_256": 1, "HASHFUNCTION_SHA3_512": 2, } )
Enum value maps for HashFunction.
var ( OpCode_name = map[int32]string{ 0: "OPCODE_UNKNOWN", 1: "OPCODE_INVALID", 2: "OPCODE_PUSH_INPUT", 3: "OPCODE_PUSH_BYTES", 4: "OPCODE_POP_CHILDREN_PUSH_HASH", 5: "OPCODE_POP_N_PUSH_HASH", 6: "OPCODE_PEAK_N_PUSH_HASH", 7: "OPCODE_MATCH_INPUT", } OpCode_value = map[string]int32{ "OPCODE_UNKNOWN": 0, "OPCODE_INVALID": 1, "OPCODE_PUSH_INPUT": 2, "OPCODE_PUSH_BYTES": 3, "OPCODE_POP_CHILDREN_PUSH_HASH": 4, "OPCODE_POP_N_PUSH_HASH": 5, "OPCODE_PEAK_N_PUSH_HASH": 6, "OPCODE_MATCH_INPUT": 7, } )
Enum value maps for OpCode.
var (
// optional hashmachine.HashFunctionOutputLength output_length = 54435;
E_OutputLength = &file_hashmachine_proto_extTypes[0]
)
Extension fields to descriptor.EnumValueOptions.
var File_hashmachine_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type HashConfig ¶
type HashConfig struct { HashFunction HashFunction `` /* 128-byte string literal not displayed */ // hash_output_length_bytes is the number of bytes to read from a variable- // length hash function. // // For hash functions with variable-length outputs, this field must be set // and must be greater than zero, otherwise the program is invalid. // // For hashes with fixed-length outputs, this must not be set or set to // zero, otherwise the program is invalid. HashOutputLengthBytes uint32 `` /* 129-byte string literal not displayed */ // contains filtered or unexported fields }
HashConfig specifies the configuration for hashing operations used in verifying the hashmachine program.
func (*HashConfig) Descriptor
deprecated
func (*HashConfig) Descriptor() ([]byte, []int)
Deprecated: Use HashConfig.ProtoReflect.Descriptor instead.
func (*HashConfig) GetHashFunction ¶
func (x *HashConfig) GetHashFunction() HashFunction
func (*HashConfig) GetHashOutputLengthBytes ¶
func (x *HashConfig) GetHashOutputLengthBytes() uint32
func (*HashConfig) ProtoMessage ¶
func (*HashConfig) ProtoMessage()
func (*HashConfig) ProtoReflect ¶
func (x *HashConfig) ProtoReflect() protoreflect.Message
func (*HashConfig) Reset ¶
func (x *HashConfig) Reset()
func (*HashConfig) String ¶
func (x *HashConfig) String() string
type HashFunction ¶
type HashFunction int32
HashFunction specifies the hash function to use when evaluating the hashmachine program.
const ( HashFunction_HASHFUNCTION_UNKNOWN HashFunction = 0 HashFunction_HASHFUNCTION_SHA_256 HashFunction = 1 HashFunction_HASHFUNCTION_SHA3_512 HashFunction = 2 )
func (HashFunction) Descriptor ¶
func (HashFunction) Descriptor() protoreflect.EnumDescriptor
func (HashFunction) Enum ¶
func (x HashFunction) Enum() *HashFunction
func (HashFunction) EnumDescriptor
deprecated
func (HashFunction) EnumDescriptor() ([]byte, []int)
Deprecated: Use HashFunction.Descriptor instead.
func (HashFunction) Number ¶
func (x HashFunction) Number() protoreflect.EnumNumber
func (HashFunction) String ¶
func (x HashFunction) String() string
func (HashFunction) Type ¶
func (HashFunction) Type() protoreflect.EnumType
type HashFunctionOutputLength ¶
type HashFunctionOutputLength int32
HashFunctionOutputLength describes whether a HashFunction has fixed or variable length output.
Programs using a HashFunction with variable length output must also set hash_output_length_bytes in their HashConfig.
const ( HashFunctionOutputLength_HASHFUNCTIONOUTPUTLENGTH_UNKNOWN HashFunctionOutputLength = 0 HashFunctionOutputLength_HASHFUNCTIONOUTPUTLENGTH_FIXED HashFunctionOutputLength = 1 HashFunctionOutputLength_HASHFUNCTIONOUTPUTLENGTH_VARIABLE HashFunctionOutputLength = 2 )
func (HashFunctionOutputLength) Descriptor ¶
func (HashFunctionOutputLength) Descriptor() protoreflect.EnumDescriptor
func (HashFunctionOutputLength) Enum ¶
func (x HashFunctionOutputLength) Enum() *HashFunctionOutputLength
func (HashFunctionOutputLength) EnumDescriptor
deprecated
func (HashFunctionOutputLength) EnumDescriptor() ([]byte, []int)
Deprecated: Use HashFunctionOutputLength.Descriptor instead.
func (HashFunctionOutputLength) Number ¶
func (x HashFunctionOutputLength) Number() protoreflect.EnumNumber
func (HashFunctionOutputLength) String ¶
func (x HashFunctionOutputLength) String() string
func (HashFunctionOutputLength) Type ¶
func (HashFunctionOutputLength) Type() protoreflect.EnumType
type Op ¶
type Op struct { Opcode OpCode `protobuf:"varint,1,opt,name=opcode,proto3,enum=hashmachine.OpCode" json:"opcode,omitempty"` // Parameters used by some opcodes Index uint64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"` // contains filtered or unexported fields }
Op represents a single operation in the hashmachine program. An Op can be evaluated using its opcode and parameters as well as the current stack of the hashmachine.
func (*Op) Descriptor
deprecated
func (*Op) GetPayload ¶
func (*Op) ProtoMessage ¶
func (*Op) ProtoMessage()
func (*Op) ProtoReflect ¶
func (x *Op) ProtoReflect() protoreflect.Message
type OpCode ¶
type OpCode int32
OpCode identifies the operation to be performed.
const ( OpCode_OPCODE_UNKNOWN OpCode = 0 // OPCODE_INVALID invalidates a program if it appears anywhere in the list // of opcodes. // // Implementations should not check for this opcode and should instead use // the opcode for testing handling of unknown opcodes. // // OPCODE_INVALID is distinct from OPCODE_UNKNOWN. OPCODE_UNKNOWN is the // default value and represents an opcode that has not been set, rather than // an opcode that is set but to an invalid or unrecognized value. OpCode_OPCODE_INVALID OpCode = 1 // OPCODE_PUSH_INPUT pushes the input value at 'index' onto the stack. // // The program is invalid if there is no input at 'index'. OpCode_OPCODE_PUSH_INPUT OpCode = 2 // OPCODE_PUSH_BYTES pushes 'payload' onto the stack. // // The program is invalid if there is no 'payload'. OpCode_OPCODE_PUSH_BYTES OpCode = 3 // OPCODE_POP_CHILDREN_PUSH_HASH pops metadata.branchingfactor values // from the stack, hashing each in pop order, gets the hash sum and pushes // it onto the stack. This is equivalent to OPCODE_POP_N_PUSH_HASH where // N == medatadata.branchingfactor. // // OPCODE_POP_CHILDREN_PUSH_HASH saves from repeatedly encoding a count // of values to pop for the common case where we are popping a fixed number // of children to produce a parent in a tree of hashes. // // The program is invalid if the stack underflows. OpCode_OPCODE_POP_CHILDREN_PUSH_HASH OpCode = 4 // OPCODE_POP_N_PUSH_HASH pops 'index' values from the stack, hashing // each in pop order, gets the hash sum and pushes it onto the stack. // // OPCODE_POP_N_PUSH_HASH ignores metadata.branchingfactor. This opcode // is useful when hashing variable numbers of inputs such as when creating // a digest of peaks of a growing Merkle Mountain Range. OpCode_OPCODE_POP_N_PUSH_HASH OpCode = 5 // OPCODE_PEAK_N_PUSH_HASH peaks 'index' values from the stack, hashing // each in pop order, gets the hash sum and pushes it onto the stack. // // OPCODE_PEAK_N_PUSH_HASH ignores metadata.branchingfactor. This opcode // is useful when hashing variable numbers of inputs such as when recreating // an interim digest of peaks while consistency checking a Merkle Mountain // Range. OpCode_OPCODE_PEAK_N_PUSH_HASH OpCode = 6 // OPCODE_MATCH_INPUT pops the top value of the stack and compares it with // the input indentified by 'index'. If the values match, the program // proceeds. If the values do not match, the program fails verification. OpCode_OPCODE_MATCH_INPUT OpCode = 7 )
func (OpCode) Descriptor ¶
func (OpCode) Descriptor() protoreflect.EnumDescriptor
func (OpCode) EnumDescriptor
deprecated
func (OpCode) Number ¶
func (x OpCode) Number() protoreflect.EnumNumber
func (OpCode) Type ¶
func (OpCode) Type() protoreflect.EnumType
type Program ¶
type Program struct { Metadata *ProgramMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` Ops []*Op `protobuf:"bytes,2,rep,name=ops,proto3" json:"ops,omitempty"` // contains filtered or unexported fields }
func (*Program) Descriptor
deprecated
func (*Program) GetMetadata ¶
func (x *Program) GetMetadata() *ProgramMetadata
func (*Program) ProtoMessage ¶
func (*Program) ProtoMessage()
func (*Program) ProtoReflect ¶
func (x *Program) ProtoReflect() protoreflect.Message
type ProgramMetadata ¶
type ProgramMetadata struct { HashConfig *HashConfig `protobuf:"bytes,1,opt,name=hash_config,json=hashConfig,proto3" json:"hash_config,omitempty"` // expected_input_count is the number of byte strings the program expects // to be provided when the program is executed. Executions with a different // number of byte strings as inputs (regardless of whether they are used) // must fail. ExpectedInputCount uint32 `protobuf:"varint,3,opt,name=expected_input_count,json=expectedInputCount,proto3" json:"expected_input_count,omitempty"` // branching_factor is the branching factor of the tree of hashes used to // create the program. If the program uses OPCODE_POP_CHILDREN_PUSH_HASH // then branching_factor must be set and non-zero, otherwise the program is // invalid. If the program does not use OPCODE_POP_CHILDREN_PUSH_HASH, // then branching_factor is ignored. BranchingFactor uint32 `protobuf:"varint,4,opt,name=branching_factor,json=branchingFactor,proto3" json:"branching_factor,omitempty"` // contains filtered or unexported fields }
ProgramMetadata provides metadata to verify and execute the hashmachine program.
func (*ProgramMetadata) Descriptor
deprecated
func (*ProgramMetadata) Descriptor() ([]byte, []int)
Deprecated: Use ProgramMetadata.ProtoReflect.Descriptor instead.
func (*ProgramMetadata) GetBranchingFactor ¶
func (x *ProgramMetadata) GetBranchingFactor() uint32
func (*ProgramMetadata) GetExpectedInputCount ¶
func (x *ProgramMetadata) GetExpectedInputCount() uint32
func (*ProgramMetadata) GetHashConfig ¶
func (x *ProgramMetadata) GetHashConfig() *HashConfig
func (*ProgramMetadata) ProtoMessage ¶
func (*ProgramMetadata) ProtoMessage()
func (*ProgramMetadata) ProtoReflect ¶
func (x *ProgramMetadata) ProtoReflect() protoreflect.Message
func (*ProgramMetadata) Reset ¶
func (x *ProgramMetadata) Reset()
func (*ProgramMetadata) String ¶
func (x *ProgramMetadata) String() string
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
pkg
|
|
hm
Package hm provides the implementation of the hash machine.
|
Package hm provides the implementation of the hash machine. |
oncehash
package onceHash provides an interface for a hash that can only be used once.
|
package onceHash provides an interface for a hash that can only be used once. |