PDA

Click to See Complete Forum and Search --> : Encryption Algorithms


chemicalNova
Oct 9th, 2005, 03:15 PM
Howdy all,

I'm wondering if there are any tutorials anyone has come across regarding advanced text encryption. I want to see how uncrackable I can get a small text file.

Hopefully I can possibly transpose this onto pictures aswell.

Thanks in advance,

chem

dglienna
Oct 9th, 2005, 03:22 PM
I like to use Capicom, which Microsoft released. It encrypts differently each time, based on the time. It decrypts perfectly! You can google it.

I haven't encrypted files, but I'm pretty sure it would be possible. I have only encrypt text strings.

chemicalNova
Oct 9th, 2005, 03:28 PM
I really only want to encrypt text strings (in turn, the text files). Can you provide any articles which have some algorithms or theory behind text encryption?

chem

dglienna
Oct 9th, 2005, 03:43 PM
You mean other than Capicom? This is something that I have also used.

Dim ff As Integer
Public st As String

Private Sub Form_Load()
ff = FreeFile
Dim strBuff As String
ff = FreeFile
Open App.Path & "/site.txt" For Input As #ff
Do Until EOF(ff)
Line Input #ff, strBuff
Loop
Close #ff
Text1.Text = RC4ED(strBuff, "837ufhjjkddQR13%^&*&@#$&9ASFewFDAAW!%9367")
Call WriteFile
End Sub

Sub WriteFile()
ff = FreeFile
Open App.Path & "\site.txt" For Output As #ff
Print #ff, Text1.Text ' <-- Might need to use Write # to add quotes
Close #ff
End Sub

Function RC4ED(InString As String, password As String) As String

Dim S(0 To 255) As Integer
Dim K(0 To 255) As Integer
Dim I As Integer, j As Integer, tmp As Integer
Dim t As Integer
Dim outstring As String


For tmp = 0 To 255
S(tmp) = tmp
K(tmp) = Asc(Mid(password, 1 + (tmp Mod Len(password)), 1))
Next


For I = 0 To 255
j = (j + S(I) + K(I)) Mod 256
Swap S(I), S(j)
Next

I = 0
j = 0
outstring = ""


For tmp = 1 To Len(InString)
I = (I + 1) Mod 256
j = (j + S(I)) Mod 256
Swap S(I), S(j)
t = (S(I) + S(j)) Mod 256
outstring = outstring & Chr((mXor(S(t), Asc(Mid(InString, tmp, 1)))))
Next

RC4ED = outstring
End Function


Function mXor(I As Integer, j As Integer) As Integer


If I = j Then
mXor = j
Else
mXor = I Xor j
End If

End Function


Sub Swap(ByRef a As Integer, ByRef b As Integer)

Dim t As Integer
t = a
a = b
b = t
End Sub



Here's a link. Run the program twice. First time encrypts, second time decrypts.
http://vbforums.com/attachment.php?attachmentid=37573

chemicalNova
Oct 9th, 2005, 04:00 PM
Thanks for that DG, can start to fiddle with some things now :D

chem

StrangerInBeijing
Oct 10th, 2005, 12:37 AM
I did not use it for a while, but you got encryption build into .Net

Check this out for a starter: RSA in VB.NET (http://www.devx.com/security/Article/17455)

wossname
Oct 10th, 2005, 02:46 AM
VS.net has a whole namespace full of encryption classes. Gives you full control of everything. You won't get any much more uncrackable than that.

chemicalNova
Oct 10th, 2005, 08:38 AM
I kinda want to see how far I can go with my own. I also hoped to make a voice recognition decryption. The person says the password, and the text is decrypted. I might actually look alot deeper than I originally was for this..

Ta though :)

chem

StrangerInBeijing
Oct 10th, 2005, 09:35 AM
I kinda want to see how far I can go with my own. I also hoped to make a voice recognition decryption. The person says the password, and the text is decrypted. I might actually look alot deeper than I originally was for this..

Ta though :)

chem
huh? whatever you are smoking, I want some too!