I choose complex passwords and I quickly forget them. I save them in rdp files so that I can just click the file and it will automatically log me into a remote desktop connection.
Recently I forgot a password and I really wanted it back. I googled.
Ok, so the data is fake. All zeros does not decode and decrypt to “thisismypassword”. But it works 🙂
The interesting bits are very short after pulling together the p/invoke and hex encode library.
byte bytes =
Utility.HexEncoding.GetBytes( input.Text, out discarded );
System.Text.ASCIIEncoding acsciiencoding = new ASCIIEncoding();
System.Text.UnicodeEncoding lUnicodeEncoding = new UnicodeEncoding();
byte lDecryptedBytes = dataProtector.Decrypt( bytes, null );
string decrypted = Utility.HexEncoding.ToString( lDecryptedBytes );
output.Text = "decrypted:"+decrypted + Environment.NewLine +
"unicode:" + lUnicodeEncoding.GetString( lDecryptedBytes, 0, lDecryptedBytes.Length ) +
"ascii:" + acsciiencoding.GetString( lDecryptedBytes, 0, lDecryptedBytes.Length )
I like it when things are simple.