|
Thread: xor
-
Feb 5th, 2000, 12:28 PM
#1
Thread Starter
Member
i need some magor help on how to encryt files and documents in vb3.0 with xor
give me some sourcecode too please
-
Feb 5th, 2000, 10:10 PM
#2
put the text you want to encrypt into a variable, and do the same with a password
take the first letter from both strings, and XOR the document character, by the password character.
then take the next letter from both, and repeat, you will have to wrap the password several times depending on the length of the document.
there are lots of websites devoted to encryption out there, go find one in a search engine.
-
Feb 5th, 2000, 10:19 PM
#3
Addicted Member
This requires a form with a textboxes, a Label and a button (caption in this sample should be 'Encrypt').
It is to encrypt text, but it can easily be used to encryped files. Just use a Byte-array.
Option Explicit
Dim car$
Private Sub Command1_Click()
Dim zw$, i&, key%
Static init%
Static superkey$
If Not init Then
Randomize 76456
For i = 0 To 1000
superkey = superkey + Chr(CInt(255 * Rnd))
Next i
init = True
End If
If Command1.Caption = "Encrypt" Then
car = Text1.Text
zw = ""
For i = 1 To Len(car)
key = Asc(Mid(superkey, i, 1))
zw$ = zw$ & Chr(key Xor Asc(Mid(car, i, 1)))
Next i
Command1.Caption = "Decrypt"
car = zw
Label1.Caption = zw
Else
For i = 1 To Len(car)
key = Asc(Mid(superkey, i, 1))
zw$ = zw$ & Chr(key Xor Asc(Mid(car, i, 1)))
Next i
Command1.Caption = "Encrypt"
Text1.Text = zw
car = zw
Label1.Caption = ""
End If
End Sub
------------------
Razzle
ICQ#: 31429438
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|