05-27-2006, 03:18 AM
Now I'm no genius, but basics of cryptography is to try the simplist methods first. For anyone who's interested, here you go. Use UNDO as the input_string to undo something, and ESC to quit:
Turn Write_To_File = true to write your decrypt to file.
NOTE: This does not support switching more than one character in one move. I'm pretty sure you'd want to use MID for that and I don't use MID.
Turn Write_To_File = true to write your decrypt to file.
NOTE: This does not support switching more than one character in one move. I'm pretty sure you'd want to use MID for that and I don't use MID.
Code:
Const false = 0, true = not false
'Dim your Variables Here:
dim counter = 0
dim write_to_file as integer 'If this is true, then it will write the text to a file:
write_to_file = true
dim a as string
dim b(0 to 25) as string
'Put the Crytext into a string:
A = "GY QSS ZIT YGKXD DTDWTKL ITKT, DQFN QKT ESTCTK TFGXUI ZG YOUXKT ZIOL GXZ. QUQDTDFXL OL HQKZOEXSQKSN UGGR QZ ZIOL LGKZ GY ZIOFU, QFR LG O'D WTZZOFU ZIQZ IT VOSS VOF ZIOL EGDHG. UGGR SXEA ZG QSS, QFR OY NGX QKT ZIOL YQK QSGFU, EGFUKQZL, NGX IQCT OZ!"
B(0) = A
dim a_save(0 to len(a)) as integer
'The Variables for the Input and Replace:
Dim Input_String as string
Dim Replace_String as String
do
'Clear the Screen and Print the text:
cls
Print A
'Input, the string you want to replace:
Input "Which letter will you replace? ", Input_String
'If the string is UNDO then undo:
if ucase$(input_string) = "UNDO" then
'If it's legal to do so, go back one step:
if counter > 0 then
counter -= 1
end if
A = B(counter)
'If the String isn't undo, then add to the changes made:
else
If ucase$(Input_String) = "ESC" then
If write_to_file = true then
open "Cryptext.txt" for output as #1
Print #1, A
Close #1
end if
end
end if
counter += 1
'What do you want to replace your string with?
Input "Replace With What? ", Replace_String
'Replace all characters of Input_string with your Replace_String
for do_text = 0 to len(a) - 1
'If A, character do_text is equivalent to Input_String, replace with ReplaceString:
if a[do_text] = asc(input_string) then
if a_save(do_text) = false then
a[do_text] = asc(Replace_string)
a_save(do_text) = true
end if
end if
next
end if
'Make the undo_string = A:
B(counter) = A
If write_to_file = true then
open "Cryptext.txt" for output as #1
Print #1, A
Close #1
end if
loop