by Jessy Butzke (11 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 21st June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code is a very simple way to encrypt a password and save it to a file.
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$) + 5
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$) - 5
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 This code is a very simple way to encrypt a password and save it to a file.. Why not be the first to post a comment about This code is a very simple way to encrypt a password and save it to a file..