Results 1 to 3 of 3

Thread: xor

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    55

    Post

    i need some magor help on how to encryt files and documents in vb3.0 with xor
    give me some sourcecode too please

  2. #2
    Guest

    Post

    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.

  3. #3
    Addicted Member Razzle's Avatar
    Join Date
    Jan 2000
    Location
    Berlin, Germany
    Posts
    161

    Post

    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
  •  



Click Here to Expand Forum to Full Width