Results 1 to 3 of 3

Thread: Bitmap Encrypt / Decrypt

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    hiya all,

    Just wondering how to use vb to encrypt a bitmap file and then be able to decrypt it, it doesnt have to be the best encryption.

    Thanks

  2. #2
    Guest
    Use this function.
    Code:
    Sub Encrypt(ByVal sName As String)
        Dim b() As Byte
        Dim nb() As Byte
        n = FileLen(sName)
        ReDim b(n - 1)
        ReDim nb(n - 1)
        Open sName For Binary Access Read As #1
        Get #1, , b()
        Close #1
        Kill sName
        For i = LBound(b) To UBound(b)
            nb(i) = b(i) Xor 5
        Next i
    
        Open sName For Binary Access Write As #1
        Put #1, , nb()
        Close #1
    End Sub
    Since it's binary encryption with Xor, this will do both Encryption and Decryption.
    Usage:
    Code:
    Encrypt "MyFile.bmp"

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    cheers megaman

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