1,048 bytes added
, 00:28, 13 June 2017
'''.mux files''' are encrypted .ogg files and are typically used for custom track music. They use a simple, custom stream cipher based on a 16-byte key (a very long key is generated from the 16-byte key, and then every byte of the input file is xor'd with the corresponding byte in the long key).
== File layout ==
byte magic[9] = "NadeoFile"
byte version = 1
int32 keySalt
byte data[]
== Decryption ==
First, the 16-byte decryption key is determined as follows:
key = md5(pack(keySalt) + "Hello,hack3r!") // Hello, d3veloper:)
where pack() returns the bytes of its argument in little endian order, and the string is encoded as ASCII.
Then, the data is decrypted as follows:
void Decrypt(byte[] data)
{
for (int i = 0; i < data.Length; i++)
{
data[i] ^= GetKeyStreamByte(i);
}
}
byte GetKeyStreamByte(int pos)
{
return rol(key[pos % 16], (pos / 17) % 8);
}
byte rol(byte input, int amount)
{
return (byte)((input << amount) | (input >> (8 - amount)));
}
[[Category:File formats]]