- Home
·
- Encryption
·
- Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th
Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th
Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. This is simplest algorithm, not suitable for
Rate Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th
(2(2 Vote))
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
Simplest encryption algorithm. Program encrypts entered text and then decrypts in on next click. Th Comments
No comments yet — be the first to post one!
Post a Comment