MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Recover lost PGP passphrase with Mathematica! (Done)

  • To: mathgroup at
  • Subject: [mg127341] Recover lost PGP passphrase with Mathematica! (Done)
  • From: Murta <rodrigomurtax at>
  • Date: Wed, 18 Jul 2012 01:39:12 -0400 (EDT)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

Hi all!
Long time ago, I have made one PGP key with one big passphrase that I have 
forgot. I just know some words of it, and could remember that I have mixed 
some Portuguese with German and English in it.
Just for hobby, I tried to break up it using Mathematica, and I get a positive result!..
To do it you'll need to use a Mac with the free GPG installed (GnuPG).
You will need just to save the testFile.gpg (cryptographed with the lost passphase key) in your notebook directory and create a possibility list with some clues of your lost passphrase.
I find my in almost 50.000 combinations!.. (10 minutes)

Don't forget that is necessary to save the notebook before run, it need you r notebook directory (copy and paste do not work)
There is the code,

(*Function to create combinations of words*)
	$frases=StringJoin@@Riffle[#," "]&/@$frases

(*Testing 1 Phrase*)
		count:=Length@ReadList["!ls  '"<>path<>"'",Record];
		string="! /usr/local/bin/gpg --batch -q -o '@path/outputRand.txt' --passphrase '@pass' --decrypt  '@path/@fileName'";
		string=StringReplace[string,{"@pass"-> pass,"@path/"-> path,"@fileName" -> fileName,"outputRand"-> ToString@RandomInteger[10^6]}];

(*Tests each combination*)
	If[Length[return]==0,return,"passphrase not found"]
(*Nice progress bar*)
pBar=Dynamic[Row[{ProgressIndicator[i,{0,qtd}]," ",NumberForm[100. i/qtd,{\[Infinity],2}],"% "}]];

(*Using the code*)
(*list of possible words*)

(*creating list of combinations*)

(*testing it!*)

(*the function will print the file if it find it..*)

Good luck if you need it!

  • Prev by Date: Re: Differential Equation: Not getting result
  • Next by Date: Re: Differential Equation: Not getting result
  • Previous by thread: Evaluating complicated integral numerically
  • Next by thread: NDSolve with NIntegrate where Integral is a function of x