Documentation
¶
Overview ¶
Package utils contains helper structures and function
Index ¶
- func BitReverse64(index, bitLen uint64) uint64
- func EqualSliceUint8(a, b []uint8) (v bool)
- func EqualSliceUint64(a, b []uint64) (v bool)
- func HammingWeight64(x uint64) uint64
- func IsInSliceUint64(x uint64, slice []uint64) (v bool)
- func MaxFloat64(a, b float64) (r float64)
- func MaxUint64(a, b uint64) (r uint64)
- func MinUint64(a, b uint64) (r uint64)
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) ReadUint8() byte
- func (b *Buffer) ReadUint8Slice(rec []uint8)
- func (b *Buffer) ReadUint64() uint64
- func (b *Buffer) ReadUint64Slice(rec []uint64)
- func (b *Buffer) WriteUint8(c byte)
- func (b *Buffer) WriteUint8Slice(s []uint8)
- func (b *Buffer) WriteUint64(v uint64)
- func (b *Buffer) WriteUint64Slice(s []uint64)
- type PRNG
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BitReverse64 ¶ added in v1.3.0
BitReverse64 returns the bit-reverse value of the input value, within a context of 2^bitLen.
func EqualSliceUint8 ¶ added in v1.3.0
EqualSliceUint8 checks the equality between two uint8 slices.
func EqualSliceUint64 ¶ added in v1.3.0
EqualSliceUint64 checks the equality between two uint64 slices.
func HammingWeight64 ¶ added in v1.3.0
HammingWeight64 returns the hammingweight if the input value.
func IsInSliceUint64 ¶ added in v1.3.0
IsInSliceUint64 checks if x is in slice.
func MaxFloat64 ¶ added in v1.3.0
MaxFloat64 returns the maximum value of the input slice of uint64 values.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a simple wrapper around a []byte to facilitate efficient marshaling of lattigo's objects
func (*Buffer) ReadUint8Slice ¶ added in v1.1.0
ReadUint8Slice reads an uint8 slice from the target byte buffer.
func (*Buffer) ReadUint64 ¶
ReadUint64 reads an uint64 from the target byte buffer.
func (*Buffer) ReadUint64Slice ¶
ReadUint64Slice reads an uint64 slice from the target byte buffer.
func (*Buffer) WriteUint8 ¶
WriteUint8 writes an uint8 on the target byte buffer.
func (*Buffer) WriteUint8Slice ¶ added in v1.1.0
WriteUint8Slice writes an uint8 slice on the target byte buffer.
func (*Buffer) WriteUint64 ¶
WriteUint64 writes an uint64 on the target byte buffer.
func (*Buffer) WriteUint64Slice ¶
WriteUint64Slice writes an uint64 slice on the target byte buffer.
type PRNG ¶ added in v1.3.0
type PRNG struct {
// contains filtered or unexported fields
}
PRNG is a structure storing the parameters used to securely and deterministically generate shared sequences of random bytes among different parties using the hash function blake2b. Backward sequence security (given the digest i, compute the digest i-1) is ensured by default, however forward sequence security (given the digest i, compute the digest i+1) is only ensured if the PRNG is given a key.
func NewPRNG ¶ added in v1.3.0
NewPRNG creates a new instance of PRNG. Accepts an optional key, else set key=nil.
func (*PRNG) Clock ¶ added in v1.3.0
Clock returns the right 64 bytes digest value of the current PRNG state and reseeds the PRNG with those same 64 bytes. Also increases the clock cycle by 1.