View Full Version : Encryption
hey people, can anyone please give a newbie (me) some pointers on a language that will allow me to vreate a program which means i can encrypt files? eg assign an alphanumeric character in place of another one? i w as thinking to do this in VB, but anythihng else would be greatly appreciated :)
thanks
You can do encryption in any language, and most have pre-built encryption modules or functions that can be found readily. If your looking for strong encryption those algorithms are quite extensive but you can make a simple XOR encryption that would work for most non-critical roles.
The functions in VB would look something like this:
Function Encrypt(fileText As String) As String
'XOR encryption
Dim i
i = 0
Dim curChar As String
Dim newText As String
newText = ""
For i = 1 To Len(fileText)
curChar = Mid$(fileText, i, 1)
newText = newText + (Asc(curChar) Xor Asc(XORKey))
Next i
Encrypt = newText
End Function
Function Decrypt(fileText As String) As String
'XOR Decryption
Dim i
i = 0
Dim curChar As String
Dim newText As String
newText = ""
For i = 1 To Len(fileText)
curChar = Mid$(fileText, i, 1)
newText = newText + (Asc(curChar) Xor Asc(XORKey))
Next i
Decrypt = newText
End Function
vBulletin® v3.8.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.