encoding

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrEncoding = Error("encoding/decoding error")
	ErrCrypt    = Error("encryption error")
)

Variables

This section is empty.

Functions

func BigUIntFromBytes

func BigUIntFromBytes(b []byte) (s *big.Int)

func BytesFromBigUInt

func BytesFromBigUInt(s *big.Int, l uint32) (out []byte)

func BytesFromInt64

func BytesFromInt64(i int64) (out []byte)

func BytesFromUint32

func BytesFromUint32(i uint32) (out []byte)

func BytesFromUint64

func BytesFromUint64(i uint64) (out []byte)

func DecodeBigUInt

func DecodeBigUInt(b []byte) (bui *big.Int, l uint32, err error)

func DecodeBytes

func DecodeBytes(b []byte) (db []byte, err error)

func DecodeListWithPadding added in v0.3.0

func DecodeListWithPadding(b []byte) (encoded [][]byte, err error)

DecodeListWithPadding decodes the first encoded list in b, ignoring any trailing bytes (reference Encoded.decodeListWithPadding). Olvid pads some plaintexts (e.g. an encrypted device name) up to a block boundary with trailing zeros; the list is self-delimiting, so the padding is discarded.

func EncodeBigUInt

func EncodeBigUInt(bui *big.Int, l uint32) (out []byte)

func EncodeBytes

func EncodeBytes(b []byte) (out []byte)

func Int64FromBytes

func Int64FromBytes(b []byte) (i int64)

func Uint32FromBytes

func Uint32FromBytes(b []byte) (i uint32)

func Uint64FromBytes

func Uint64FromBytes(b []byte) (i uint64)

Types

type Decoder

type Decoder struct {
}

func NewDecoder

func NewDecoder() (d *Decoder)

func (*Decoder) Decode

func (d *Decoder) Decode(o interface{}, in []byte) (err error)

type Encoder

type Encoder struct {
}

func NewEncoder

func NewEncoder() (e *Encoder)

func (*Encoder) Encode

func (e *Encoder) Encode(i ...interface{}) (out []byte)

type Error

type Error string

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

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