Results 1 to 8 of 8

Thread: Encryption & Decryption

Threaded View

  1. #1

    Thread Starter
    Addicted Member Vanasha's Avatar
    Join Date
    Jun 2007
    Location
    In a bin.>_>
    Posts
    152

    Encryption & Decryption

    Hello everyone, I have been lurking over the forums for some time now, not posting. I have decided to make my own contribution. I don't know if anyone else has done this before or whatever, and I don't know how strong it is..

    Code:
    Public Function EncryptF(ByVal Password As String, ByVal Text As String) As String
    Dim Temp As Integer
    Dim i As Long
    If (Len(Password) < Len(Text)) Then
        Temp = Len(Text) / Len(Password)
        For i = 1 To Temp + 1
            Password = Password & Password
        Next i
    End If
    EncryptF = vbNullString
    For i = 1 To Len(Text)
        Temp = Asc(Mid(Text, i, 1)) + Asc(Mid(Password, i, 1))
        EncryptF = EncryptF & Chr(Temp)
    Next i
    Exit Function
    ErrorH:
    MsgBox ErrHandle, vbCritical, "Error"
    End Function
    
    Public Function DecryptF(ByVal Password As String, ByVal Text As String) As String
    On Error GoTo ErrorH
    Dim Temp As Integer
    Dim i As Long
    If (Len(Password) < Len(Text)) Then
        Temp = Len(Text) / Len(Password)
        For i = 1 To Temp + 1
            Password = Password & Password
        Next i
    End If
    DecryptF = vbNullString
    For i = 1 To Len(Text)
        Temp = Asc(Mid(Text, i, 1)) - Asc(Mid(Password, i, 1))
        DecryptF = DecryptF & Chr(Temp)
    Next i
    Exit Function
    ErrorH:
    MsgBox ErrHandle, vbCritical, "Error"
    End Function
    
    
    Private Function ErrHandle() As String
    If (Err.Description <> "") Then
        ErrHandle = "An error has occured!" & vbNewLine & Err.Number & ") " & Err.Description
    End If
    End Function
    



    The source for the Module is above, and there should be an attachment, with it in a module.
    Credits go to me!

    Warning: Attachment is out of date.


    Edit: Oh I forgot to say.. it doesn't work with special characters!
    Attached Files Attached Files
    Last edited by Vanasha; Sep 13th, 2007 at 10:58 AM. Reason: Code update

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