Encryption A97
- From: "Kahuna" <none@xxxxxxxxxxxx>
- Date: Fri, 23 Feb 2007 18:51:41 -0000
Hi Folks
I've been playing with some encryption code from the web (XOR type stuff)
and have been pleased with this sample code from Rob Bovey.
Essentially it takes a string and puts it through an XOR process and saves
it to a variable. This works well!
Unfortunately, the string output is in a Unicode format (and looks like
???? - one charachter per input character) and when its saved in a variable
it can easily be put back through the XOR process to regenerate the original
string. Rob does make the following comment right from the getgo:
*********************************
''' NOTE: The encrypted data must be stored in a location that supports
Unicode text.
''' Such locations include the registry and even plain text files.
''' For demonstration purposes we simply use a public String variable.
*********************************
Unfortunately - of course, when this data is saved out to a text box, it
simply becomes a '????' string!
What I really want to do is save this out, as an encrypted string, to a text
field - where it can be copied and pasted. The ultimate aim is that this
encrypted string can be emailed out and used as the passkey in an app by an
end user.
Being a drongo (technical term lol), I really dont understand what is going
on with this Unicode business - and therefore cant even begin to figure out
how to transpose the code to something human readable.
I'd really appreciate any comments on how I might modify this code or be
able to format the encrypted Unicode string as a-z 0-9 and other characters
etc.
PS I'll be using some further encryption and text chopping in addition to
this XOR tool, so hopefully its shouldn't be too easily breakable (though
the security issue is not as important as just keeping basic users out).
==============================================
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''' 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
'''
Private Sub EncryptDecrypt(ByRef szData 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
szData = bytData
End Sub
==============================================
--
Kahuna
------------
.
- Prev by Date: Re: Date() problems
- Next by Date: Re: error 2147024770 (8007007e)
- Previous by thread: Re: Close files from Access
- Next by thread: Re: Remove Apostrophe
- Index(es):
Relevant Pages
|
Loading