Search Tools Links Login

[Aurora Borealis] Simple Encrypt/Decrypt


Visual Basic 6, or VB Classic

A simple encryper/decrypter I made for a friend...
It converts each char into the asc value for that char and reverses it later...

Original Author: Arcanix

Code

' Place 2 textboxes (txtCoded and txtRea ' l) and 2 command buttons (btndecrypt and ' btnencrypt) on a form
Private Sub btndecrypt_Click()
Dim MyValue As String
MyValue = 3
txtReal.Text = ""
If Len(txtCoded) < 1 Then Exit Sub
For i = 1 To Len(txtCoded) / 3
If MyValue = 3 Then
txtReal = txtReal & Chr(Left(txtCoded, MyValue))
Else
txtReal = txtReal & Chr(Right(Left(txtCoded, MyValue), 3))
End If
MyValue = MyValue + 3
Next i
End Sub
Private Sub btnEncrypt_Click()
Dim MyValue As String
Dim MyValue2 As String
MyValue = 0
MyValue2 = 1
txtCoded = ""
If Len(txtReal) < 1 Then Exit Sub
For i = 1 To Len(txtReal)
txtCoded = txtCoded & Asc(Mid(txtReal, i, 1))
MyValue = MyValue + 1
If Len(txtCoded.Text) < 3 * MyValue Then
MyValue2 = Right(txtCoded.Text, 2)
txtCoded.Text = Left(txtCoded.Text, Len(txtCoded.Text) - 2)
txtCoded.Text = txtCoded.Text & "0" & MyValue2
End If
Next i
End Sub

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 155 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.