mirror of
https://git.um-react.app/um/cli.git
synced 2026-11-25 23:06:58 +00:00
Init Project
This commit is contained in:
6 files changed
+143
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package utils
|
||||
|
||||
import "crypto/aes"
|
||||
|
||||
func PKCS7UnPadding(encrypt []byte) []byte {
|
||||
length := len(encrypt)
|
||||
unPadding := int(encrypt[length-1])
|
||||
return encrypt[:(length - unPadding)]
|
||||
}
|
||||
|
||||
func DecryptAes128Ecb(data, key []byte) []byte {
|
||||
cipher, _ := aes.NewCipher(key)
|
||||
decrypted := make([]byte, len(data))
|
||||
size := 16
|
||||
for bs, be := 0, size; bs < len(data); bs, be = bs+size, be+size {
|
||||
cipher.Decrypt(decrypted[bs:be], data[bs:be])
|
||||
}
|
||||
return decrypted
|
||||
}
|
||||
Reference in new issue
Block a user