Generate WEP hex key from plaintext
# 128 bits, duh.
require 'digest/md5'
def pad(text)
v = text * (1 + (64 / text.length))
v[0,64]
end
def wep_key(text)
Digest::MD5.hexdigest(pad(text))
end
DZone Snippets > automatthew > ruby
12388 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
case Merb::Server.config[:environment] when 'development' # do some stuff when 'production' # do other stuff end