cipher

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cipher provides XTEA-based helper functions for encrypting and decrypting Trice binary payload blocks.

The package uses a process-global setup configured by Password and SetUp.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Password is the key one needs to decrypt trice logs if encrypted
	Password string

	// ShowKey if set, allows to see the encryption passphrase
	ShowKey bool
)

Functions

func Decrypt added in v0.24.1

func Decrypt(dst, src []byte) (c int)

Decrypt converts src into dst and returns count of converted bytes. Only multiple of 8 are convertable, so last 0-7 bytes are not convertable and c is a multiple of 8. The smaller byte slice limits the conversion.

func Decrypt8

func Decrypt8(b []byte) (d []byte)

Decrypt8 translates an encryption protected byte slice back in a slice of length 8.

The input must be exactly 8 bytes; otherwise the function logs an info message.

func Encrypt8

func Encrypt8(b []byte) (e []byte)

Encrypt8 translates a byte slice in a protected slice of length 8.

The input must be exactly 8 bytes; otherwise the function logs an info message.

func SetUp

func SetUp(w io.Writer) error

SetUp uses the Password to create a cipher. If Password is "" encryption/decryption is disabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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