Solved

how to encrypt data in vb

Posted on 2001-09-10
7
356 Views
Last Modified: 2008-02-26
Is there any fuctions in vb6 to encrypt and decrypt data or any other tips
regards
kk
0
Comment
Question by:korlakris
7 Comments
 
LVL 13

Expert Comment

by:khairil
ID: 6473377
there is no function build-in for you to encrypt data directly form vb, but you can program one... have a look at www.planetsourcecode.com under visual basic section, try search for "encrypt" keyword, u will find a lot of if
0
 
LVL 8

Accepted Solution

by:
glass_cookie earned 100 total points
ID: 6473426
Hi!

No such function in VB, but here's some links:

Download...
http://www.vb-helper.com/HowTo/onetimepad.zip
Description: Use a one-time pad to encipher and decipher text (3K)

Download...
http://www.vb-helper.com/HowTo/simpencrypt.zip
Description: Encipher text, part 2 (6K)

Download...
http://www.vb-helper.com/HowTo/cipher.zip
Description: Encipher text (3K)

and some more:

Download...
http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=9604&strZipAccessCode=ODE%5F96045427
Description: This is a rather simple encryption program that will encrypt / decrypt any text file that is created by this application

View code...
http://www.planetsourcecode.com/vb/scripts/ShowCodeAsText.asp?txtCodeId=10895&lngWId=1
Description: two separate functions for encrypting/decrypting a string/text file/whatever. Encrypts using only asc characters 1 - 26 and 255 which all show up as the same character on the screen (except a few), making it difficult to decrypt.

Download...
http://www.planetsourcecode.com/vb/scripts/ShowZip.asp?lngWId=1&lngCodeId=11400&strZipAccessCode=ODE%5F114000891
Description: This program encrypt or decrypt a text, with a key and a checksum checker. Very good program

That's it!

glass cookie ; )
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 6473435
Hi korlakris,

Some resources can refer:

Task: Encryption code. It allows you to type a letter and number based password used to encrypt and decrypt the text! It uses the 64 bit cipher class module that makes it EXTREMLY difficult to hack! You can use this with a electronic journal, or with and security related programs.

http://www.vbcode.com/asp/showzip.asp?ZipFile=http%3A%2F%2Fmembers%2Exoom%2Ecom%2FVisualScope%2Fencanddecadvanced%2Ezip&theID=2170

and a sample from VBCode.com:

'Encryption function
Public Function Encrypt(ByVal Plain As String)
    Dim Letter As String
    For I = 1 To Len(Plain)
        Letter = Mid$(Plain, I, 1)
        Mid$(Plain, I, 1) = Chr(Asc(Letter) + 1)
    Next I
    Encrypt = Plain
End Function
'Here's the Decryption function:
Public Function Decrypt(ByVal Encrypted As String)
Dim Letter As String
    For I = 1 To Len(Encrypted)
        Letter = Mid$(Encrypted, I, 1)
        Mid$(Encrypted, I, 1) = Chr(Asc(Letter) - 1)
    Next I
    Decrypt = Encrypted
End Function

'here is sample code to test it....
Dim strMessage As String
strMessage = "Original:"
strMessage = strMessage & "This is a test" & vbCrLf
strMessage = strMessage & vbCrLf & "Encrypted:"
strMessage = strMessage & Encrypt("This is a test") & vbCrLf
strMessage = strMessage & vbCrLf & "Un-Encrypted:"
strMessage = strMessage & Decrypt(Encrypt("This is a test"))
MsgBox strMessage

regards.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Expert Comment

by:Vbmaster
ID: 6474061
You can find some code on planet-source-code.com if you search for "Fredrik Qvarfort" too. There's a post with code for RC4, XOR, DES, Gost, TEA, Blowfish, Skipjack and Twofish. The Twofish class file contains a small bug in the Propery Let Key method though (psc won't allow me to update my code, if you want the updated code let me know).
0
 

Author Comment

by:korlakris
ID: 6475859
thank u very much for ur valuable comments
kris
0
 

Author Comment

by:korlakris
ID: 6478402
Thanx for all the experts for ur valuable contribution
kris
0
 

Author Comment

by:korlakris
ID: 6480117
Thank very much to all the experts.

regards
kris
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now