Question help on encrypt and decrypt

marianne

Registered User.
Local time
Today, 01:21
Joined
Mar 26, 2009
Messages
327
Hello everyone!

I was wondering if somebody can give me a code to encrypt and decrypt. Though I have downloaded and studied some, but those include ascii. All I wanted is to product a character of letters and number encryption and decryption only.

thanks. badly needed.
 
Google:
Code:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' Comments:   Performs XOr encryption/decryption on string data. Passing a
'''             string through the procedure once encrypts it, passing it
'''             through a second time decrypts it.
'''
''' Arguments:  szData          [in|out] A string containing the data to
'''                             encrypt or decrypt.
'''
''' Date        Developer       Action
''' --------------------------------------------------------------------------
''' 05/18/05    Rob Bovey       Created
'''
Public Function EncryptDecrypt(ByVal szData As String) As String

    Const lKEY_VALUE As Long = 215
    
    Dim bytData() As Byte
    Dim lCount As Long
    
    bytData = szData
    
    For lCount = LBound(bytData) To UBound(bytData)
        bytData(lCount) = bytData(lCount) Xor lKEY_VALUE
    Next lCount

    EncryptDecrypt = bytData
    
End Function
Not very complicated to figure out. But it does the trick.
Got it from the attached spreadsheet

HTH:D
 

Attachments

i was going to suggest the same

boolean xor operation has the peculiar characteristic that it doing the operation twice rerurns you to the original setting

so encrypt plaintext the first time, you get an encrypted string - encrypt it again exactly the same you get the original string back

so in this example change the 215 to anything you want - its not uncrackable, but okay for casual inspection.
 
thanks for the replies. I do really appreciate your efforts.
 

Users who are viewing this thread

Back
Top Bottom