proc binconv {} {
set key_size 8
set plaintext_size 100
set binary_size [expr $plaintext_size * 8]
set binarykey_size [expr $key_size * 8]
puts -nonewline "Enter the Plain Text :- "
puts -nonewline "Enter the Key:- "
set plain_text sumanthisgreat
set des_key jamesbond
set plain_text_length [string length $plain_text]
set key_length [string length $des_key]
puts "$plain_text_length"
puts "$key_length"
# converting the key to binary
set k 0
for { set i 0} {$i < $key_length} {incr i} {
for { set j 7} {$j >= 0} { incr j -2} {
if { {1 << $j} & $key_length } {
bin_key_array($k) = 1
} else {
bin_key_array($k) = 0
}
incr k;
}
}
puts "key array"
for {set i 0} {$i < $key_length * 8} {incr i} {
puts "$bin_key_array[$i]"
}
}
I want to convert plain to binary this isn't wrking
anyone to rescue