crypto

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptString

func DecryptString(ciphertext string, key ...string) (string, error)

DecryptString decrypts a string using either the provided key or the default key

func EncryptString

func EncryptString(plaintext string, key ...string) (string, error)

EncryptString encrypts a string using either the provided key or the default key

func Sha256

func Sha256(b []byte) string

Sha256 计算给定字节切片的 SHA-256 哈希值,并返回其十六进制表示

func Sha256String

func Sha256String(s string) string

Sha256String 计算给定字符串的 SHA-256 哈希值,并返回其十六进制表示

func Sha256WithError

func Sha256WithError(b []byte) (string, error)

Sha256WithError 计算给定字节切片的 SHA-256 哈希值,返回其十六进制表示和可能的错误

Types

type Aes

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

Aes represents an AES encryption/decryption client

func NewAes

func NewAes(key ...string) (*Aes, error)

NewAes creates a new AES client with the given key or uses the default key if not provided

func (*Aes) Decrypt

func (a *Aes) Decrypt(d string) (string, error)

Decrypt decrypts the ciphertext

func (*Aes) Encrypt

func (a *Aes) Encrypt(plaintext string) (string, error)

Encrypt encrypts the plaintext

Jump to

Keyboard shortcuts

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