Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I want to enter the value as password mode in sql 2005.
I mean ,I want prevent to somebody to see the value of column.
Posted 3-May-12 18:38pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

hi,
 
encrypt Your password before saving in DB
 
for encryption write following function
public string GetEncryptedPassword(string password)
    {
        string newPass = string.Empty;
        
        int num = new Random().Next(1, 10);
        foreach (char ch in password)
        {
            newPass += (char)(ch + num);
        }
        newPass += (char)num;
        return newPass;
    }
 
for Decryption
public string GetDecryptedPassword(string password)
    {
        string decryptedPassword = string.Empty;
        int num = (int)password[password.Length - 1];
        password = password.Remove(password.Length - 1, 1);
        foreach (char ch in password)
        {
            decryptedPassword += (char)(ch - num);
        }
        return decryptedPassword;
    }
 
Hope it will help u
Best Luck
Happy CodeingSmile | :)
  Permalink  
v2
Comments
Member 7909353 at 4-May-12 0:44am
   
how?
Nilesh Patil Kolhapur at 4-May-12 0:46am
   
check updated solution
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

BY using Encrypt COncept for example by using hashing algorithms u can encrypt you password and store it in DB and for retriving pupose use same tecnique and decrypt it
 
Follow this link it has simple encrypt & decrypt algorithm
http://www.dotnetstuff.co.cc/2011/12/encript-string-in-net.html[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Here i am posting some links to encrypt and decrypt your password.
 
you can use this for hiding your password
 
http://www.dotnetspider.com/resources/22194-password-Encryption-Decryption.aspx[^]
 
http://chandradev819.wordpress.com/2011/04/11/how-to-encrypt-and-decrypt-password-in-asp-net-using-c/[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 553
1 George Jonsson 258
2 OriginalGriff 235
3 CPallini 210
4 PIEBALDconsult 155
0 OriginalGriff 5,865
1 Sergey Alexandrovich Kryukov 5,316
2 CPallini 4,760
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 4 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100