crypto

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncrypter

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

AESEncrypter is an AES cipher that implements Encrypter interface

func NewAESEncrypter

func NewAESEncrypter(key []byte, iv []byte) (*AESEncrypter, error)

NewAESEncrypter initialize a new AESEncrypter interfaced with Encrypter

func (*AESEncrypter) Decrypt

func (ae *AESEncrypter) Decrypt(data []byte) []byte

Decrypt returns the decrypted data

func (*AESEncrypter) Encrypt

func (ae *AESEncrypter) Encrypt(data []byte) []byte

Encrypt returns the encrypted data

type ChaChaStream

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

ChaChaStream is a ChaCha20 cipher that implements Stream and Encrypter interface

func NewChaChaEncrypter

func NewChaChaEncrypter(key []byte, iv []byte) (*ChaChaStream, error)

NewChaChaEncrypter initialize a new ChaChaStream interfaced with Encrypter

func NewChaChaStream

func NewChaChaStream(key []byte) (*ChaChaStream, error)

NewChaChaStream initialize a new ChaChaStream interfaced with Stream

func (*ChaChaStream) Decrypt

func (cs *ChaChaStream) Decrypt(data []byte) []byte

Decrypt returns the decrypted data

func (*ChaChaStream) Encrypt

func (cs *ChaChaStream) Encrypt(data []byte) []byte

Encrypt returns the encrypted data

func (*ChaChaStream) Pack

func (cs *ChaChaStream) Pack(payload []byte) string

Pack returns the payload as encrypted string

func (*ChaChaStream) Unpack

func (cs *ChaChaStream) Unpack(payload string) []byte

Unpack returns the payload as unencrypted byte array

type InsecureStream

type InsecureStream struct{}

InsecureStream is a fake cipher that implements CryptoStream interface

func NewInsecureStream

func NewInsecureStream() *InsecureStream

NewInsecureStream initialize a new InsecureStream interfaced with CryptoStream

func (*InsecureStream) Pack

func (c *InsecureStream) Pack(payload []byte) string

Pack returns the payload as encrypted string

func (*InsecureStream) Unpack

func (c *InsecureStream) Unpack(payload string) []byte

Unpack returns the payload as unencrypted byte array

type SalsaStream

type SalsaStream struct {
	State []uint32
	// contains filtered or unexported fields
}

SalsaStream is a Salsa20 cipher that implements CryptoStream interface

func NewSalsaStream

func NewSalsaStream(key []byte) (*SalsaStream, error)

NewSalsaStream initialize a new SalsaStream interfaced with CryptoStream

func (*SalsaStream) Pack

func (s *SalsaStream) Pack(payload []byte) string

Pack returns the payload as encrypted string

func (*SalsaStream) Unpack

func (s *SalsaStream) Unpack(payload string) []byte

Unpack returns the payload as unencrypted byte array

type TwoFishEncrypter added in v3.6.0

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

TwoFishEncrypter is a TwoFish cipher that implements Encrypter interface

func NewTwoFishEncrypter added in v3.6.0

func NewTwoFishEncrypter(key []byte, iv []byte) (*TwoFishEncrypter, error)

NewTwoFishEncrypter initialize a new TwoFishEncrypter interfaced with Encrypter

func (*TwoFishEncrypter) Decrypt added in v3.6.0

func (tfe *TwoFishEncrypter) Decrypt(data []byte) []byte

Decrypt returns the decrypted data

func (*TwoFishEncrypter) Encrypt added in v3.6.0

func (tfe *TwoFishEncrypter) Encrypt(data []byte) []byte

Encrypt returns the encrypted data

Jump to

Keyboard shortcuts

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