encriptar texto

evolution
26 de Abril del 2004
hola señores programadores tengo un problemon es de encriptar me dieron un codigo y es este
es el modulo pero mi problema es como encriptar y desencriptar el texto ocupando 2 botones y que tome 1 la funcion encriptar y el otro desencriptar o si tienen otro codigo mas sencillo porfavor respondan
Option Explicit
Dim a, c, d, e, f, g
Dim b As String
Dim DesTino
Public Sub DeSenCriPtA(DesCript As Variant, DesTino As Variant)
DesTino = ""
a = Mid(DesCript, 3, Len(DesCript))
DesCript = a
For c = 1 To Len(DesCript)
d = Left(DesCript, c)
b = Right(d, 1)
Rem Si en variable b no hay nada , deja el espacio al momento de encriptar !!!
If b = "]" Then
DesTino = DesTino & " "
End If
If b = "?" Then
DesTino = DesTino & "-"
End If
If b = "i" Then
DesTino = DesTino & "."
End If
Rem aqui termina de chequear si en b hay o no lugar !!!
If b = "¤" Then
DesTino = DesTino & "a"
End If
If b = "§" Then
DesTino = DesTino & "b"
End If
If b = "#" Then
DesTino = DesTino & "c"
End If
If b = "¶" Then
DesTino = DesTino & "d"
End If
If b = "&" Then
DesTino = DesTino & "e"
End If
If b = "ô" Then
DesTino = DesTino & "f"
End If
If b = "Æ" Then
DesTino = DesTino & "g"
End If
If b = "ñ" Then
DesTino = DesTino & "h"
End If
If b = "x" Then
DesTino = DesTino & "i"
End If
If b = "þ" Then
DesTino = DesTino & "j"
End If
If b = "µ" Then
DesTino = DesTino & "k"
End If
If b = "n" Then
DesTino = DesTino & "l"
End If
If b = "Y" Then
DesTino = DesTino & "m"
End If
If b = "Ö" Then
DesTino = DesTino & "n"
End If
If b = "_" Then
DesTino = DesTino & "ñ"
End If
If b = "å" Then
DesTino = DesTino & "o"
End If
If b = "ë" Then
DesTino = DesTino & "p"
End If
If b = "î" Then
DesTino = DesTino & "q"
End If
If b = "ì" Then
DesTino = DesTino & "r"
End If
If b = "-" Then
DesTino = DesTino & "s"
End If
If b = "æ" Then
DesTino = DesTino & "t"
End If
If b = "É" Then
DesTino = DesTino & "u"
End If
If b = "ò" Then
DesTino = DesTino & "v"
End If
If b = "û" Then
DesTino = DesTino & "w"
End If
If b = "ä" Then
DesTino = DesTino & "x"
End If
If b = "ø" Then
DesTino = DesTino & "y"
End If
If b = "+" Then
DesTino = DesTino & "z"
End If
If b = " " Then
DesTino = DesTino & b
End If
Rem aqui empezamos a comparar numeros
If b = "<" Then
DesTino = DesTino & "0"
End If
7 If b = "@" Then
DesTino = DesTino & "1"
End If
If b = "D" Then
DesTino = DesTino & "2"
End If
If b = "C" Then
DesTino = DesTino & "3"
End If
If b = "g" Then
DesTino = DesTino & "4"
End If
If b = "o" Then
DesTino = DesTino & "5"
End If
If b = "«" Then
DesTino = DesTino & "6"
End If
If b = "»" Then
DesTino = DesTino & "7"
End If
If b = "!" Then
DesTino = DesTino & "8"
End If
If b = "¼" Then
DesTino = DesTino & "9"
End If
Rem aqui termina la comparacion de los numeros
Rem Aqui empieza a encriptar las letras mayusculas
If b = "Ø" Then
DesTino = DesTino & "A"
End If
If b = "Ä" Then
DesTino = DesTino & "B"
End If
If b = "à" Then
DesTino = DesTino & "C"
End If
If b = "õ" Then
DesTino = DesTino & "D"
End If
If b = "°" Then
DesTino = DesTino & "E"
End If
If b = "÷" Then
DesTino = DesTino & "F"
End If
If b = "±" Then
DesTino = DesTino & "G"
End If
If b = "{" Then
DesTino = DesTino & "H"
End If
If b = "" Then
DesTino = DesTino & "I"
End If
If b = "¥" Then
DesTino = DesTino & "J"
End If
If b = "©" Then
DesTino = DesTino & "K"
End If
If b = "¦" Then
DesTino = DesTino & "L"
End If
If b = "." Then
DesTino = DesTino & "M"
End If
If b = "/" Then
DesTino = DesTino & "N"
End If
If b = "`" Then
DesTino = DesTino & "Ñ"
End If
If b = "Ç" Then
DesTino = DesTino & "O"
End If
If b = "¢" Then
DesTino = DesTino & "P"
End If
If b = "ª" Then
DesTino = DesTino & "Q"
End If
If b = ";" Then
DesTino = DesTino & "R"
End If
If b = "%" Then
DesTino = DesTino & "S"
End If
If b = "ß" Then
DesTino = DesTino & "T"
End If
If b = "Î" Then
DesTino = DesTino & "U"
End If
If b = "Ï" Then
DesTino = DesTino & "V"
End If
If b = "z" Then
DesTino = DesTino & "W"
End If
If b = "u" Then
DesTino = DesTino & "X"
End If
If b = "q" Then
DesTino = DesTino & "Y"
End If
If b = "w" Then
DesTino = DesTino & "Z"
End If
Next c
DesCript = ""

End Sub
Public Sub EnCriPtA(EnCript, DesTino)
DesTino = "~~~"
For c = 1 To Len(EnCript)
d = Left(EnCript, c)
b = Right(d, 1)
Rem Si en variable b no hay nada , deja el espacio al momento de encriptar !!!
If b = " " Then
DesTino = DesTino & "]"
End If
If b = "-" Then
DesTino = DesTino & "?"
End If
If b = "." Then
DesTino = DesTino & "i"
End If

Rem aqui termina de chequear si en b hay o no lugar !!!
Rem Aqui empieza a encriptar las letras minusculas
If b = "a" Then
DesTino = DesTino & "¤"
End If
If b = "b" Then
DesTino = DesTino & "§"
End If
If b = "c" Then
DesTino = DesTino & "#"
End If
If b = "d" Then
DesTino = DesTino & "¶"
End If
If b = "e" Then
DesTino = DesTino & "&"
End If
If b = "f" Then
DesTino = DesTino & "ô"
End If
If b = "g" Then
DesTino = DesTino & "Æ"
End If
If b = "h" Then
DesTino = DesTino & "ñ"
End If
If b = "i" Then
DesTino = DesTino & "x"
End If
If b = "j" Then
DesTino = DesTino & "þ"
End If
If b = "k" Then
DesTino = DesTino & "µ"
End If
If b = "l" Then
DesTino = DesTino & "n"
End If
If b = "m" Then
DesTino = DesTino & "Y"
End If
If b = "n" Then
DesTino = DesTino & "Ö"
End If
If b = "ñ" Then
DesTino = DesTino & "_"
End If
If b = "o" Then
DesTino = DesTino & "å"
End If
If b = "p" Then
DesTino = DesTino & "ë"
End If
If b = "q" Then
DesTino = DesTino & "î"
End If
If b = "r" Then
DesTino = DesTino & "ì"
End If
If b = "s" Then
DesTino = DesTino & "-"
End If
If b = "t" Then
DesTino = DesTino & "æ"
End If
If b = "u" Then
DesTino = DesTino & "É"
End If
If b = "v" Then
DesTino = DesTino & "ò"
End If
If b = "w" Then
DesTino = DesTino & "û"
End If
If b = "x" Then
DesTino = DesTino & "ä"
End If
If b = "y" Then
DesTino = DesTino & "ø"
End If
If b = "z" Then
DesTino = DesTino & "+"
End If
Rem aqui termina con las letras minusculas
Rem aqui empezamos a comparar numeros
If b = "0" Then
DesTino = DesTino & "<"
End If
7 If b = "1" Then
DesTino = DesTino & "@"
End If
If b = "2" Then
DesTino = DesTino & "D"
End If
If b = "3" Then
DesTino = DesTino & "C"
End If
If b = "4" Then
DesTino = DesTino & "g"
End If
If b = "5" Then
DesTino = DesTino & "o"
End If
If b = "6" Then
DesTino = DesTino & "«"
End If
If b = "7" Then
DesTino = DesTino & "»"
End If
If b = "8" Then
DesTino = DesTino & "!"
End If
If b = "9" Then
DesTino = DesTino & "¼"
End If
Rem aqui termina la comparacion de los numeros !!!
Rem Aqui empieza a encriptar las letras mayusculas
If b = "A" Then
DesTino = DesTino & "Ø"
End If
If b = "B" Then
DesTino = DesTino & "Ä"
End If
If b = "C" Then
DesTino = DesTino & "à"
End If
If b = "D" Then
DesTino = DesTino & "õ"
End If
If b = "E" Then
DesTino = DesTino & "°"
End If
If b = "F" Then
DesTino = DesTino & "÷"
End If
If b = "G" Then
DesTino = DesTino & "±"
End If
If b = "H" Then
DesTino = DesTino & "{"
End If
If b = "I" Then
DesTino = DesTino & ""
End If
If b = "J" Then
DesTino = DesTino & "¥"
End If
If b = "K" Then
DesTino = DesTino & "©"
End If
If b = "L" Then
DesTino = DesTino & "¦"
End If
If b = "M" Then
DesTino = DesTino & "."
End If
If b = "N" Then
DesTino = DesTino & "/"
End If
If b = "Ñ" Then
DesTino = DesTino & "`"
End If
If b = "O" Then
DesTino = DesTino & "Ç"
End If
If b = "P" Then
DesTino = DesTino & "¢"
End If
If b = "Q" Then
DesTino = DesTino & "ª"
End If
If b = "R" Then
DesTino = DesTino & ";"
End If
If b = "S" Then
DesTino = DesTino & "%"
End If
If b = "T" Then
DesTino = DesTino & "ß"
End If
If b = "U" Then
DesTino = DesTino & "Î"
End If
If b = "V" Then
DesTino = DesTino & "Ï"
End If
If b = "W" Then
DesTino = DesTino & "z"
End If
If b = "X" Then
DesTino = DesTino & "u"
End If
If b = "Y" Then
DesTino = DesTino & "q"
End If
If b = "Z" Then
DesTino = DesTino & "w"
End If
Rem aqui termina de encriptar las mayusculas
Next c
End Sub

Public Sub Pausa(Duracion As Long)
Dim Current As Long
Current = Timer
Do Until Timer - Current >= Duracion
DoEvents
Loop
End Sub

Yuval
26 de Abril del 2004
Bueno cuando hagas click sobre los botones
tienes que llamar a cada uno de los procedimientos para llamar por ejemplo al de encriptar seria a si:

Private Sub Command1_Click() 'suponemos que el boton se llama command1
EnCriPtA 'asi llamas al procedimiento que encriptara el texto