crypto

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKeyLength = errors.New("invalid key length")
View Source
var ZeroIv []byte = []byte{0, 0, 0, 0, 0, 0, 0, 0}

Functions

func DecryptDes

func DecryptDes(data []byte, key []byte) ([]byte, error)

func DecryptTripleDes

func DecryptTripleDes(data []byte, key []byte) ([]byte, error)

func DecryptTripleDesEde2

func DecryptTripleDesEde2(key []byte, data []byte, paddingType PaddingType) ([]byte, error)

func EncryptDes

func EncryptDes(data []byte, key []byte) ([]byte, error)

func EncryptDesCbc

func EncryptDesCbc(data []byte, key []byte) ([]byte, error)

func EncryptTripleDes

func EncryptTripleDes(data []byte, key []byte) ([]byte, error)

func EncryptTripleDesEde2

func EncryptTripleDesEde2(key []byte, data []byte, paddingType PaddingType) ([]byte, error)

func GenerateDesKey

func GenerateDesKey(keyLen int) ([]byte, error)

Generates a DES key, keyLen should be specified in multiple of 8

func RotN

func RotN(n int, val string) string

*

This function rotates the input string by n
(Caesars Cipher)

*

Types

type DesMode

type DesMode int
const (
	Ecb DesMode = iota + 1
	Cbc
)

type PaddingType

type PaddingType int
const (
	Iso9797M1Padding PaddingType = iota + 1
	Iso9797M2Padding
	DesBlockSize = 8
)

func (PaddingType) Pad

func (paddingType PaddingType) Pad(data []byte) []byte

func (PaddingType) RemovePad

func (paddingType PaddingType) RemovePad(paddedData []byte) []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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