This commit is contained in:
2026-08-12 20:14:16 +08:00
commit 5039640e4b
39 changed files with 3494 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
module Main where
import qualified Data.ByteString as BS
import Numeric (showHex)
import Data.Word (Word8)
import Qmc.QmcDecryptor (decryptMflac)
fmtHex :: Word8 -> String
fmtHex b = let h = showHex (fromIntegral b :: Int) "" in replicate (2 - length h) '0' ++ h
main :: IO ()
main = do
putStrLn "QMC Haskell — decrypt f:/qqmusic_debug/test_raw.mflac"
ekey <- readFile "f:/qqmusic_debug/test_ekey.txt"
let ekey' = filter (`notElem` "\n\r") ekey
dataBs <- BS.readFile "f:/qqmusic_debug/test_raw.mflac"
case decryptMflac dataBs ekey' of
Left err -> putStrLn $ "ERROR: " ++ err
Right out -> do
let header = BS.take 4 out
if header == BS.pack [0x66, 0x4C, 0x61, 0x43]
then do
putStrLn $ "OK: " ++ show (BS.length out) ++ " bytes, fLaC header verified"
BS.writeFile "f:/qqmusic_debug/decoded_haskell.flac" out
else do
putStrLn $ "BAD HEADER: " ++ concatMap fmtHex (BS.unpack header)
BS.writeFile "f:/qqmusic_debug/decoded_haskell_bad.flac" out