Skip to content

Instantly share code, notes, and snippets.

@msg7086
Created October 3, 2016 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msg7086/456b25de5bd209ebb98836b8214bd62a to your computer and use it in GitHub Desktop.
Save msg7086/456b25de5bd209ebb98836b8214bd62a to your computer and use it in GitHub Desktop.
require 'digest'
md5 = '3bed22f7f496e84b035a996522baa7594c27c7e5718a78bfddf9012904b70eb755d67f90c8de149ead7ee674b024f38c216642030c2d54cb1dd657dd66342c99c239f3c31fd399fc052a9b7861f2073d2b9f47811dd77fd544d570c34bf5f349d110389979571714694a5054238465ca38ba26c25fb1a32b4d0a3b93666b09b3'
prefix = Digest::MD5.hexdigest 'v2ex'
str = ''
md5.scan(/.{32}/) { |m| str += [*'0'..'9',*'A'..'Z',*'a'..'z'].find { |s| Digest::MD5.hexdigest(prefix + str + s + Digest::MD5.hexdigest(str + s)) == m } }
puts str #=> csdaixie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment