Skip to content

Instantly share code, notes, and snippets.

View alexlanghart's full-sized avatar
👊

Alex Langhart alexlanghart

👊
View GitHub Profile
@alexlanghart
alexlanghart / undecrypt.py
Created November 4, 2022 15:07
Un-decrypt a veracrypt drive that was accidentally decrypted twice
# Author: Alex Langhart
# This script "un-decrypts" a veracrypt drive that was accidentally decrypted twice.
# The veracrypt recovery disk allows the user to decrypt twice, but offers no way
# to un-decrypt it, hence the need for this script. Re-encrypting the drive using
# the standard process wouldn't work because it generates new random salts.
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
import os
from cryptography.hazmat.primitives.ciphers import (
Cipher, algorithms, modes

Keybase proof

I hereby claim:

  • I am alexlanghart on github.
  • I am alexlanghart (https://keybase.io/alexlanghart) on keybase.
  • I have a public key ASD8Km5S5SCvcf9xJOGwuHdKGXP5GgMVmtsWmPrBakNIOgo

To claim this, I am signing this object: