Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type XOREncoder ¶
type XOREncoder struct { // ciphertext generated by the encoder based on the key // and plaintext. this is the encrypted data. Ciphertext string // contains filtered or unexported fields }
structure representing an XOR encoder. this will carry out all the functions related to XOR encoding/encrypting.
func NewXOREncoder ¶
func NewXOREncoder(options ...XOREncoderOptsFunc) (encoder *XOREncoder, err error)
function designed to create and initialize a new XORDecoder object.
func (*XOREncoder) XOREncryptWithKey ¶
func (xoe *XOREncoder) XOREncryptWithKey() (err error)
function designed to loop through the plaintext and encrypt each character using the key provided.
func (*XOREncoder) XORPreviousPosition ¶
func (xoe *XOREncoder) XORPreviousPosition() (err error)
function designed to loop through the ciphertext and xor every evenly positioned hex value with the previously positioned hex value.
type XOREncoderOptions ¶
type XOREncoderOptions struct { // file that contains plaintext to encrypt. this will be // read by the encryptor and the plaintext wil be extracted. // // note: this cannot be set alongside Plaintext. PlaintextFile string // this is the plaintext that will be encrypted using the // XOREncoder object. // // note: this cannot be set alongside PlaintextFile. Plaintext string // file that contains the key used for encryption. this will // be read by the encryptor and the key will be extracted // and used for encoding/encryption. // // note: this cannot be set alongside Key. KeyFile string // key that will be used in encoding/encryption. // // note: this cannot be set alongside KeyFile. Key []byte // offset that will be used when encrypting. this will determine // the start position within the key. KeyOffset int }
structure representing an OptsStruct that will hold the configuration options for an XOREncoder object.
type XOREncoderOptsFunc ¶
type XOREncoderOptsFunc func(*XOREncoderOptions) error
function alias that represents a function architecture used to set an XOREncoderOptions variable.
func WithFile ¶
func WithFile(filename string) XOREncoderOptsFunc
xorencoderoptsfunc designed to specify the name of the file in which the plaintext is stored.
func WithKey ¶
func WithKey(keybytes []byte) XOREncoderOptsFunc
xorencoderoptsfunc designed to specify the encryption key to use.
func WithKeyFile ¶
func WithKeyFile(filename string) XOREncoderOptsFunc
xorencoderoptsfunc designed to specify the encryption key file to read the encryption key from.
func WithKeyOffset ¶
func WithKeyOffset(offset int) XOREncoderOptsFunc
xorencoderoptsfunc designed to specify the key offset to use when encrypting plaintext.
func WithPlaintext ¶
func WithPlaintext(plaintext string) XOREncoderOptsFunc
xorencoderoptsfunc designed to specify the plaintext the user wants to encrypt.