If anyone desires it, it's for the newly updated database encryption WhatsApp uses to store chat history/data.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenSSL.Crypto;
using System.IO;
namespace WhatsappDecrypt
{
class Decrypt
{
static byte[] key = { 141, 75, 21, 92, 201, 255, 129, 229, 203, 246, 250, 120, 25, 54, 106, 62, 198, 33, 166, 86, 65, 108, 215, 147 };
static byte[] iv = { 0x1E, 0x39, 0xF3, 0x69, 0xE9, 0xD, 0xB3, 0x3A, 0xA7, 0x3B, 0x44, 0x2B, 0xBB, 0xB6, 0xB0, 0xB9 };
public void Run()
{
//Create cipher.
CipherContext aes = new CipherContext(Cipher.AES_192_CBC);//aes cipher
System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();//md5 crypt
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes("MyMail");//get bytes from input string
byte[] hash = md5.ComputeHash(inputBytes);
//////////////UpdateKey//////////////
for (int i = 0; i < 24; i++)
{
key[i] ^= hash[i & 0xF];
}
/////////////////////////////////////
//Decrypt file and rewrite to new.
byte[] returnedData = aes.Crypt(System.IO.File.ReadAllBytes(@"C:\Users\xxx\Downloads\msgstore.db.crypt5"), key, iv, false);
File.WriteAllBytes(@"C:\Users\xxx\Desktop\recover.db", returnedData);
Console.WriteLine("Ready");
}
}
}