diana

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilPointer          = errors.New("received nil pointer(s)")
	ErrOutOfRange          = errors.New("input X and Y must be between A and Z")
	ErrNegativeKeyIndex    = errors.New("key index can not be negative")
	ErrKeyIndexOutOfBounds = errors.New("key index is out-of-bounds")
)
View Source
var ReciprocalTable string

Functions

func AppendTrigraphByteByKey

func AppendTrigraphByteByKey(writeTo *[]byte, character *byte, key *[]byte, keyIndex *int) error

AppendTrigraphByteByKey will append the encoded character to a byte slice tracking an indexed key. It will also increment the index through the keyIndex pointer when done making it possible to call this function repeatedly per input character. You will have to check that the index is not out of range, function will fail if index is greater than the length of the byte slice. You should also ensure the the byte slice (pointing at by writeTo) has the desired capacity in order to prevent the append function to make a new slice and copy everything from the old slice, thus leaving traces of encrypted text in memory that you are unable to wipe by yourself.

func TrigraphByte

func TrigraphByte(writeTo *byte, x *byte, y *byte) error

TrigraphByte writes the trigraph of input X and Y (where X is usually the row and Y is the column, but this does not matter). Pointers are used in the effort to prevent anything from the input being copied. Krypto431 wipes it's data structures and if there would be copies elsewhere it would be in vain.

func TrigraphRune

func TrigraphRune(writeTo *rune, x *rune, y *rune) error

TrigraphRune is the rune implementation of TrigraphByte. See TrigraphByte for information.

func ZeroKeyByte

func ZeroKeyByte(writeTo *byte, character *byte) error

ZeroKeyByte returns a "zero" encryption letter (byte) key in order to trigraph-encode an input letter to the same output letter (which makes the plaintext same as the ciphertext, effectively a zero key in a standard Vigenere cipher).

func ZeroKeyRune

func ZeroKeyRune(writeTo *rune, character *rune) error

ZeroKeyRune returns a "zero" encryption letter (rune) key in order to trigraph-encode an input letter to the same output letter (which makes the plaintext same as the ciphertext, effectively a zero key in a standard Vigenere cipher).

Types

This section is empty.

Jump to

Keyboard shortcuts

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