refactor(crypto): use IV as a constant

This commit is contained in:
Mathis Maquenne
2025-05-07 20:57:12 +02:00
parent 67af80403b
commit ebfb312718
4 changed files with 13 additions and 26 deletions
+3 -1
View File
@@ -8,6 +8,8 @@ import (
"golang.org/x/crypto/blowfish"
)
var iv = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}
func GetKey(secretKey, songID string) []byte {
hash := md5.Sum([]byte(songID))
hashHex := fmt.Sprintf("%x", hash)
@@ -20,7 +22,7 @@ func GetKey(secretKey, songID string) []byte {
return key
}
func Decrypt(data, key, iv []byte) ([]byte, error) {
func Decrypt(data, key []byte) ([]byte, error) {
block, err := blowfish.NewCipher(key)
if err != nil {
return nil, err