Results 1 to 5 of 5

Thread: File Encryption/Decryption

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    55

    Question

    Can anyone help me create a file encryption/decryption prog.
    I've made a registry prog. but now i need a way to encrypt and decrypt the file containing the password!! HELP

    P.S. I'm pretty rusty in this area so make it easy to understand!~

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    Searching this very site turned up a lot of results. But this thread seems helpful:
    http://forums.vb-world.net/showthrea...threadid=17689
    "People who think they know everything are a great annoyance to those of us who do."

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Cool this works...

    'Encrypt/Unencrypt a file
    '
    Option Explicit
    '
    Private Function EncryptFile(sFile As String, iKey As Integer)

    Dim iFake#
    Dim x As String * 1

    Dim lP As Long, z
    Dim intNum#
    intNum = FreeFile

    iFake = Rnd(-1)
    Randomize (iKey)


    lP = 1
    Open sFile For Binary As intNum

    While lP <= LOF(intNum)

    Get #intNum, lP, x

    z = Asc(x) + Int(Rnd * 256)
    If z > 255 Then z = z - 256

    x = Chr(z)

    Put #intNum, lP, x

    lP = lP + 1


    Wend

    Close #intNum

    MsgBox "Your file has been encrypted."

    End Function


    Private Function DecryptFile(sFile As String, iKey As Integer)

    Dim iFake As Integer
    Dim x As String * 1

    Dim lP As Long, z
    Dim intNum#

    intNum = FreeFile

    iFake = Rnd(-1)
    Randomize (iKey)


    lP = 1
    Open sFile For Binary As #intNum

    While lP <= LOF(intNum)

    Get #intNum, lP, x

    z = Asc(x) - Int(Rnd * 256)
    If z < 0 Then z = z + 256

    x = Chr(z)

    Put #intNum, lP, x

    lP = lP + 1

    Wend

    Close #intNum

    MsgBox "Your file has been unencrypted."

    End Function

    ' <<<< Form Event Code >>>>


    Private Sub Command1_Click()

    Call EncryptFile("a:\book1.xls", 44)

    End Sub

    Private Sub Command2_Click()

    Call DecryptFile("a:\book1.xls", 44)

    End Sub


    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Guest
    You can also use the Xor operator with encryption keys.

    Code:
    MyCode = 50
    MyVal = 65 Xor MyCode
    Then reserve the process to decrypt it.

    Code:
    MyCode = 50
    MyVal = 115 Xor MyCode

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