by Rhian Aseniero (8 Submissions)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 4th February 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Encrytpion and Decryption
API Declarations
Dim ctr1, ctr2 As Integer
Dim acc1(10), acc2(10) As Integer
Dim enc_key, res(10), new_str As String
new_str = ""
For ctr2 = 1 To Len(pass)
acc2(ctr2) = Asc(Mid(pass, ctr2, 1))
Next ctr2
enc_key = "drugAddict"
For ctr1 = 1 To Len(enc_key)
acc1(ctr1) = Asc(Mid(enc_key, ctr1, 1))
Next ctr1
If flag = True Then
For ctr2 = 1 To 10
res(ctr2) = Chr(acc2(ctr2) + acc1(ctr2))
new_str = new_str & res(ctr2)
Next ctr2
Else
For ctr2 = 1 To 10
res(ctr2) = Chr(acc2(ctr2) - acc1(ctr2))
new_str = new_str & res(ctr2)
Next ctr2
End If
Encrypt_Password = new_str
End Function
dim new_str as string
new_str = Encrypt_password("Rhian",True)
msgbox new_str
End Sub