refactor: hardcode secret key in crypto package

This commit is contained in:
Mathis Maquenne
2026-03-01 21:57:38 +01:00
parent 650d578b80
commit cf699834f6
3 changed files with 9 additions and 12 deletions
+7 -3
View File
@@ -8,13 +8,17 @@ import (
"golang.org/x/crypto/blowfish"
)
var iv = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
var (
iv = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
secretKey = []byte("g4el58wc0zvf9na1")
)
func GetKey(secretKey, songID string) []byte {
func GetKey(songID string) []byte {
hash := md5.Sum([]byte(songID))
hashHex := hex.EncodeToString(hash[:])
key := []byte(secretKey)
key := make([]byte, len(secretKey))
copy(key, secretKey)
for i := 0; i < len(hash); i++ {
key[i] = key[i] ^ hashHex[i] ^ hashHex[i+16]
}