symmetric

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Des3ECBDecrypt

func Des3ECBDecrypt(key []byte, text []byte) ([]byte, error)
Example
package main

import (
	"encoding/base64"
	"fmt"
	"github.com/sechelper/crypto/symmetric"
)

func main() {
	key := []byte("012345678901234567890123") // 24-byte key for 3DES
	encrypt, _ := base64.StdEncoding.DecodeString("6Dxl7vNNWD4G2sGt6JN1RA==")
	decrypt, err := symmetric.Des3ECBDecrypt(key, encrypt)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(decrypt))
}
Output:

func Des3ECBEncrypt

func Des3ECBEncrypt(key []byte, text []byte) ([]byte, error)
Example
package main

import (
	"encoding/base64"
	"fmt"
	"github.com/sechelper/crypto/symmetric"
)

func main() {
	key := []byte("012345678901234567890123") // 24-byte key for 3DES

	plaintext := []byte("Hello, Secself!") // Plaintext to encrypt
	encrypt, err := symmetric.Des3ECBEncrypt(key, plaintext)
	if err != nil {
		panic(err)
	}

	fmt.Println(base64.StdEncoding.EncodeToString(encrypt))

}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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