Skip to content

Instantly share code, notes, and snippets.

@Pldare
Created August 13, 2021 21:19
Show Gist options
  • Save Pldare/7c5b33579b5cff7ec03ecd4fbc97dc1c to your computer and use it in GitHub Desktop.
Save Pldare/7c5b33579b5cff7ec03ecd4fbc97dc1c to your computer and use it in GitHub Desktop.
touhu game android global-metadata decrypt
using System;
using System.IO;
namespace Globalmeta{
class Globalmetadec{
public static void Main(string[] argv){
using (FileStream fs=new FileStream(argv[0],FileMode.Open)) {
using (BinaryReader bs=new BinaryReader(fs)) {
byte[] pwd=new byte[]{0x75,0xCD,0xB2,0xCF,0x19,0xDB,0x08,0x3F};
byte[] header=new byte[]{0xAF,0x1B,0xB1,0xFA,0x18,0x00,0x00,0x00,0x08,0x01,0x00,0x00};
byte[] use_pwd=new byte[8];
byte[] buffer=new byte[fs.Length];
for (int i = 0; i < header.Length; i++) {
buffer[i]=header[i];
}
fs.Position=header.Length;
for (int i = header.Length; i < (fs.Length); i++) {
buffer[i]=(byte)(bs.ReadByte()^pwd[(i-header.Length)%(pwd.Length)]);
}
File.WriteAllBytes(argv[0]+".dec",buffer);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment