Encryption and decryption program
Encryption and decryption program
API Declarations
'you need to make 2 command boxes called command1 and command2, also a text box called text1 and a label called label1
'click command1 to encrypt some text that u type in and save to file on c drive
click command2 to decrypt it from the file and bring it to the label
Rate Encryption and decryption program
(2(2 Vote))
Public Function Encrypt(ByVal Plain As String)
Dim Letter As String
For i = 1 To Len(Plain)
Letter = Mid$(Plain, i, 1)
Mid$(Plain, i, 1) = Chr(Asc(Letter) + 99)
Next i
Encrypt = Plain
End Function
Public Function Decrypt(ByVal Encrypted As String)
Dim Letter As String
For i = 1 To Len(Encrypted)
Letter = Mid$(Encrypted, i, 1)
Mid$(Encrypted, i, 1) = Chr(Asc(Letter) - 99)
Next i
Decrypt = Encrypted
End Function
Private Sub Command1_Click()
password = Text1.Text
password = Encrypt(password)
Open "c:\file.txt" For Output As #1
Print #1, password
Close #1
End Sub
Private Sub Command2_Click()
Open "c:\file.txt" For Input As #1
Input #1, password
Close #1
password = Decrypt(password)
Label1.Caption = password
End Sub
Encryption and decryption program Comments
No comments yet — be the first to post one!
Post a Comment