Skip to content
This repository
Browse code

Tcl

  • Loading branch information...
commit b2867cfb4220da57d11bca6184caf4ce2be80ffc 1 parent 069ead9
Elliott Kember authored

Showing 1 changed file with 18 additions and 0 deletions. Show diff stats Hide diff stats

  1. +18 0 tcl.tcl
18 tcl.tcl
... ... @@ -0,0 +1,18 @@
  1 +package require Tcl 8.5
  2 +package require md5 2
  3 +
  4 +
  5 +set digits {0 1 2 3 4 5 6 7 8 9 A B C D E F}
  6 +
  7 +# any init will do
  8 +set hx [::md5::md5 -hex {}]
  9 +
  10 +while 1 {
  11 + set hy [::md5::md5 -hex $hx]
  12 + if {$hx eq $hy} break
  13 + # bernoulli-like shift with random last hex
  14 + set idx [expr {int(floor(16*rand()))}]
  15 + set hx [string range $hx 1 end][lindex $digits $idx]
  16 +}
  17 +
  18 +puts "Found it! It is '$hx'"

0 comments on commit b2867cf

Please sign in to comment.
Something went wrong with that request. Please try again.