Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Password Encryption and Decription

$
0
0

Step1: Decrypt password

string encryptpwd = "";
foreach(User u in logUserDetails)
{
encryptpwd = u.Password;
}

string decryptpwd = string.Empty;
UTF8Encoding encodepwd = new UTF8Encoding();
Decoder Decode = encodepwd.GetDecoder();
byte[] todecode_byte = Convert.FromBase64String(encryptpwd);
int charCount = Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
char[] decoded_char = new char[charCount];


Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
decryptpwd = new String(decoded_char);

Step2: Encrypt password

byte[] encData_byte = new byte[user.Password.Length];
encData_byte = System.Text.Encoding.UTF8.GetBytes(user.Password);
string encodedData = Convert.ToBase64String(encData_byte);
user.Password = encodedData;


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>