1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

refactor: rename files *_util.go to *_internal.go

This commit is contained in:
dudaodong
2022-02-19 21:51:58 +08:00
parent 4e7274ce05
commit 41685022c0
6 changed files with 0 additions and 407 deletions

View File

@@ -1,37 +0,0 @@
package cryptor
import "bytes"
func generateAesKey(key []byte) []byte {
genKey := make([]byte, 16)
copy(genKey, key)
for i := 16; i < len(key); {
for j := 0; j < 16 && i < len(key); j, i = j+1, i+1 {
genKey[j] ^= key[i]
}
}
return genKey
}
func generateDesKey(key []byte) []byte {
genKey := make([]byte, 8)
copy(genKey, key)
for i := 8; i < len(key); {
for j := 0; j < 8 && i < len(key); j, i = j+1, i+1 {
genKey[j] ^= key[i]
}
}
return genKey
}
func pkcs7Padding(src []byte, blockSize int) []byte {
padding := blockSize - len(src)%blockSize
padText := bytes.Repeat([]byte{byte(padding)}, padding)
return append(src, padText...)
}
func pkcs7UnPadding(src []byte) []byte {
length := len(src)
unPadding := int(src[length-1])
return src[:(length - unPadding)]
}