cypher

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCookie

func DecodeCookie(cypher core.Cypher, data string) (string, error)

DecodeCookie is a function that decodes a cookie data using a Cypher implementation. Returns plain cookie data. If cannot decode or decrypt data will return an error.

func EncodeCookie

func EncodeCookie(cypher core.Cypher, data string) (string, error)

EncodeCookie is a function that encodes a cookie data using a Cypher implementation. Returns a base64 encoded cookie. If cannot encode data will return an error.

func GenerateRandomPass

func GenerateRandomPass() ([]byte, error)

Generates a random password to use with AES256.

func GenerateRandomPassAsString

func GenerateRandomPassAsString() (string, error)

Generates a random password as string to use with AES256.

func New

func New() core.Cypher

Creates a Cypher with a random password. Everytime you create a cypher will generate a new random password. Keep in mind that anything encrypted with other instances will not be decrypted because they dont share passwords. Will panic if it cannot generate a random password.

func NewWithPassword

func NewWithPassword(password []byte) core.Cypher

Creates a Cypher with a provided password as bytes

func NewWithPasswordAsString

func NewWithPasswordAsString(password string) core.Cypher

Creates a Cypher with a provided password as string

Types

type AES256

type AES256 struct {
	// contains filtered or unexported fields
}

AES256 is an implementation of the interface core.Cypher using the AES256 symmetric algorithm.

func (AES256) Decrypt

func (aes AES256) Decrypt(data []byte) ([]byte, error)

Decrypt bytes using AES256. Will return an error if cannot decrypt information.

func (AES256) Encrypt

func (aes AES256) Encrypt(data []byte) ([]byte, error)

Encrypt bytes using AES256. Will return an error if cannot encrypt.

Jump to

Keyboard shortcuts

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