KashSmith100001

01-12-2013, 05:13 PM

I am trying to write a program in Just Basic to crack a ceasar cipher, by doing a shift of 1 letter, then 2 letters, and on to 26 letters, and output to a text file. The idea is to try every possible cipher, so you can crack any ceasar cipher. I've got it to the point where it should do the 1st shift, the problem is if you input "b", it shows "a", but if you input "bbb", it still only shows "a", I need it to show "aaa", if you know what I mean, please help if you can, I'm pulling my hair out over here! (and thanks!)

dim alpha$(26)

dim alpha1$(26) 'for a one character shift

alpha$(1) = "a"

alpha$(2) = "b"

alpha$(3) = "c"

alpha$(4) = "d"

alpha$(5) = "e"

alpha$(6) = "f"

alpha$(7) = "g"

alpha$(8) = "h"

alpha$(9) = "i"

alpha$(10) = "j"

alpha$(11) = "k"

alpha$(12) = "l"

alpha$(13) = "m"

alpha$(14) = "n"

alpha$(15) = "o"

alpha$(16) = "p"

alpha$(17) = "q"

alpha$(18) = "r"

alpha$(19) = "s"

alpha$(20) = "t"

alpha$(21) = "u"

alpha$(22) = "v"

alpha$(23) = "w"

alpha$(24) = "x"

alpha$(25) = "y"

alpha$(26) = "z"

alpha1$(1) = "b"

alpha1$(2) = "c"

alpha1$(3) = "d"

alpha1$(4) = "e"

alpha1$(5) = "f"

alpha1$(6) = "g"

alpha1$(7) = "h"

alpha1$(8) = "i"

alpha1$(9) = "j"

alpha1$(10) = "k"

alpha1$(11) = "l"

alpha1$(12) = "m"

alpha1$(13) = "n"

alpha1$(14) = "o"

alpha1$(15) = "p"

alpha1$(16) = "q"

alpha1$(17) = "r"

alpha1$(18) = "s"

alpha1$(19) = "t"

alpha1$(20) = "u"

alpha1$(21) = "v"

alpha1$(22) = "w"

alpha1$(23) = "x"

alpha1$(24) = "y"

alpha1$(25) = "z"

alpha1$(26) = "a"

input "Encrypted message:" ; encmsg$

for count = 1 to LEN(encmsg$)

cc$ = MID$(encmsg$, count, 1)

if cc$ = alpha1$(count) then

newmsg1$ = newmsg1$ + alpha$(count)

end if

next count

print newmsg1$

dim alpha$(26)

dim alpha1$(26) 'for a one character shift

alpha$(1) = "a"

alpha$(2) = "b"

alpha$(3) = "c"

alpha$(4) = "d"

alpha$(5) = "e"

alpha$(6) = "f"

alpha$(7) = "g"

alpha$(8) = "h"

alpha$(9) = "i"

alpha$(10) = "j"

alpha$(11) = "k"

alpha$(12) = "l"

alpha$(13) = "m"

alpha$(14) = "n"

alpha$(15) = "o"

alpha$(16) = "p"

alpha$(17) = "q"

alpha$(18) = "r"

alpha$(19) = "s"

alpha$(20) = "t"

alpha$(21) = "u"

alpha$(22) = "v"

alpha$(23) = "w"

alpha$(24) = "x"

alpha$(25) = "y"

alpha$(26) = "z"

alpha1$(1) = "b"

alpha1$(2) = "c"

alpha1$(3) = "d"

alpha1$(4) = "e"

alpha1$(5) = "f"

alpha1$(6) = "g"

alpha1$(7) = "h"

alpha1$(8) = "i"

alpha1$(9) = "j"

alpha1$(10) = "k"

alpha1$(11) = "l"

alpha1$(12) = "m"

alpha1$(13) = "n"

alpha1$(14) = "o"

alpha1$(15) = "p"

alpha1$(16) = "q"

alpha1$(17) = "r"

alpha1$(18) = "s"

alpha1$(19) = "t"

alpha1$(20) = "u"

alpha1$(21) = "v"

alpha1$(22) = "w"

alpha1$(23) = "x"

alpha1$(24) = "y"

alpha1$(25) = "z"

alpha1$(26) = "a"

input "Encrypted message:" ; encmsg$

for count = 1 to LEN(encmsg$)

cc$ = MID$(encmsg$, count, 1)

if cc$ = alpha1$(count) then

newmsg1$ = newmsg1$ + alpha$(count)

end if

next count

print newmsg1$