encoding

package
v0.0.0-...-164552c Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BinaryEncoder

type BinaryEncoder interface {
	EncodeBinary(in []byte) ([]byte, []byte, error)
	DecodeBinary(in, parameters []byte) ([]byte, error)
	GetDecodingParametersSizeBytes() int
}

BinaryEncoder can be used to encode binary data. Examples of encoding steps include compression and encryption. These encoding steps must be reversible.

Many applications give a special meaning to empty data (e.g., the default value of bytes fields in a Protobuf message being). Because of that, implementations of BinaryEncoder should ensure that empty data should remain empty when encoded.

func NewBinaryEncoderFromProto

func NewBinaryEncoderFromProto(configurations []*encoding.BinaryEncoder, maximumDecodedSizeBytes uint32) (BinaryEncoder, error)

NewBinaryEncoderFromProto creates a BinaryEncoder that behaves according to the specification provided in the form of a Protobuf message.

func NewChainedBinaryEncoder

func NewChainedBinaryEncoder(encoders []BinaryEncoder) BinaryEncoder

NewChainedBinaryEncoder creates a BinaryEncoder that is capable of applying multiple encoding/decoding steps. It can be used to, for example, apply both compression and encryption.

func NewDeterministicEncryptingBinaryEncoder

func NewDeterministicEncryptingBinaryEncoder(blockCipher cipher.Block) BinaryEncoder

NewDeterministicEncryptingBinaryEncoder creates a BinaryEncoder that is capable of encrypting and decrypting data. The encryption process is deterministic, in that encrypting the same data twice results in the same encoded version of the data. It does not use Authenticating Encryption (AE), meaning that other facilities need to be present to ensure integrity of data.

func NewLZWCompressingBinaryEncoder

func NewLZWCompressingBinaryEncoder(maximumDecodedSizeBytes uint32) BinaryEncoder

NewLZWCompressingBinaryEncoder creates a BinaryEncoder that encodes data by compressing data using the "simple LZW" algorithm.

Jump to

Keyboard shortcuts

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