Documentation ¶
Index ¶
- type DCNET_ENTITY
- type DCNetCipher
- type DCNetEntity
- func (e *DCNetEntity) DecodeCell(isOpenClosedSlot bool) ([]byte, []byte)
- func (e *DCNetEntity) DecodeClient(roundID int32, slice []byte)
- func (e *DCNetEntity) DecodeStart(roundID int32)
- func (e *DCNetEntity) DecodeTrustee(roundID int32, slice []byte)
- func (e *DCNetEntity) EncodeForRound(roundID int32, slotOwner bool, payload []byte) ([]byte, []byte)
- func (e *DCNetEntity) GetBitsOfRound(roundID int32, bitPosition int32) (map[int]int, [][]byte)
- func (e *DCNetEntity) TrusteeEncodeForRound(roundID int32) []byte
- func (e *DCNetEntity) UpdateReceivedMessageHistory(newData []byte)
- type DCNetRoundDecoder
- type EquivocationProtection
- func (e *EquivocationProtection) ClientEncryptPayload(slotOwner bool, x []byte, p_j [][]byte) ([]byte, []byte)
- func (e *EquivocationProtection) ClientProve() []byte
- func (e *EquivocationProtection) RelayDecode(encryptedPayload []byte, trusteesContributions [][]byte, ...) []byte
- func (e *EquivocationProtection) TrusteeGetContribution(s_i [][]byte) []byte
- func (e *EquivocationProtection) TrusteeProve() []byte
- func (e *EquivocationProtection) UpdateHistory(data []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DCNET_ENTITY ¶
type DCNET_ENTITY int
Relay, Trustee or Client
const ( // Define this DCNET entity as a client DCNET_CLIENT DCNET_ENTITY = iota // Define this DCNET entity as a trustee DCNET_TRUSTEE // Define this DCNET entity as a relay DCNET_RELAY )
type DCNetCipher ¶
DCNetCipher is the output of a DC-net round
func DCNetCipherFromBytes ¶
func DCNetCipherFromBytes(data []byte) *DCNetCipher
Decodes some bytes into a DCNetCipher
func (*DCNetCipher) ToBytes ¶
func (c *DCNetCipher) ToBytes() []byte
Converts the DCNetCipher to []byte
type DCNetEntity ¶
type DCNetEntity struct { //Global for all nodes EntityID int Entity DCNET_ENTITY EquivocationProtectionEnabled bool DCNetPayloadSize int //Used by the relay DCNetRoundDecoder *DCNetRoundDecoder //nil if unused // contains filtered or unexported fields }
A struct with all methods to encode and decode dc-net messages
func NewDCNetEntity ¶
func NewDCNetEntity( entityID int, entity DCNET_ENTITY, PayloadSize int, equivocationProtection bool, sharedKeys []kyber.Point) *DCNetEntity
Used by clients, trustees
func (*DCNetEntity) DecodeCell ¶
func (e *DCNetEntity) DecodeCell(isOpenClosedSlot bool) ([]byte, []byte)
Called on the relay to decode the cell, after having stored the cryptographic materials
func (*DCNetEntity) DecodeClient ¶
func (e *DCNetEntity) DecodeClient(roundID int32, slice []byte)
called by the relay to decode a client contribution
func (*DCNetEntity) DecodeStart ¶
func (e *DCNetEntity) DecodeStart(roundID int32)
Used by the relay to start decoding a round
func (*DCNetEntity) DecodeTrustee ¶
func (e *DCNetEntity) DecodeTrustee(roundID int32, slice []byte)
called by the relay to decode a client contribution
func (*DCNetEntity) EncodeForRound ¶
func (e *DCNetEntity) EncodeForRound(roundID int32, slotOwner bool, payload []byte) ([]byte, []byte)
Encodes "Payload" in the correct round. Will skip PRNG material if the round is in the future, and crash if the round is in the past or the Payload is too long
func (*DCNetEntity) GetBitsOfRound ¶
Function to get the bits from previous round in an exact position.
func (*DCNetEntity) TrusteeEncodeForRound ¶
func (e *DCNetEntity) TrusteeEncodeForRound(roundID int32) []byte
Encodes "Payload" in the correct round. Will skip PRNG material if the round is in the future, and crash if the round is in the past or the Payload is too long
func (*DCNetEntity) UpdateReceivedMessageHistory ¶
func (e *DCNetEntity) UpdateReceivedMessageHistory(newData []byte)
Adds `newdata` into the sponge representing the received downstream data
type DCNetRoundDecoder ¶
type DCNetRoundDecoder struct {
// contains filtered or unexported fields
}
DCNetRoundDecoder is used by the relay to decode the dcnet ciphers
type EquivocationProtection ¶
type EquivocationProtection struct {
// contains filtered or unexported fields
}
Equivocation holds the functions needed for equivocation protection
func NewEquivocation ¶
func NewEquivocation() *EquivocationProtection
NewEquivocation creates the structure that handle equivocation protection
func (*EquivocationProtection) ClientEncryptPayload ¶
func (e *EquivocationProtection) ClientEncryptPayload(slotOwner bool, x []byte, p_j [][]byte) ([]byte, []byte)
a function that takes a payload x, encrypt it as x' = x + k, and returns x' and kappa = k + history * (sum of the (hashes of pads))
func (*EquivocationProtection) ClientProve ¶
func (e *EquivocationProtection) ClientProve() []byte
LB->CV todo
func (*EquivocationProtection) RelayDecode ¶
func (e *EquivocationProtection) RelayDecode(encryptedPayload []byte, trusteesContributions [][]byte, clientsContributions [][]byte) []byte
given all contributions, decodes the payload
func (*EquivocationProtection) TrusteeGetContribution ¶
func (e *EquivocationProtection) TrusteeGetContribution(s_i [][]byte) []byte
a function that takes returns the byte[] version of sigma_j
func (*EquivocationProtection) TrusteeProve ¶
func (e *EquivocationProtection) TrusteeProve() []byte
LB->CV todo
func (*EquivocationProtection) UpdateHistory ¶
func (e *EquivocationProtection) UpdateHistory(data []byte)
Update History adds those bits to the history hash chain