Advertisement
2_2002-2004 Encryption #116191

A Simple encryption function with Password

A simple encryption function with Password. The slightest change with the password will effect the text so that it is unreadable. This function also encrypts and decrypts depending on if you set EnDeCrypt Boolean to True or False. I am sure you could crack a message from this code after a while but i think it is stronger than other simple cryption codes you will find on planet source code. Sorry that I ain't REMed it but it is quite simple so you should understand it. I hope you like.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
Private Sub Command1_Click()
Dim Text As String, Password As String
Text = "Hello"
Password = "Pass"
Print Text
Text = Crypt(Text, Password, True)
Print Text
Text = Crypt(Text, Password, False)
Print Text
End Sub
Public Function Crypt(Source As String, strPassword As String, EnDeCrypt As Boolean) As String
'EnDeCrypt True = Encrypt
'EnDeCrypt False = Decrypt
Dim intPassword As Long
Dim intCrypt As Long
For x = 1 To Len(strPassword)
 intPassword = intPassword + Asc(Mid$(strPassword, x, 1))
Next x
For x = 1 To Len(Source)
If EnDeCrypt = True Then
 intCrypt = Asc(Mid$(Source, x, 1)) + intPassword + x
 
 Do Until intCrypt <= 255
 intCrypt = intCrypt - 255
 Loop
Else
 intCrypt = Asc(Mid$(Source, x, 1)) - intPassword - x
 
 Do Until intCrypt > 0
 intCrypt = intCrypt + 255
 Loop
End If
Crypt = Crypt & Chr(intCrypt)
Next x
End Function
Original Comments (3)
Recovered from Wayback Machine