Documentation ¶
Index ¶
- func CreateDiscriminant(seed []byte, length int) *big.Int
- func EncodeBigIntBigEndian(a *big.Int) []byte
- func EntropyFromSeed(seed []byte, byte_count int) []byte
- func GenerateVDF(seed []byte, iterations, int_size_bits int) ([]byte, []byte)
- func GenerateVDFWithStopChan(seed []byte, iterations, int_size_bits int, stop <-chan struct{}) ([]byte, []byte)
- func SolveMod(a, b, m *big.Int) (s, t *big.Int, solvable bool)
- func VerifyVDF(seed, proof_blob []byte, iterations, int_size_bits int) bool
- type ClassGroup
- func CloneClassGroup(cg *ClassGroup) *ClassGroup
- func IdentityForDiscriminant(d *big.Int) *ClassGroup
- func NewClassGroup(a, b, c *big.Int) *ClassGroup
- func NewClassGroupFromAbDiscriminant(a, b, discriminant *big.Int) *ClassGroup
- func NewClassGroupFromBytesDiscriminant(buf []byte, discriminant *big.Int) (*ClassGroup, bool)
- func (group *ClassGroup) BigPow(n *big.Int) *ClassGroup
- func (group *ClassGroup) Discriminant() *big.Int
- func (group *ClassGroup) Equal(other *ClassGroup) bool
- func (group *ClassGroup) Multiply(other *ClassGroup) *ClassGroup
- func (group *ClassGroup) Normalized() *ClassGroup
- func (group *ClassGroup) Pow(n int64) *ClassGroup
- func (group *ClassGroup) Reduced() *ClassGroup
- func (group *ClassGroup) Serialize() []byte
- func (group *ClassGroup) Square() *ClassGroup
- func (group *ClassGroup) SquareUsingMultiply() *ClassGroup
- type Pair
- type VDF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDiscriminant ¶
Return a discriminant of the given length using the given seed It is a random prime p between 13 - 2^2K return -p, where p % 8 == 7
func EncodeBigIntBigEndian ¶
func EntropyFromSeed ¶
func GenerateVDF ¶
seed := vdf.input[:]
func GenerateVDFWithStopChan ¶
func GenerateVDFWithStopChan(seed []byte, iterations, int_size_bits int, stop <-chan struct{}) ([]byte, []byte)
seed : input, more like x in paper
Types ¶
type ClassGroup ¶
type ClassGroup struct {
// contains filtered or unexported fields
}
func CloneClassGroup ¶
func CloneClassGroup(cg *ClassGroup) *ClassGroup
func IdentityForDiscriminant ¶
func IdentityForDiscriminant(d *big.Int) *ClassGroup
func NewClassGroup ¶
func NewClassGroup(a, b, c *big.Int) *ClassGroup
func NewClassGroupFromAbDiscriminant ¶
func NewClassGroupFromAbDiscriminant(a, b, discriminant *big.Int) *ClassGroup
func NewClassGroupFromBytesDiscriminant ¶
func NewClassGroupFromBytesDiscriminant(buf []byte, discriminant *big.Int) (*ClassGroup, bool)
func (*ClassGroup) BigPow ¶
func (group *ClassGroup) BigPow(n *big.Int) *ClassGroup
func (*ClassGroup) Discriminant ¶
func (group *ClassGroup) Discriminant() *big.Int
func (*ClassGroup) Equal ¶
func (group *ClassGroup) Equal(other *ClassGroup) bool
func (*ClassGroup) Multiply ¶
func (group *ClassGroup) Multiply(other *ClassGroup) *ClassGroup
func (*ClassGroup) Normalized ¶
func (group *ClassGroup) Normalized() *ClassGroup
func (*ClassGroup) Pow ¶
func (group *ClassGroup) Pow(n int64) *ClassGroup
func (*ClassGroup) Reduced ¶
func (group *ClassGroup) Reduced() *ClassGroup
func (*ClassGroup) Serialize ¶
func (group *ClassGroup) Serialize() []byte
Serialize encodes a, b based on discriminant's size using one more byte for sign if nessesary
func (*ClassGroup) Square ¶
func (group *ClassGroup) Square() *ClassGroup
func (*ClassGroup) SquareUsingMultiply ¶
func (group *ClassGroup) SquareUsingMultiply() *ClassGroup
type VDF ¶
type VDF struct {
// contains filtered or unexported fields
}
VDF is the struct holding necessary state for a hash chain delay function.
func (*VDF) Execute ¶
func (vdf *VDF) Execute()
Execute runs the VDF until it's finished and put the result into output channel. currently on i7-6700K, it takes about 14 seconds when iteration is set to 10000
func (*VDF) GetOutput ¶
GetOutput returns the vdf output, which can be bytes of 0s is the vdf is not finished.
func (*VDF) GetOutputChannel ¶
GetOutputChannel returns the vdf output channel. VDF output consists of 258 bytes of serialized Y and 258 bytes of serialized Proof
func (*VDF) IsFinished ¶
IsFinished returns whether the vdf execution is finished or not.