handel

package module
v0.0.0-...-bc3f6f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

CircleCI

Handel

Handel is a fast multi-signature aggregation protocol for large Byzantine committees. This is the reference implementation in Go.

The protocol

Handel is a Byzantine fault tolerant aggregation protocol that allows for the quick aggregation of cryptographic signatures over a WAN. Handel has both logarithmic time and network complexity and needs minimal computing resources. For more information about the protocol, we refer you to the following presentations:

We have a paper in submission available here: https://arxiv.org/abs/1906.05132 Please note that the slides are not up-to-date with the latest version of the paper.

The reference implementation

Handel is an open-source Go library implementing the protocol. It includes many openness points to allow plugging different signature schemes or even other forms of aggregation besides signature aggregation. We implemented extensions to use Handel with BLS multi-signatures using the BN256 curve. We ran large-scale tests and evaluated Handel on 2000 AWS nano instances located in 10 AWS regions and running two Handel nodes per instance. Our results show that Handel scales logarithmically with the number of nodes both in communication and re- source consumption. Handel aggregates 4000 BN256 signatures with an average of 900ms completion time and an average of 56KBytes network consumption.

Installation

This library requires go version 1.11+

This library uses go modules, so make sure either you clone this library outside your $GOPATH or use GO111MODULE=on before building it.

If you want to hack around the library, you can find more information about the internal structure of Handel in the HACKING.md file.

License

The library is licensed with an Apache 2.0 license. See LICENSE for more information.

Documentation

Index

Constants

View Source
const DefaultCandidateCount = 10

DefaultCandidateCount is the default candidate count used by Handel.

View Source
const DefaultContributionsPerc = 51

DefaultContributionsPerc is the default percentage used as the required number of contributions in a multi-signature.

View Source
const DefaultLevelTimeout = 50 * time.Millisecond

DefaultLevelTimeout is the default level timeout used by the linear timeout strategy.

View Source
const DefaultUpdateCount = 1

DefaultUpdateCount is the default number of candidate contacted during an update

View Source
const DefaultUpdatePeriod = 10 * time.Millisecond

DefaultUpdatePeriod is the default update period used by Handel.

Variables

View Source
var DefaultBitSet = func(bitlength int) BitSet { return NewWilffBitset(bitlength) }

DefaultBitSet returns the default implementation used by Handel, i.e. the WilffBitSet

View Source
var DefaultEvaluatorStrategy = func(store SignatureStore, h *Handel) SigEvaluator {
	return newEvaluatorStore(store)
}

DefaultEvaluatorStrategy returns an evaluator based on the store's own evaluation strategy.

View Source
var DefaultLevel = lvl.AllowInfo()

DefaultLevel is the default level where statements are logged. Change the value of this variable before init() to change the level of the default logger.

View Source
var DefaultPartitioner = func(id int32, reg Registry, logger Logger) Partitioner {
	return NewBinPartitioner(id, reg, logger)
}

DefaultPartitioner returns the default implementation of the Partitioner used by Handel, i.e. BinPartitioner.

View Source
var PrintLog = true

PrintLog makes logf print all statements if it is true. If false, no log are outputted.

Functions

func LinearTimeoutConstructor

func LinearTimeoutConstructor(period time.Duration) func(h *Handel, levels []int) TimeoutStrategy

LinearTimeoutConstructor returns the linear timeout contructor as required for the Config.

func PercentageToContributions

func PercentageToContributions(perc, n int) int

PercentageToContributions returns the exact number of contributions needed out of n contributions, from the given percentage. Useful when considering large scale signatures as in Handel, e.g. 51%, 75%...

func VerifyMultiSignature

func VerifyMultiSignature(msg []byte, ms *MultiSignature, reg Registry, cons Constructor) error

VerifyMultiSignature verifies a multisignature against the given message, aby aggregating all public keys from the registry. It returns nil if the verification was sucessful, an error otherwise.

Types

type BitSet

type BitSet interface {
	// BitLength returns the fixed size of this BitSet
	BitLength() int
	// Cardinality returns the number of '1”s set
	Cardinality() int
	// Set the bit at the given index to 1 or 0 depending on the given boolean.
	// A set out of bounds is an error, implementations should panic in such a case.
	Set(int, bool)
	// Get returns the status of the i-th bit in this bitset.
	// A get out of bounds is an error, implementations should panic in such a case.
	Get(int) bool
	// MarshalBinary returns the binary representation of the BitSet.
	MarshalBinary() ([]byte, error)
	// UnmarshalBinary fills the bitset from the given buffer.
	UnmarshalBinary([]byte) error
	// returns the binary representation of this bitset in string
	String() string
	// All returns true if all bits are set, false otherwise. Returns true for
	// empty sets.
	All() bool
	// None returns true if no bit is set, false otherwise. Returns true for
	// empty sets.
	None() bool
	// Any returns true if any bit is set, false otherwise
	Any() bool
	// Or between this bitset and another, returns a new bitset.
	Or(b2 BitSet) BitSet
	// And between this bitset and another, returns a new bitset.
	And(b2 BitSet) BitSet
	// Xor between this bitset and another, returns a new bitset.
	Xor(b2 BitSet) BitSet
	// IsSuperSet returns true if this is a superset of the other set
	IsSuperSet(b2 BitSet) bool
	// NextSet returns the next bit set from the specified index,
	// including possibly the current index
	// along with an error code (true = valid, false = no set bit found)
	// for i,e := v.NextSet(0); e; i,e = v.NextSet(i + 1) {...}
	NextSet(i int) (int, bool)
	// IntersectionCardinality computes the cardinality of the differnce
	IntersectionCardinality(b2 BitSet) int
	// Clone this BitSet
	Clone() BitSet
}

BitSet interface. Available implementation is a wrapper around wilff's bitset library.

func NewWilffBitset

func NewWilffBitset(length int) BitSet

NewWilffBitset returns a BitSet implemented using the wilff's bitset library.

type Config

type Config struct {
	// Contributions is the minimum number of contributions a multi-signature
	// must contain to be considered as valid. Handel will only output
	// multi-signature containing more than this threshold of contributions.  It
	// must be typically above 50% of the number of Handel nodes. If not
	// specified, DefaultContributionsPerc of the number of signers is used by
	// default.
	Contributions int

	// UpdatePeriod indicates at which frequency a Handel nodes sends updates
	// about its state to other Handel nodes.
	UpdatePeriod time.Duration

	// UpdateCount indicates the number of nodes contacted during each update at
	// a given level.
	UpdateCount int

	// FastPath indicates how many peers should we contact when a level gets
	// completed.
	FastPath int

	// NewBitSet returns an empty bitset. This function is used to parse
	// incoming packets containing bitsets.
	NewBitSet func(bitlength int) BitSet

	// NewPartitioner returns the Partitioner to use for this Handel round. If
	// nil, it returns the RandomBinPartitioner. The id is the ID Handel is
	// responsible for and reg is the global registry of participants.
	NewPartitioner func(id int32, reg Registry, Logger Logger) Partitioner

	// NewEvaluatorStrategy returns the signature evaluator to use during the
	// Handel round.
	NewEvaluatorStrategy func(s SignatureStore, h *Handel) SigEvaluator

	// NewTimeoutStrategy returns the Timeout strategy to use during the Handel
	// round. By default, it uses the linear timeout strategy.
	NewTimeoutStrategy func(h *Handel, levels []int) TimeoutStrategy

	// Logger to use for logging handel actions
	Logger Logger
	// Rand provides the source of entropy for shuffling the list of nodes that
	// Handel must contact at each level. If not set, golang's crypto/rand is
	// used.
	Rand io.Reader

	// DisableShuffling is a debugging flag to not shuffle any list of nodes - it
	// is much easier to detect pattern in bugs in this manner
	DisableShuffling bool

	// UnsafeSleepTimeOnSigVerify is a test feature a sleep time (in ms) rather than actually verifying the signatures
	// Can be used to save on CPU during tests or/and to test with shorter/longer verifying time
	// Set to zero by default: no sleep time. When activated the sleep replaces the verification.
	// This sleep time is approximate and depends on golang and the os. The actual delay can be longer.
	UnsafeSleepTimeOnSigVerify int
}

Config holds the different parameters used to configure Handel.

func DefaultConfig

func DefaultConfig(numberOfNodes int) *Config

DefaultConfig returns a default configuration for Handel.

type Constructor

type Constructor interface {
	// Signature returns a fresh empty signature suitable for unmarshaling
	Signature() Signature
	// PublicKey returns a fresh empty public key suitable for aggregation
	PublicKey() PublicKey
}

Constructor creates empty signatures of the required type suitable for unmarshalling and empty public keys of the required type suitable for aggregation. See package bn256 for an example.

type Evaluator1

type Evaluator1 struct{}

Evaluator1 returns 1 for all signatures, leading to having all signatures verified.

func (*Evaluator1) Evaluate

func (f *Evaluator1) Evaluate(sp *incomingSig) int

Evaluate implements the SigEvaluator interface.

type EvaluatorStore

type EvaluatorStore struct {
	// contains filtered or unexported fields
}

EvaluatorStore is a wrapper around the store's evaluation strategy.

func (*EvaluatorStore) Evaluate

func (f *EvaluatorStore) Evaluate(sp *incomingSig) int

Evaluate implements the SigEvaluator strategy.

type Filter

type Filter interface {
	// Accept returns false if the signature must be evicted before inserting it
	// in the queue.
	Accept(*incomingSig) bool
}

Filter holds the responsibility of filtering out the signatures before they go into the processing queue. It is a preprocessing filter. For example, it can remove individual signatures already stored even before inserting them in the queue.

type HStats

type HStats struct {
	// contains filtered or unexported fields
}

HStats contain minimal stats about handel

type Handel

type Handel struct {
	sync.Mutex

	// Partitioning strategy used by the Handel round
	Partitioner Partitioner
	// contains filtered or unexported fields
}

Handel is the principal struct that performs the large scale multi-signature aggregation protocol. Handel is thread-safe.

func NewHandel

func NewHandel(n Network, r Registry, id Identity, c Constructor,
	msg []byte, s Signature, conf ...*Config) *Handel

NewHandel returns a Handle interface that uses the given network and registry. The identity is the public identity of this Handel's node. The constructor defines over which curves / signature scheme Handel runs. The message is the message to "multi-sign" by Handel. The first config in the slice is taken if not nil. Otherwise, the default config generated by DefaultConfig() is used.

func (*Handel) FinalSignatures

func (h *Handel) FinalSignatures() chan MultiSignature

FinalSignatures returns the channel over which final multi-signatures are sent over. These multi-signatures contain at least a threshold of contributions, as defined in the config.

func (*Handel) NewPacket

func (h *Handel) NewPacket(p *Packet)

NewPacket implements the Listener interface for the network. It parses the packet and forwards the multisignature (if correct) and the individual signature (if correct) to the processing loop.

func (*Handel) Start

func (h *Handel) Start()

Start the Handel protocol by sending signatures to peers in the first level, and by starting relevant sub-routines.

func (*Handel) StartLevel

func (h *Handel) StartLevel(level int)

StartLevel starts the given level if not started already. This in effects sends a first packet to a peer in that level.

func (*Handel) Stop

func (h *Handel) Stop()

Stop the Handel protocol and all sub routines

type Identity

type Identity interface {
	// Address must be understandable by the Network implementation
	Address() string
	// PublicKey returns the public key associated with that given node
	PublicKey() PublicKey
	// ID returns the ID used by handel to denote and classify nodes. It is best
	// if the IDs are continuous over a given finite range.
	ID() int32
}

Identity holds the public information of a Handel node

func NewStaticIdentity

func NewStaticIdentity(id int32, addr string, p PublicKey) Identity

NewStaticIdentity returns an Identity fixed by these parameters

type ListenFunc

type ListenFunc func(*Packet)

ListenFunc is a wrapper type to morph a function as a Listener

func (ListenFunc) NewPacket

func (l ListenFunc) NewPacket(p *Packet)

NewPacket implements the Listener interface

type Listener

type Listener interface {
	NewPacket(*Packet)
}

Listener is the interface that gets registered to the Network. Each time a new packet arrives from the network, it is dispatched to the registered Listeners.

type Logger

type Logger interface {
	Info(keyvals ...interface{})
	Debug(keyvals ...interface{})
	Warn(keyvals ...interface{})
	Error(keyvals ...interface{})
	// With returns a new Logger that inserts the given key value pairs for each
	// statements at each levels
	With(keyvals ...interface{}) Logger
}

Logger is a interface that can log to different levels. Handel calls these methods with key-value pairs as in structured logging framework do.

var DefaultLogger Logger

DefaultLogger is the default logger that only statemetns at the default level. The level is set by DefaultLevel inside init()..

func NewKitLogger

func NewKitLogger(opts ...lvl.Option) Logger

NewKitLogger returns a Logger based on go-kit/kit/log default logger structure that outputs to stdout. You can pass in options to only allow certain levels. By default, it also includes the caller stack.

func NewKitLoggerFrom

func NewKitLoggerFrom(l log.Logger) Logger

NewKitLoggerFrom returns a Logger out of a go-kit/kit/log logger interface. The caller can set the options that it needs to the logger first. By default, it wraps the logger with a SyncLogger since Handel is highly concurrent.

type MultiSignature

type MultiSignature struct {
	BitSet
	Signature
}

MultiSignature represents an aggregated signature alongside with its bitset. The signature is the aggregation of all individual signatures from the nodes whose index is set in the bitset.

func (*MultiSignature) MarshalBinary

func (m *MultiSignature) MarshalBinary() ([]byte, error)

MarshalBinary implements the binary.Marshaller interface

func (*MultiSignature) String

func (m *MultiSignature) String() string

func (*MultiSignature) Unmarshal

func (m *MultiSignature) Unmarshal(b []byte, s Signature, nbs func(b int) BitSet) error

Unmarshal reads a multisignature from the given slice, using the *empty* signature and bitset interface given.

type Network

type Network interface {
	// RegisterListener stores a Listener to dispatch incoming messages to it
	// later on
	RegisterListener(Listener)
	// Send sends the given packet to the given Identity. There can be no
	// guarantees about the reception of the packet provided by the Network.
	Send([]Identity, *Packet)
}

Network is the interface that must be given to Handel to communicate with other Handel instances. A Network implementation does not need to provide any transport layer guarantees (such as delivery or in-order).

type Packet

type Packet struct {
	// Origin is the ID of the sender of this packet.
	Origin int32
	// Level indicates for which level this packet is for in the Handel tree.
	// Values start at 1. There is no level 0.
	Level byte
	// MultiSig holds a MultiSignature struct.
	MultiSig []byte
	// IndividualSig holds the individual signature of the Origin node
	IndividualSig []byte
}

Packet is the general packet that Handel sends out and expects to receive from the Network. Handel do not provide any authentication nor confidentiality on Packets, it is up to the application layer to add these features if relevant.

type Partitioner

type Partitioner interface {
	// MaxLevel returns the maximum number of levels this partitioning strategy
	// will use given the list of participants
	MaxLevel() int
	// Returns the size of the set of peers at this level
	Size(level int) int

	// Levels returns the list of level ids.  It does not return the level 0
	// since that represents the personal contributions of the Handel node
	// itself.  If the levels is empty (it happens when the number of nodes is
	// not a power of two), it is not included in the returned list. Note: a
	// signature at the maximum level in the array + 1 is equal to a signature
	// over the full list of nodes.
	Levels() []int

	// IdentitiesAt returns the list of Identity that composes the whole level
	// in this partition scheme.
	IdentitiesAt(level int) ([]Identity, error)

	// IndexAtLevel returns the index inside the given level of the given global
	// ID. The returned index is usable inside a bitset for the same level.
	IndexAtLevel(globalID int32, level int) (int, error)

	// Combine takes a list of signature paired with their level and returns all
	// signatures correctly combined according to the partition strategy.  The
	// resulting signatures has the size denoted by the given level,i.e.
	// Size(level). All signatures must be valid signatures and have their size
	// be inferior or equal to the size denoted by the level. The return value
	// can be nil if no incomingSig have been given.It returns a MultiSignature
	// whose's BitSet's size is equal to the size of the level given in
	// parameter + 1. The +1 is there because it is a combined signature,
	// therefore, encompassing all signatures of levels up to the given level
	// included.
	Combine(sigs []*incomingSig, level int, nbs func(int) BitSet) *MultiSignature
	// CombineFull is similar to Combine but it returns the full multisignature
	// whose bitset's length is equal to the size of the registry.
	CombineFull(sigs []*incomingSig, nbs func(int) BitSet) *MultiSignature
}

Partitioner is a generic interface holding the logic used to partition the nodes in different buckets. The only Partitioner implemented is binTreePartition using binomial tree to partition, as in the original San Fermin paper.

func NewBinPartitioner

func NewBinPartitioner(id int32, reg Registry, logger Logger) Partitioner

NewBinPartitioner returns a binTreePartition using the given ID as its anchor point in the ID list, and the given registry.

type PublicKey

type PublicKey interface {
	// VerifySignature takes a message and a signature and returns an error iif
	// the signature is invalid with respect to this public key and the message.
	VerifySignature(msg []byte, sig Signature) error
	// Combine combines the two public keys together to produce an aggregate
	// public key. The resulting public key must be valid and able to verify
	// aggregated signatures valid under the aggregate public key.
	Combine(PublicKey) PublicKey

	// String returns an easy representation of the public key (hex, etc).
	String() string
}

PublicKey represents either a generic individual or aggregate public key. It contain methods to verify a signature and to combine multiple public keys together to verify signatures.

type Registry

type Registry interface {
	// Size returns the total number of Handel nodes
	Size() int
	// Identity returns the identity at this index in the registry, or
	// (nil,false) if the index is out of bound.
	Identity(int) (Identity, bool)
	// Identities is similar to Identity but returns an array instead that
	// includes nodes whose IDs are between from inclusive and to exclusive.
	Identities(from, to int) ([]Identity, bool)
}

Registry abstracts the bookeeping of the list of Handel nodes

func NewArrayRegistry

func NewArrayRegistry(ids []Identity) Registry

NewArrayRegistry returns a Registry that uses a fixed size array as backend

type ReportHandel

type ReportHandel struct {
	*Handel
}

ReportHandel holds a handel struct but modifies it so it is able to issue some stats.

func NewReportHandel

func NewReportHandel(h *Handel) *ReportHandel

NewReportHandel returns a Handel implementing the Reporter interface. It reports values about the network interface and the store interface of Handel.

func (*ReportHandel) Network

func (r *ReportHandel) Network() Reporter

Network returns the Network reporter interface

func (*ReportHandel) Processing

func (r *ReportHandel) Processing() Reporter

Processing returns the Store reporter interface

func (*ReportHandel) Store

func (r *ReportHandel) Store() Reporter

Store returns the Store reporter interface

func (*ReportHandel) Values

func (r *ReportHandel) Values() map[string]float64

Values returns the values of the internal components of Handel merged together.

type ReportStore

type ReportStore struct {
	SignatureStore
	// contains filtered or unexported fields
}

ReportStore is a Store that can report some statistics about the storage

func (*ReportStore) Store

func (r *ReportStore) Store(sp *incomingSig) *MultiSignature

Store overload the signatureStore interface's method.

func (*ReportStore) Values

func (r *ReportStore) Values() map[string]float64

Values implements the simul/monitor/counterIO interface

type Reporter

type Reporter interface {
	Values() map[string]float64
}

Reporter can report values indexed by a string key as float64 types.

type SecretKey

type SecretKey interface {
	// Sign the given message using the given randomness source.
	Sign(msg []byte, r io.Reader) (Signature, error)
}

SecretKey represents a secret key. This interface is mostly needed to run the tests in a generic way

type SigEvaluator

type SigEvaluator interface {
	// Evaluate the interest to verify a signature
	//   0: no interest, the signature can be discarded definitively
	//  >0: the greater the more interesting
	Evaluate(sp *incomingSig) int
}

SigEvaluator is an interface responsible to evaluate incoming *non-verified* signature according to their relevance regarding the running handel protocol. This is an important part of Handel because the aggregation function (pairing for bn256) can take some time, thus minimizing these number of operations is essential.

type Signature

type Signature interface {
	MarshalBinary() ([]byte, error)
	UnmarshalBinary([]byte) error

	// Combine aggregates the two signature together producing an unique
	// signature that can be verified by the combination of both
	// respective public keys that produced the original signatures.
	Combine(Signature) Signature
}

Signature holds methods to pass from/to a binary representation and to combine signatures together

type SignatureStore

type SignatureStore interface {
	// A Store is as well an evaluator since it best knows which signatures are
	// important.
	SigEvaluator
	// Store saves or merges if needed the given signature. It returns the
	// resulting multi-signature.  This signature must have been verified before
	// calling this function.
	Store(sp *incomingSig) *MultiSignature
	// GetBest returns the "best" multisignature at the requested level. Best
	// should be interpreted as "containing the most individual contributions".
	// Tt returns false if there is no signature associated to that level, true
	// otherwise.
	Best(level byte) (*MultiSignature, bool)
	// Combined returns the best combined multi-signature possible containing
	// all levels below and up to the given level parameters. The resulting
	// bitset size is the size associated to the level+1 candidate set.
	// It returns nil if no there are signatures stored yet for the levels below.
	Combined(level byte) *MultiSignature

	// FullSignature returns the best combined multi-signatures with the bitset
	// bitlength being the size of the registry.
	FullSignature() *MultiSignature
}

SignatureStore is a generic interface whose role is to store received valid multisignature, and to be able to serve the best multisignature received so far at a given level. Different strategies can be implemented such as keeping only the best one, merging two non-colluding multi-signatures etc. NOTE: implementation MUST be thread-safe.

type Test

type Test struct {
	// contains filtered or unexported fields
}

Test is a struct implementing some useful functionality to test specific implementations on Handel. DO NOT USE IT IN PRODUCTION.

func NewTest

func NewTest(keys []SecretKey, pubs []PublicKey, c Constructor, msg []byte, config *Config) *Test

NewTest returns all handels instances ready to go !

func (*Test) Networks

func (t *Test) Networks() []Network

Networks returns the slice of network interface used by handel. It can be useful if you want to register your own listener.

func (*Test) SetOfflineNodes

func (t *Test) SetOfflineNodes(ids ...int32)

SetOfflineNodes sets the given list of node's ID as offline nodes - the designated nodes won't run during the simulation.

func (*Test) SetRandomOfflines

func (t *Test) SetRandomOfflines(n int)

SetRandomOfflines sets n random identities as offline - they wont participate in Handel

func (*Test) SetThreshold

func (t *Test) SetThreshold(threshold int)

SetThreshold sets the minimum threshold of contributions required to be present in the multisignature created by Handel nodes. By default, it is equal to the size of the participant's set.

func (*Test) Start

func (t *Test) Start()

Start manually every handel instances and starts go routine to listen to the final signatures output from the handel instances.

func (*Test) Stop

func (t *Test) Stop()

Stop manually every handel instances

func (*Test) WaitCompleteSuccess

func (t *Test) WaitCompleteSuccess() chan bool

WaitCompleteSuccess waits until *all* handel instance have generated the multi-signature containing *all* contributions from each. It returns an channel so it's easy to wait for a certain timeout with `select`.

type TestNetwork

type TestNetwork struct {
	// contains filtered or unexported fields
}

TestNetwork is a simple Network implementation using local dispatch functions in goroutine.

func (*TestNetwork) RegisterListener

func (f *TestNetwork) RegisterListener(l Listener)

RegisterListener implements the Network interface

func (*TestNetwork) Send

func (f *TestNetwork) Send(ids []Identity, p *Packet)

Send implements the Network interface

type TimeoutStrategy

type TimeoutStrategy interface {
	// Called by handel when it starts
	Start()
	// // Called by handel when it stops
	Stop()
}

TimeoutStrategy decides when to start a level in Handel. A basic strategy starts level according to a linear timeout function: level $i$ starts at time $i * period$. The interface is started and stopped by the Handel main logic.

func DefaultTimeoutStrategy

func DefaultTimeoutStrategy(h *Handel, levels []int) TimeoutStrategy

DefaultTimeoutStrategy returns the default timeout strategy used by handel - the linear strategy with the default timeout. See DefaultLevelTimeout.

func NewDefaultLinearTimeout

func NewDefaultLinearTimeout(h *Handel, levels []int) TimeoutStrategy

NewDefaultLinearTimeout returns a TimeoutStrategy that starts level linearly with the default period of DefaultLevelTimeout. More precisely, level i starts at time i * period.

func NewLinearTimeout

func NewLinearTimeout(h *Handel, levels []int, period time.Duration) TimeoutStrategy

NewLinearTimeout returns a TimeoutStrategy that starts level linearly with the given period. More precisely, it starts level i at time i * period.

type WilffBitSet

type WilffBitSet struct {
	// contains filtered or unexported fields
}

WilffBitSet implements a BitSet using the wilff library.

func (*WilffBitSet) All

func (w *WilffBitSet) All() bool

All implements the BitSet interface

func (*WilffBitSet) And

func (w *WilffBitSet) And(b2 BitSet) BitSet

And implements the BitSet interface

func (*WilffBitSet) Any

func (w *WilffBitSet) Any() bool

Any implements the BitSet interface

func (*WilffBitSet) BitLength

func (w *WilffBitSet) BitLength() int

BitLength implements the BitSet interface

func (*WilffBitSet) Cardinality

func (w *WilffBitSet) Cardinality() int

Cardinality implements the BitSet interface

func (*WilffBitSet) Clone

func (w *WilffBitSet) Clone() BitSet

Clone implements the BitSet interface

func (*WilffBitSet) Combine

func (w *WilffBitSet) Combine(b2 BitSet) BitSet

Combine implements the BitSet interface

func (*WilffBitSet) Get

func (w *WilffBitSet) Get(idx int) bool

Get implements the BitSet interface

func (*WilffBitSet) IntersectionCardinality

func (w *WilffBitSet) IntersectionCardinality(b2 BitSet) int

IntersectionCardinality implements the BitSet interface

func (*WilffBitSet) IsSuperSet

func (w *WilffBitSet) IsSuperSet(b2 BitSet) bool

IsSuperSet implements the BitSet interface

func (*WilffBitSet) MarshalBinary

func (w *WilffBitSet) MarshalBinary() ([]byte, error)

MarshalBinary implements the go Marshaler interface. It encodes the size first and then the bitset.

func (*WilffBitSet) NextSet

func (w *WilffBitSet) NextSet(i int) (int, bool)

NextSet implements the BitSet interface

func (*WilffBitSet) None

func (w *WilffBitSet) None() bool

None implements the BitSet interface

func (*WilffBitSet) Or

func (w *WilffBitSet) Or(b2 BitSet) BitSet

Or implements the BitSet interface

func (*WilffBitSet) Set

func (w *WilffBitSet) Set(idx int, status bool)

Set implements the BitSet interface

func (*WilffBitSet) String

func (w *WilffBitSet) String() string

func (*WilffBitSet) UnmarshalBinary

func (w *WilffBitSet) UnmarshalBinary(buff []byte) error

UnmarshalBinary implements the go Marshaler interface. It decodes the length first and then the bitset.

func (*WilffBitSet) Xor

func (w *WilffBitSet) Xor(b2 BitSet) BitSet

Xor implements the BitSet interface

Directories

Path Synopsis
bn256
cf
Package bn256 allows to use Handel with the BLS signature scheme over the BN256 groups.
Package bn256 allows to use Handel with the BLS signature scheme over the BN256 groups.
go
Package bn256 allows to use Handel with the BLS signature scheme over the BN256 groups.
Package bn256 allows to use Handel with the BLS signature scheme over the BN256 groups.
tcp
udp
This package can launches a Handel simulation.
This package can launches a Handel simulation.
lib
monitor
Package monitor package handle the logging, collection and computation of statistical data.
Package monitor package handle the logging, collection and computation of statistical data.
node
Package main holds the logic of a single Handel node for the simulation
Package main holds the logic of a single Handel node for the simulation
p2p
p2p/udp
package udp enforces each node broadcasts to everybody
package udp enforces each node broadcasts to everybody
platform
Package platform contains interface and implementation to run a Handel node on multiple platforms.
Package platform contains interface and implementation to run a Handel node on multiple platforms.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL