Permalink
Browse files

uniqid emulator

  • Loading branch information...
1 parent 9ef5958 commit 5f1ba6f16e56523d5dafe81e2b9e18352de1d269 @joernchen committed Apr 6, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 ruby/uniqid.rb
View
10 ruby/uniqid.rb
@@ -0,0 +1,10 @@
+#!/usr/bin/env ruby
+# generate all PHP uniqids for a given second
+
+from = Time.new(ARGV[0].to_i,ARGV[1].to_i,ARGV[2].to_i,ARGV[3].to_i,ARGV[4].to_i,ARGV[5].to_i)
+
+
+0.upto 0xfffff do |i|
+ uniqid = sprintf("%08x%05x",from.tv_sec,i);
+ puts uniqid
+end

0 comments on commit 5f1ba6f

Please sign in to comment.