1
0
mirror of https://github.com/fumiama/tienyik.git synced 2026-06-04 23:10:26 +08:00

feat: add log & supporting packages

This commit is contained in:
源文雨
2025-10-30 23:23:45 +08:00
parent 617fc662c5
commit 15fcc9a338
19 changed files with 672 additions and 12 deletions

8
aes.go
View File

@@ -10,9 +10,9 @@ const (
ETPYE_AES_CBC = "2"
)
type TYAES [32]byte
type AES [32]byte
func NewTYAES(rawKey []byte) (tya TYAES) {
func NewAES(rawKey []byte) (tya AES) {
if len(rawKey) != 32 {
panic("len(key) must == 32")
}
@@ -40,7 +40,7 @@ func pkcs7Unpadding(data []byte) []byte {
return data[:len(data)-padding]
}
func (tya TYAES) Encrypt(b []byte) []byte {
func (tya AES) Encrypt(b []byte) []byte {
blk, err := aes.NewCipher(tya[:])
if err != nil {
panic(err)
@@ -55,7 +55,7 @@ func (tya TYAES) Encrypt(b []byte) []byte {
return ciphertext
}
func (tya TYAES) Decrypt(b []byte) ([]byte, error) {
func (tya AES) Decrypt(b []byte) ([]byte, error) {
blk, err := aes.NewCipher(tya[:])
if err != nil {
return nil, err