Nytro Posted August 10, 2009 Report Posted August 10, 2009 Credit to protos the autor of this coderequire 'digest/md5'require 'digest/sha1'require 'base64'require 'tk' root= TkRoot.new() {title "Encripter By pRotos"} TkLabel.new(root) { text "Palabra a Encriptar" pack { padx 20 ; pady 20; side 'top' } } palabra = TkVariable.new() TkEntry.new(root) { textvariable(palabra) pack() } TkLabel.new(root) { text " MD5" pack ("side"=>"bottom") } md5 = TkText.new(root) { width 25; height 2 }.pack("side"=>"bottom") TkLabel.new(root) { text "SHA1" pack ('side'=> 'bottom') } sha = TkText.new(root) { width 25; height 2 }.pack("side"=>"bottom") TkLabel.new(root) { text "Base64" pack ( 'side'=> 'bottom' ) } b64 = TkText.new(root) { width 25; height 2 }.pack("side"=>"bottom") TkButton.new(root) { text " Encripta" command proc { amd5 = Digest::MD5.hexdigest(palabra.value) asha1 = Digest::SHA1.hexdigest(palabra.value) ab64 = Base64.encode64(palabra.value) puts " _MD5_", amd5 puts " _SHA1_", asha1 puts " _Base64_", ab64 md5.insert('end', amd5) sha.insert('end', asha1) b64.insert('end', ab64) } pack("side"=>"top") } TkButton.new(root) { text " Clear " command proc { md5.clear sha.clear b64.clear } pack("side"=>"bottom") } Tk.mainloop() Quote