crypto

package
v0.4.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ChunkSize = 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

func NewEnCipher

func NewEnCipher() *Cipher

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) ([]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