Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved into folders

  • Loading branch information...
commit 0d3437ed1453451d3ddfadc38192e0f0096993c2 1 parent b2867cf
Elliott Kember authored
7 README
View
@@ -0,0 +1,7 @@
+Welcome to the Kember Identity script pool.
+
+I've had so many entries that I've decided to put everything on GitHub.
+
+Some of the scripts suck, and some are awesome. You can create your own using the rough syntax language-firstname-lastname.extension.
+
+This should help for benchmarking.
0  csharp → c-sharp/csharp-Jaco-Pretorius.cs
View
File renamed without changes
80 c-sharp/csharp-Jostein-Kjønigsen.cs
View
@@ -0,0 +1,80 @@
+using System;
+using System.Text;
+using System.Security.Cryptography;
+
+namespace HashIdentityString
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ int seed;
+
+ if (args.Length != 1 || false == int.TryParse(args[0], out seed))
+ {
+ seed = 0;
+ }
+
+ Console.WriteLine("Initial seed: {0}", seed);
+
+ while (true)
+ {
+ string testee = check(seed);
+ seed++;
+
+ if (seed%100000 == 0)
+ {
+ Console.WriteLine("Current seed: {0}, '{1}'", seed, testee);
+ }
+ }
+ }
+
+ static string check(int seed)
+ {
+ string testee = getTestee(seed);
+
+ byte[] tmpSource = ASCIIEncoding.ASCII.GetBytes(testee);
+ byte[] tmpHash = new MD5CryptoServiceProvider().ComputeHash(tmpSource);
+ string hashString = bytesToHex(tmpHash);
+
+ if (hashString == testee)
+ {
+ Console.WriteLine("Match found for seed {0} = '{1}' => '{2}'", seed, testee, hashString);
+ Console.ReadLine();
+ }
+
+ return testee;
+ }
+
+ static string getTestee(int seed)
+ {
+ string alphabet = "0123456789abcdef";
+
+ Random r = new Random(seed);
+ StringBuilder sb = new StringBuilder();
+
+ int length = 32;
+
+ for (int i = 0; i < length; i++)
+ {
+ int charNum = r.Next(alphabet.Length);
+ sb.Append(alphabet[charNum]);
+ }
+
+ return sb.ToString();
+ }
+
+ static string bytesToHex(byte[] bytes)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ foreach (byte b in bytes)
+ {
+ sb.AppendFormat("{0:x2}", b);
+ }
+
+ return sb.ToString();
+ }
+
+ }
+}
0  coldfusion.cf → coldfusion/coldfusion.cf
View
File renamed without changes
0  erlang → erlang/erlang
View
File renamed without changes
0  groovy → groovy/groovy
View
File renamed without changes
0  haskell.hs → haskell/haskell.hs
View
File renamed without changes
0  io → io/io
View
File renamed without changes
0  java.java → java/java.java
View
File renamed without changes
0  javascript.js → javascript/javascript.js
View
File renamed without changes
0  lua → lua/lua
View
File renamed without changes
0  perl.pl → perl/perl.pl
View
File renamed without changes
0  php.php → php/php.php
View
File renamed without changes
0  python.py → python/python.py
View
File renamed without changes
0  ruby.rb → ruby/ruby.rb
View
File renamed without changes
0  scala → scala/scala
View
File renamed without changes
0  scheme → scheme/scheme
View
File renamed without changes
18 tcl.tcl
View
@@ -1,18 +0,0 @@
-package require Tcl 8.5
-package require md5 2
-
-
-set digits {0 1 2 3 4 5 6 7 8 9 A B C D E F}
-
-# any init will do
-set hx [::md5::md5 -hex {}]
-
-while 1 {
- set hy [::md5::md5 -hex $hx]
- if {$hx eq $hy} break
- # bernoulli-like shift with random last hex
- set idx [expr {int(floor(16*rand()))}]
- set hx [string range $hx 1 end][lindex $digits $idx]
-}
-
-puts "Found it! It is '$hx'"
13 tcl/tcl.tcl
View
@@ -0,0 +1,13 @@
+package require md5 2
+set digits {0 1 2 3 4 5 6 7 8 9 A B C D E F}
+
+# any init will do
+set hx [::md5::md5 -hex {}]
+
+while {$hx ne [::md5::md5 -hex $hx]} {
+ # bernoulli-like shift with random last hex-digit
+ set idx [expr {int(floor(16*rand()))}]
+ set hx [string range $hx 1 end][lindex $digits $idx]
+}
+
+puts "Found it! It is '$hx'"
Please sign in to comment.
Something went wrong with that request. Please try again.