crypto

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNK_SIZE = 1024 * aes.BlockSize

Variables

This section is empty.

Functions

func NewDecoder

func NewDecoder(reader io.Reader, iv []byte, symKey []byte) *decoder

func NewEncoder

func NewEncoder(reader io.Reader) *encoder

func RandomKey

func RandomKey(n int) ([]byte, error)

RandomKey generate array of size n with random data.

Types

type Cipher

type Cipher struct {
	Iv     []byte
	SymKey []byte
}

func NewDeCipher

func NewDeCipher(iv []byte, symKey []byte) (Cipher, error)

func NewEnCipher

func NewEnCipher() (Cipher, error)

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(encrypted []byte) ([]byte, error)

Decrypt decrypts cipher text string into plain text string

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(unencrypted []byte, n int) ([]byte, error)

Encrypt encrypts plain text string into cipher text string

type IChipher

type IChipher interface {
	Encrypt()
	Decrypt()
}

Jump to

Keyboard shortcuts

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