# crypt1.tcl - Simple Encryption # (Should the length of the string be veiled?) # 12.02.2007 © M.Hoffmann package provide crypt1 0.1 package require rc4; # tcllib; für Kennwortschlüsselung namespace eval crypt1 { variable key [binary format H* 83840200ffeb0e8db360068a02c381c4e8435f5ee9] proc encrypt in { return [rc4::rc4 -hex -key $::crypt1::key $in ] } proc decrypt in { return [rc4::rc4 -key $::crypt1::key [binary format H* $in]] } namespace export * }
# crypt1_test.tcl - Simple Encryption Tests # 12.02.2007 © M.Hoffmann lappend auto_path [pwd]; package require crypt1; namespace import crypt1::* puts "Key (empty = default):" gets stdin key if {[string length $key]} { set ::crypt1::key $key } puts "Key: $::crypt1::key" puts "String to encrypt:" gets stdin str puts "String: '$str'" set eStr [encrypt $str] puts "Ecrypted String: '$eStr'" puts "And this string decrypted again: '[decrypt $eStr]'"
Question to myself: