Created
June 21, 2011 16:05
-
-
Save nickh/1038190 to your computer and use it in GitHub Desktop.
10 million collision-free 10-digit tracking hashes
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
| require 'digest/sha1' | |
| module TrackingHash | |
| def tracking_hash | |
| Digest::SHA1.hexdigest(known_collisions[self.id] || id.to_s)[0..9] unless self.id.nil? | |
| end | |
| private | |
| def known_collisions | |
| { | |
| 8540885 => "collides with 130586", 9631939 => "collides with 290888", 5418678 => "collides with 435366", | |
| 7459308 => "collides with 537035", 8859459 => "collides with 853304", 6840401 => "collides with 1003621", | |
| 8770509 => "collides with 1160440", 5964937 => "collides with 1220655", 8661578 => "collides with 1426323", | |
| 6406402 => "collides with 1439617", 4596223 => "collides with 1578699", 8306637 => "collides with 2034254", | |
| 5061350 => "collides with 2036590", 6525270 => "collides with 2061224", 9896386 => "collides with 2272396", | |
| 3886555 => "collides with 2283370", 6082495 => "collides with 2282794", 6378154 => "collides with 2295511", | |
| 3768367 => "collides with 2404582", 5703663 => "collides with 2579637", 5419597 => "collides with 2701649", | |
| 5506774 => "collides with 3036179", 9432960 => "collides with 3844337", 4896463 => "collides with 4004847", | |
| 8919454 => "collides with 4110879", 7847657 => "collides with 4115836", 7059335 => "collides with 4132886", | |
| 9456076 => "collides with 4983686", 9056522 => "collides with 5244769", 9520585 => "collides with 5569919", | |
| 7708313 => "collides with 6088242", 8616912 => "collides with 6089429", 7616645 => "collides with 6539636", | |
| 8362893 => "collides with 6684619", 8859787 => "collides with 6925873", 8127242 => "collides with 6959629", | |
| 8839998 => "collides with 7095601", 7188426 => "collides with 7140136", 9834507 => "collides with 8001594", | |
| 9966141 => "collides with 8238833", 9576694 => "collides with 8278246", 9625264 => "collides with 9139504" | |
| } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment