Click here to Skip to main content
11,584,288 members (49,612 online)
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

  Permalink  

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

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 334
2 Dave Kreskowiak 240
3 Richard Deeming 220
4 virusstorm 194
0 OriginalGriff 1,663
1 Sergey Alexandrovich Kryukov 1,229
2 Abhinav S 701
3 Dave Kreskowiak 667
4 Suvendu Shekhar Giri 568


Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 4 May 2012
Copyright © CodeProject, 1999-2015
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