Documentation ¶
Index ¶
- type BitVector
- func (b *BitVector) CopyTo(from *BitVector)
- func (b *BitVector) CopyToRange(from *BitVector, numOfBits uint64)
- func (b *BitVector) GetBit(position uint64) (uint8, error)
- func (b *BitVector) SetBit(position uint64, bit uint8) error
- func (b *BitVector) ShiftToLeft(newBit uint8) error
- func (b *BitVector) ShiftToRight(newBit uint8) error
- func (b *BitVector) ToDecimal(numOfBits uint) uint64
- func (b *BitVector) ToString() string
- type DesEncoder
- type Encoder
- type EncoderImplementation
- type GrainEncoder
- type TripleDesEncoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitVector ¶
type BitVector struct { BitNumber uint64 // contains filtered or unexported fields }
BitVector - structure represents simple bit vector implementation
func CreateBitVectorFromDecimal ¶
CreateBitVectorFromDecimal - creates new bit vector and initializes it with given decimal value.
func CreateBitVectors ¶
CreateBitVectors - creates bitvector with given length. Can be initialized with ones or zeroes
func (*BitVector) CopyToRange ¶
CopyToRange - copies values from one bit vector to another but only given number of bits
func (*BitVector) ShiftToLeft ¶
ShiftToLeft - shiftInfVector(int *inf_vector, int newElem)
func (*BitVector) ShiftToRight ¶
ShiftToRight siftuj(int *registar, int novaVrednost)
type DesEncoder ¶
type DesEncoder struct {
EncoderImplementation
}
DesEncoder uses Des for encoding function
func (DesEncoder) EncodingFunction ¶
func (d DesEncoder) EncodingFunction(key uint64, numOfBits uint64) uint64
EncodingFunction - implemented des for consensus algorithm
type Encoder ¶
Encoder interface has EncodiningFunction that is used for consensus protocol. Various implementations can be created here: Grain, Des, TripleDes
func GetEncoder ¶
func GetEncoder() Encoder
GetEncoder - function returns active encoder. Here, it should be changed for various implementations. Currently exists: GrainEncoder, DesEncoder,
TripleDesEncoder
type GrainEncoder ¶
type GrainEncoder struct {
EncoderImplementation
}
GrainEncoder encodingFunction
func (GrainEncoder) EncodingFunction ¶
func (e GrainEncoder) EncodingFunction(key uint64, numOfBits uint64) uint64
EncodingFunction - final implementation of Grain used for consensus
type TripleDesEncoder ¶
type TripleDesEncoder struct {
EncoderImplementation
}
TripleDesEncoder uses TripleDes for encoding function
func (TripleDesEncoder) EncodingFunction ¶
func (d TripleDesEncoder) EncodingFunction(key uint64, numOfBits uint64, isInit bool) uint64
EncodingFunction - tripleDes