SillyCypher
Posted: Wed Jun 24, 2009 11:35 pm
dim textin as string
object myform as form
myform.Height = 435
myform.Width = 320
myform.Caption = "Silly Cypher Version 1.0"
object input as Richedit
input.Top = 0
input.width = 300
input.HideScrollBars = false
input.ScrollBars = ssBoth
input.WordWrap = false
end object
object mytext1 as edit
mytext1.Top = 100
mytext1.Text = "a"
end object
object mytext2 as edit
mytext2.Top = 125
mytext2.Text = "A"
end object
object mytext3 as edit
mytext3.Top = 150
mytext3.Text = "b"
end object
object mytext4 as edit
mytext4.Top = 175
mytext4.Text = "B"
end object
object mytext5 as edit
mytext5.Top = 200
mytext5.Text = "c"
end object
object mytext6 as edit
mytext6.Top = 225
mytext6.Text = "C"
end object
object mytext7 as edit
mytext7.Top = 250
mytext7.Text = "d"
end object
object mytext8 as edit
mytext8.Top = 275
mytext8.Text = "D"
end object
object output as richedit
output.Top = 300
output.Width = 300
output.ScrollBars = ssvertical
output.ReadOnly = true
end object
object cypher as button
onclick=cypher
left = 200
top = 150
caption="cypher"
end object
object decypher as button
onclick=decypher
left = 200
top = 200
caption="decypher"
end object
object help as button
onclick=helper
left = 200
top = 250
caption="help"
end object
end object
myform.ShowModal
sub cypher(textin as string)
dim counter as integer
dim counter2 as integer
dim a as integer
dim bin as string
dim bin2 as string
dim textout as string
dim words(7) as string
dim bytes(7) as string
textin = ""
textout = ""
bin = ""
bin2=""
counter = 0
counter2=0
a = 0
words(0) = mytext1.Text + " "
words(1) = mytext2.Text + " "
words(2) = mytext3.Text + " "
words(3) = mytext4.Text + " "
words(4) = mytext5.Text + " "
words(5) = mytext6.Text + " "
words(6) = mytext7.Text + " "
words(7) = mytext8.Text + " "
bytes(0) = "000"
bytes(1) = "001"
bytes(2) = "010"
bytes(3) = "011"
bytes(4) = "100"
bytes(5) = "101"
bytes(6) = "110"
bytes(7) = "111"
output.clear
textin = input.Text
for counter = 1 to len(textin)
a = ASC ( mid$(textin,counter,1))
bin = right$("00000000" + bin$(a),8)
bin = "1" + bin
for counter2 = 1 to 9 step 3
bin2 = mid$(bin,counter2,3)
FOR a = 0 TO 7
if bytes(a) = bin2 then textout=textout+words(a)
next
next
next
output.Text = textout
end sub
sub decypher(textin as string)
textin = input.Text
dim words(7) as string
dim bytes(7) as string
dim counter as integer
dim counter2 as integer
dim bin as string
dim text as string
dim a as integer
dim textout as string
textout = ""
bin = ""
text = ""
words(0) = mytext1.Text + " "
words(1) = mytext2.Text + " "
words(2) = mytext3.Text + " "
words(3) = mytext4.Text + " "
words(4) = mytext5.Text + " "
words(5) = mytext6.Text + " "
words(6) = mytext7.Text + " "
words(7) = mytext8.Text + " "
bytes(0) = "000"
bytes(1) = "001"
bytes(2) = "010"
bytes(3) = "011"
bytes(4) = "100"
bytes(5) = "101"
bytes(6) = "110"
bytes(7) = "111"
`print textin
for counter = 1 to len(textin)
text = text+mid$(textin,counter,1)
`print text
if mid$(textin,counter,1)= " " then
for counter2 = 0 to 7
if words(counter2) = text then
bin = bin + bytes(counter2)
`print bin
end if
next
text=""
end if
next
a=0
for counter = 1 to len(bin) step 9
text = mid$(bin,counter,9)
`print text
if mid$(text,2,1) = "1" then a=a+128
if mid$(text,3,1) = "1" then a=a+64
if mid$(text,4,1) = "1" then a=a+32
if mid$(text,5,1) = "1" then a=a+16
if mid$(text,6,1) = "1" then a=a+8
if mid$(text,7,1) = "1" then a=a+4
if mid$(text,8,1) = "1" then a=a+2
if mid$(text,9,1) = "1" then a=a+1
textout=textout+chr$(a)
a=0
next
output.text = textout
end sub
sub helper()
dim cr as string
dim lf as string
cr = chr$(13)
lf = chr$(10)
showmessage "Silly Cypher Version 1.0 By Albert Redditt June 2009 " + cr+lf+ "Enter your message in the top window and click Cypher."+cr+lf+"Tab to or click on output window at bottom." +cr+lf+"Select output with shift and down arrow." +cr+lf+"CTRL-C to copy."+cr+lf+"CTRL-V to paste into another app."+cr+lf+"You can alter the 8 words to suit your needs."+cr+lf+"Copy cyphered text into input box and click on DeCypher."
end sub
object myform as form
myform.Height = 435
myform.Width = 320
myform.Caption = "Silly Cypher Version 1.0"
object input as Richedit
input.Top = 0
input.width = 300
input.HideScrollBars = false
input.ScrollBars = ssBoth
input.WordWrap = false
end object
object mytext1 as edit
mytext1.Top = 100
mytext1.Text = "a"
end object
object mytext2 as edit
mytext2.Top = 125
mytext2.Text = "A"
end object
object mytext3 as edit
mytext3.Top = 150
mytext3.Text = "b"
end object
object mytext4 as edit
mytext4.Top = 175
mytext4.Text = "B"
end object
object mytext5 as edit
mytext5.Top = 200
mytext5.Text = "c"
end object
object mytext6 as edit
mytext6.Top = 225
mytext6.Text = "C"
end object
object mytext7 as edit
mytext7.Top = 250
mytext7.Text = "d"
end object
object mytext8 as edit
mytext8.Top = 275
mytext8.Text = "D"
end object
object output as richedit
output.Top = 300
output.Width = 300
output.ScrollBars = ssvertical
output.ReadOnly = true
end object
object cypher as button
onclick=cypher
left = 200
top = 150
caption="cypher"
end object
object decypher as button
onclick=decypher
left = 200
top = 200
caption="decypher"
end object
object help as button
onclick=helper
left = 200
top = 250
caption="help"
end object
end object
myform.ShowModal
sub cypher(textin as string)
dim counter as integer
dim counter2 as integer
dim a as integer
dim bin as string
dim bin2 as string
dim textout as string
dim words(7) as string
dim bytes(7) as string
textin = ""
textout = ""
bin = ""
bin2=""
counter = 0
counter2=0
a = 0
words(0) = mytext1.Text + " "
words(1) = mytext2.Text + " "
words(2) = mytext3.Text + " "
words(3) = mytext4.Text + " "
words(4) = mytext5.Text + " "
words(5) = mytext6.Text + " "
words(6) = mytext7.Text + " "
words(7) = mytext8.Text + " "
bytes(0) = "000"
bytes(1) = "001"
bytes(2) = "010"
bytes(3) = "011"
bytes(4) = "100"
bytes(5) = "101"
bytes(6) = "110"
bytes(7) = "111"
output.clear
textin = input.Text
for counter = 1 to len(textin)
a = ASC ( mid$(textin,counter,1))
bin = right$("00000000" + bin$(a),8)
bin = "1" + bin
for counter2 = 1 to 9 step 3
bin2 = mid$(bin,counter2,3)
FOR a = 0 TO 7
if bytes(a) = bin2 then textout=textout+words(a)
next
next
next
output.Text = textout
end sub
sub decypher(textin as string)
textin = input.Text
dim words(7) as string
dim bytes(7) as string
dim counter as integer
dim counter2 as integer
dim bin as string
dim text as string
dim a as integer
dim textout as string
textout = ""
bin = ""
text = ""
words(0) = mytext1.Text + " "
words(1) = mytext2.Text + " "
words(2) = mytext3.Text + " "
words(3) = mytext4.Text + " "
words(4) = mytext5.Text + " "
words(5) = mytext6.Text + " "
words(6) = mytext7.Text + " "
words(7) = mytext8.Text + " "
bytes(0) = "000"
bytes(1) = "001"
bytes(2) = "010"
bytes(3) = "011"
bytes(4) = "100"
bytes(5) = "101"
bytes(6) = "110"
bytes(7) = "111"
`print textin
for counter = 1 to len(textin)
text = text+mid$(textin,counter,1)
`print text
if mid$(textin,counter,1)= " " then
for counter2 = 0 to 7
if words(counter2) = text then
bin = bin + bytes(counter2)
`print bin
end if
next
text=""
end if
next
a=0
for counter = 1 to len(bin) step 9
text = mid$(bin,counter,9)
`print text
if mid$(text,2,1) = "1" then a=a+128
if mid$(text,3,1) = "1" then a=a+64
if mid$(text,4,1) = "1" then a=a+32
if mid$(text,5,1) = "1" then a=a+16
if mid$(text,6,1) = "1" then a=a+8
if mid$(text,7,1) = "1" then a=a+4
if mid$(text,8,1) = "1" then a=a+2
if mid$(text,9,1) = "1" then a=a+1
textout=textout+chr$(a)
a=0
next
output.text = textout
end sub
sub helper()
dim cr as string
dim lf as string
cr = chr$(13)
lf = chr$(10)
showmessage "Silly Cypher Version 1.0 By Albert Redditt June 2009 " + cr+lf+ "Enter your message in the top window and click Cypher."+cr+lf+"Tab to or click on output window at bottom." +cr+lf+"Select output with shift and down arrow." +cr+lf+"CTRL-C to copy."+cr+lf+"CTRL-V to paste into another app."+cr+lf+"You can alter the 8 words to suit your needs."+cr+lf+"Copy cyphered text into input box and click on DeCypher."
end sub