Private function encrypt (byval strsource as string) as string 'encryption
Dim blowdata as byte
Dim bhigdata as byte
Dim I as long
Dim K as integer
Dim strencrypt as string
Dim strchar as string
Dim keytemp as string
Dim key1 as byte
For k = 1 to 30
Keytemp = keytemp & CSTR (INT (RND * (9) + 1 ))
Next
Key1 = cbyte (mid (keytemp, 11, 1) & Mid (keytemp, 27, 1 ))
For I = 1 to Len (strsource)
Strchar = mid (strsource, I, 1) 'removes a character from the string to be encrypted
Blowdata = ASCB (midb (strchar, 1, 1) XOR key1' obtains the lower byte of the character and key1 for exclusive or operation.
Shigdata = ASCB (midb (strchar, 2, 1) 'takes the high byte of the character
Strencrypt = strencrypt & chrb (blowdata) & chrb (bhigdata) 'combines the computed data into new characters
Next I
Encrypt = keytemp & strencrypt
End Function
Private function decrypt (byval strsource as string) as string 'decryption
Dim blowdata as byte
Dim bhigdata as byte
Dim I as long
Dim K as integer
Dim strdecrypt as string
Dim strchar as string
Dim keytemp as string
Dim key1 as byte
Keytemp = mid (strsource, 1, 30)
Key1 = cbyte (mid (keytemp, 11, 1) & Mid (keytemp, 27, 1 ))
For I = 31 to Len (strsource)
Strchar = mid (strsource, I, 1) 'removes a character from the string to be decrypted
Blowdata = ASCB (midb (strchar, 1, 1) XOR key1' obtains the lower byte of the character and key1 for exclusive or operation.
Bhigdata = ASCB (midb (strchar, 2, 1) 'takes the high byte of the character
Strdecrypt = strdecrypt & chrb (blowdata) & chrb (bhigdata) 'combines the computed data into new characters
Next I
Decrypt = strdecrypt
End Function