crypt.rb
rbmud-0.2/lib/crypt.rb · 427 B
From the archive RbMUD-0.2.tar.bz2
Download the archive « Back to the archive contents
#!/usr/local/bin/ruby
# $Revision: 1.2 $
# $Date: 2003/12/04 22:18:34 $
# $Author: mikeman2 $
#256 bit encryption
#newmain/crypt.dat must be a 64bit hex string
require 'aes' #http://aescrypt.sf.net
C = AES.new
C.set_key(File.open("crypt.dat", "r").gets.chomp)
class String
def encrypt
if self.length > 15
return nil
end
str = self
while str.length < 16
str = str + " "
end
return C.encrypt(str)
end
end