endecrypt

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

README

Instalation

go get github.com/gilang-as/endecrypt

Example

package main

import (
	"github.com/gilang-as/endecrypt"
	"fmt"
)

func main() {
	SecretKey := "ExampleSecretKey123!!!"
	SecretIV := "ExampleSecretIV000!!!!."
	a := endecrypt.EndecryptConfig(SecretKey, SecretIV)

	plainText := "Hello World"
	fmt.Println("Before Encrypt : ", plainText)

	cipherText := a.Encrypt(plainText)
	fmt.Println("After Encrypt : ", cipherText)

	decrypt := a.Decrypt(cipherText)
	fmt.Println("After Decrypt : ", decrypt)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHash added in v0.0.2

func CreateHash(key string) string

func GenerateAesKey added in v0.0.2

func GenerateAesKey() string

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int) []byte

func PKCS5UnPadding

func PKCS5UnPadding(src []byte) []byte

Types

type Aes added in v0.0.2

type Aes interface {
	Encrypt(plainText string) string
	Decrypt(cipherText string) string
}

func AesConfig added in v0.0.2

func AesConfig(Passphrase string) Aes

type EncryptDecrypt

type EncryptDecrypt interface {
	Encrypt(plainText string) string
	Decrypt(cipherText string) string
}

func EndecryptConfig

func EndecryptConfig(SecretKey string, SecretIV string) EncryptDecrypt

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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