Friday, January 1, 2010

Simple Encrypt and Decrypt Function - Visual Basic Codes

This is a very simple function that you can use to encrypt your passwords before you save it in your database and decrypt it when you need to use it. This functions can also be used in Visual Basic .Net. To use this function just paste the function code on a module.

Public Function EncryptPassword(ByVal Password As String) As String
Dim PassNew As String
Dim Cntr As Integer
Cntr = 1
Do While Cntr <= Len(Password)
PassNew = CStr(PassNew) & Chr((Asc(Mid(Trim(Password), Cntr, 1)) + 20))
Cntr = Cntr + 1
Loop
EncryptPassword = PassNew
End Function

Public Function DecryptPassword(ByVal Password As String) As String
Dim Cntr As Integer
Dim OldPass As String
Cntr = 1
Do While Cntr <= Len(Password)
OldPass = OldPass + Chr((Asc(Mid(Trim(Password), Cntr, 1)) - 20))
Cntr = Cntr + 1
Loop
DecryptPassword = OldPass
End Function


Add To Google BookmarksStumble ThisFav This With TechnoratiAdd To Del.icio.usDigg ThisAdd To RedditTwit ThisAdd To FacebookAdd To Yahoo

5 comments:

Centennial College said...

Thanks for your information it will useful for me!!

Thanks you for sharing with us!!

computer programming

Ridhi Web Expert said...

computer blue screen analysis, crash dump included help?

Thank-you
Silver MLM

vaishu said...

This is very simple function that you can use to encrypt your passwords before you save it in your database and decrypt it when you need to use it.
Private Hire Industry

Narender Singh said...

I am new in vb. Thanx for this tutorial.

Charles Ringenberg said...

Thank you very much for sharing. Simple and useful !

Post a Comment

Related Posts with Thumbnails
 

Privacy Policy for coderschoice.blogspot.com

If you require any more information or have any questions about our privacy policy, please feel free to contact us by email at fbascara@yahoo.com.

At coderschoice.blogspot.com, the privacy of our visitors is of extreme importance to us. This privacy policy document outlines the types of personal information is received and collected by coderschoice.blogspot.com and how it is used.

Log Files Like many other Web sites, coderschoice.blogspot.com makes use of log files. The information inside the log files includes internet protocol ( IP ) addresses, type of browser, Internet Service Provider ( ISP ), date/time stamp, referring/exit pages, and number of clicks to analyze trends, administer the site, track user’s movement around the site, and gather demographic information. IP addresses, and other such information are not linked to any information that is personally identifiable.

Cookies and Web Beacons coderschoice.blogspot.com does not use cookies.

DoubleClick DART Cookie

.:: Google, as a third party vendor, uses cookies to serve ads on coderschoice.blogspot.com. .:: Google's use of the DART cookie enables it to serve ads to your users based on their visit to coderschoice.blogspot.com and other sites on the Internet. .:: Users may opt out of the use of the DART cookie by visiting the Google ad and content network privacy policy at the following URL - http://www.google.com/privacy_ads.html

Some of our advertising partners may use cookies and web beacons on our site. Our advertising partners include ....... Google Adsense

These third-party ad servers or ad networks use technology to the advertisements and links that appear on coderschoice.blogspot.com send directly to your browsers. They automatically receive your IP address when this occurs. Other technologies ( such as cookies, JavaScript, or Web Beacons ) may also be used by the third-party ad networks to measure the effectiveness of their advertisements and / or to personalize the advertising content that you see.

coderschoice.blogspot.com has no access to or control over these cookies that are used by third-party advertisers.

You should consult the respective privacy policies of these third-party ad servers for more detailed information on their practices as well as for instructions about how to opt-out of certain practices. coderschoice.blogspot.com's privacy policy does not apply to, and we cannot control the activities of, such other advertisers or web sites.

If you wish to disable cookies, you may do so through your individual browser options. More detailed information about cookie management with specific web browsers can be found at the browsers' respective websites.