Created
January 14, 2012 16:53
-
-
Save itsbth/1612023 to your computer and use it in GitHub Desktop.
Uploaded by UploadToGist for Sublime Text 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Linq; | |
| class FuskareCannotIntoEncryption { | |
| static void Main() { | |
| var pw = System.Text.Encoding.UTF8.GetBytes("hunter2"); | |
| var key = System.Text.Encoding.UTF8.GetBytes("this is a a key"); | |
| var dat = pw.Select((c, i) => (byte)(c ^ (i % key.Length))).ToArray<byte>(); | |
| var ot = System.Convert.ToBase64String(dat); | |
| System.Console.WriteLine(ot); | |
| var it = System.Convert.FromBase64String(ot); | |
| var npw = System.Text.Encoding.UTF8.GetString(it.Select((c, i) => (byte)(c ^ (i % key.Length))).ToArray()); | |
| System.Console.WriteLine(npw); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment