SHOW:
|
|
- or go back to the newest paste.
| 1 | - | private static Random Cunt = new Random(); |
| 1 | + | //Thanks to the guest who posted this - but we can do without the swearing ( )o( )... |
| 2 | - | private static string Shorten(string input) |
| 2 | + | |
| 3 | - | {
|
| 3 | + | private static Random rnd = new Random(); |
| 4 | - | char[] Fuck = "ABCDEFGHIJKLMNOPQRSTUVWXQY123456789!@#$%^&*()".ToCharArray(); |
| 4 | + | private static string Shorten(string input) |
| 5 | - | for (int i = 0; i < 5; i++) |
| 5 | + | {
|
| 6 | - | input += Fuck[Cunt.Next(0, Fuck.Length)]; |
| 6 | + | char[] arr = "ABCDEFGHIJKLMNOPQRSTUVWXQY123456789!@#$%^&*()".ToCharArray(); |
| 7 | - | MD5CryptoServiceProvider x = new MD5CryptoServiceProvider(); |
| 7 | + | for (int i = 0; i < 5; i++) |
| 8 | - | byte[] bs = System.Text.Encoding.UTF8.GetBytes(input); |
| 8 | + | input += arr[rnd.Next(0, arr.Length)]; |
| 9 | - | bs = x.ComputeHash(bs); |
| 9 | + | MD5CryptoServiceProvider x = new MD5CryptoServiceProvider(); |
| 10 | - | System.Text.StringBuilder s = new System.Text.StringBuilder(); |
| 10 | + | byte[] bs = System.Text.Encoding.UTF8.GetBytes(input); |
| 11 | - | foreach (byte b in bs) |
| 11 | + | bs = x.ComputeHash(bs); |
| 12 | - | s.Append(b.ToString("x2").ToLower());
|
| 12 | + | System.Text.StringBuilder s = new System.Text.StringBuilder(); |
| 13 | - | return s.ToString().Remove(s.Length / + 5); |
| 13 | + | foreach (byte b in bs) |
| 14 | - | } |
| 14 | + | s.Append(b.ToString("x2").ToLower());
|
| 15 | return s.ToString().Remove(s.Length / + 5); | |
| 16 | } |