encrypter

package
v2.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 6 Imported by: 0

README

Encrypter

Usage

package main

import "github.com/go-kratos-ecosystem/components/v2/encrypter"

func main() {
	e := encrypter.New("EAFBSPAXDCIOGRUVNERQGXPYGPNKYATM")

	ciphertext, _ := e.Encrypt("test")
	plaintext, _ := e.Decrypt(ciphertext)

	println(ciphertext, plaintext) // I-UVz6tds3MlRX-1afR36cLcmMw= test
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encrypter

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

func New

func New(key string) *Encrypter

func (*Encrypter) Decrypt

func (e *Encrypter) Decrypt(value string) (string, error)

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(value string) (string, error)

Jump to

Keyboard shortcuts

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