Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 4th, 2007, 03:16 AM
Authorized User
Points: 308, Level: 6
Points: 308, Level: 6 Points: 308, Level: 6 Points: 308, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2006
Location: Kolkata, West Bengal, India.
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default password encryption

Hello all,

I want to store the password in encrypted form. Before storing the password I want to encrypt it and in the time of retrive I want to decrypt it. How can I do this?

Angshujit
__________________
Angshujit
  #2 (permalink)  
Old January 4th, 2007, 03:34 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

In my experience, any data that doesn't actually have to viewed again, doesn't need to (and shouldn't) be decrypted. For passwords, what you do is use a one-way hash. You store the hash value of the password. When you need to verify the password, you hash what was entered and compare the result with the stored hash. A hash is always unique for a unique set of bits.

ASP.NET has a build in method for this:

System.Web.Security.FormsAuthentication.HashPasswo rdForStoringInConfigFile(<password string>, <hash type string>)

The available hash types are "MD5" and "SHA". I don't really know the difference between them, but there's plenty of documentation out there on them.

-Peter


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password encryption and storage in the database. zaheerabbas.sk ASP.NET 1.0 and 1.1 Basics 4 July 30th, 2008 05:03 AM
Storing password using encryption from JAVA inderjeet_79 Java Databases 3 October 11th, 2007 04:11 AM
Password encryption decryption, storage in databas zaheerabbas.sk ASP.NET 1.0 and 1.1 Professional 1 April 25th, 2007 02:15 AM
Encryption timeware SQL Server 2005 1 September 7th, 2006 12:35 PM
password encryption kosla78 Classic ASP Professional 6 July 12th, 2006 03:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.