crypter

package
v0.0.0-...-47adacd Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const CRYPTER_KEY = "ServerName" + "@2025"

服务名称+salt

Variables

This section is empty.

Functions

This section is empty.

Types

type AESCrypter

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

AESCrypter 使用AES进行对称加密

func NewAESCrypter

func NewAESCrypter(key []byte) *AESCrypter

NewAESCrypter 创建新的AES加密器

func (*AESCrypter) Decrypt

func (a *AESCrypter) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt 使用AES解密数据

func (*AESCrypter) Encrypt

func (a *AESCrypter) Encrypt(plaintext []byte) ([]byte, error)

Encrypt 使用AES加密数据

type ECCCrypter

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

ECCCrypter 使用ECDH进行密钥交换和加密

func NewECCCrypter

func NewECCCrypter() (*ECCCrypter, error)

NewECCCrypter 创建新的ECC加密器

func (*ECCCrypter) Decrypt

func (c *ECCCrypter) Decrypt(cryptoText string) (string, error)

Decrypt 使用ECC私钥解密数据

func (*ECCCrypter) Encrypt

func (c *ECCCrypter) Encrypt(plaintext string) (string, error)

Encrypt 使用ECC公钥加密数据

func (*ECCCrypter) GetPublicKeyBase64

func (c *ECCCrypter) GetPublicKeyBase64() string

GetPublicKeyBase64 返回公钥的Base64编码

func (*ECCCrypter) SetPublicKeyBase64

func (c *ECCCrypter) SetPublicKeyBase64(publicKeyBase64 string) error

SetPublicKeyBase64 设置公钥

type HybridCrypter

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

HybridCrypter 混合加密器

func InitHybridCrypter

func InitHybridCrypter() *HybridCrypter

func NewHybridCrypter

func NewHybridCrypter(keyPath string) (*HybridCrypter, error)

NewHybridCrypter 创建混合加密器

func (*HybridCrypter) Decrypt

func (h *HybridCrypter) Decrypt(ciphertext string) (string, error)

Decrypt 解密密文

func (*HybridCrypter) Encrypt

func (h *HybridCrypter) Encrypt(plaintext string) (string, error)

Encrypt 加密明文

type KeyFile

type KeyFile struct {
	PrivateKey string `json:"private_key"`
	AESKey     string `json:"aes_key"`
}

KeyFile 密钥文件结构

type SHA384Crypter

type SHA384Crypter struct {
	// contains filtered or unexported fields
}
var Instance *SHA384Crypter

func NewSHA384Crypter

func NewSHA384Crypter(key string) *SHA384Crypter

NewSHA384Crypter 创建新的 SHA-384 加密器

func (*SHA384Crypter) Encrypt

func (c *SHA384Crypter) Encrypt(password string) string

Encrypt 使用 HMAC-SHA-384 加密密码

func (*SHA384Crypter) Verify

func (c *SHA384Crypter) Verify(password, encryptedPassword string) bool

Verify 验证密码是否匹配加密值

Jump to

Keyboard shortcuts

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