logo
vbRad Home
Source Code
Book Reviews
Forum
Links
About Us
Contribute

Compare Databases with SQL Effects Clarity
 
 Easy Encryption

Posted on
6/4/2002
Author:
Robert Gelb
Email:
Not Shown
Applies To OS:
NT, 9x, 2k, XP
Product:
5, 6



Download...(1 kb)

What is different about this encryption class?

  • It is very easy to use.
  • Drop it into your project and you are ready to go.
  • The encrypted string is in HEX and human readable - makes it possible to store it in INI files or Registry
  • No external dependencies
That's it. Note that this class does not provide any industrial stregth encryption, but most of the time you don't need it. Don't confuse it with PGP, DES or anything else.

Here is a little piece of code showing how easy it is to encrypt/decrypt stuff.

Add the following code to class
Option Explicit

Private Sub Demo()
    Dim oEncryption As cEncrypt
    Dim sEncryptedText As String
    Dim sDecryptedText As String
    
    Const TEXT_TO_ENCRYPT As String = "Encrypt this"
        
    Set oEncryption = New cEncrypt
    With oEncryption
        'this step is optional
        'if PASSWORD property is not set,
        'the class will use the default password
        .PASSWORD = "1234567890"
        
        'all it takes to encrypt text
        sEncryptedText = oEncryption.Encrypt(TEXT_TO_ENCRYPT)
        
        'now let's decrypt it
        sDecryptedText = oEncryption.Decrypt(sEncryptedText)
    End With
    
    Set oEncryption = Nothing
    
End Sub



Add Your Comment  

Name: Email Address: all fields optional
Notify me via email when someone responds to this message (valid email required).

Enter the word: