by Ali Khan (1 Submission)
Category: Encryption
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 22nd September 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. This is simplest algorithm, not suitable for
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim strPart1 As String
Dim strPart2 As String
Dim strPart3 As String
strPart1$ = Me.Text1.Text$
x = Len(strPart1$)
For y = 1 To x
strPart2$ = Left(strPart1$, 1)
strPart1$ = Right(strPart1$, Len(strPart1$) - 1)
z = Asc(strPart2$) Xor 1
strPart3$ = strPart3$ & Chr(z)
Next y
Open "c:\Test.txt" For Output As #1
Print #1, strPart3$
Close #1
MsgBox "You have encrypted " & Me.Text1.Text$ & _
" to " & strPart3$ & ", and saved it to " & _
"c:\Test.txt", vbInformation, "Notice"
End Sub
Private Sub Command2_Click()
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim strPart1 As String
Dim strPart2 As String
Open "c:\Test.txt" For Input As #1
Input #1, strPart1$
Close #1
x = Len(strPart1$)
For y = 1 To x
strPart2$ = Left(strPart1$, 1)
strPart1$ = Right(strPart1$, Len(strPart1$) - 1)
z = Asc(strPart2$) Xor 1
Me.Text1.Text$ = Me.Text1.Text$ & Chr(z)
Next y
MsgBox "You opened the file c:\Test.txt and " & _
"decrypted it back into Text1.Text.", vbInformation, _
"Notice"
End Sub
No comments have been posted about Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th. Why not be the first to post a comment about Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th.