dat

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DAT_HEADER_SIZE = 8 + 16 + 32 + 64 + 32 + 1 + 2
)

Variables

This section is empty.

Functions

func Btt

func Btt(b []byte) time.Time

func CheckWork

func CheckWork(h *blake3.Hasher, sig Signature, salt Salt, work Work) error

func DoWork

func DoWork(sig Signature, d uint8) (work Work, salt Salt)

DoWork computes a proof-of-work, either on a single core or on all cores, depending on the difficulty level. For lower difficulty levels (< 12), the single-core implementation performs best.

func Nzerobit

func Nzerobit(work Work) uint8

func Ttb

func Ttb(t time.Time) []byte

Types

type Dat

type Dat struct {
	Time   time.Time
	Salt   Salt
	Work   Work
	Sig    Signature
	PubKey ed25519.PublicKey
	Key    string
	Val    []byte
}

func (Dat) Marshal

func (dat Dat) Marshal(buf []byte) (int, error)

func (*Dat) Sign

func (d *Dat) Sign(privKey ed25519.PrivateKey)

func (*Dat) Unmarshal

func (dat *Dat) Unmarshal(buf []byte) error

func (*Dat) Verify

func (d *Dat) Verify(h *blake3.Hasher) error

Verify verifies the time, proof-of-work, and signature.

type Salt

type Salt [16]byte

type Signature

type Signature [64]byte

type Work

type Work [32]byte

Jump to

Keyboard shortcuts

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