Question
How passwords are encrypted in FlexiCapture 12?
Answer
The passwords in FlexiCapture 12 are stored as a hash. The hash is received by encrypting the password using the SHA-256 algorithm.
Sample code for calculating the password hash:
public static string GetPasswordHashWithSalt( string login, string password )
{
string salt = GetPasswordSha256Hash(login.ToUpper());
return GetPasswordSha256Hash(password + salt);
}
private static string GetPasswordSha256Hash( string password )
{
Encoding enc = Encoding.GetEncoding("UTF-16");
byte[] buffer = enc.GetBytes(password);
var cryptoTransformSHA256 = new SHA256CryptoServiceProvider();
string hash = BitConverter.ToString(cryptoTransformSHA256.ComputeHash(buffer)).Replace("-", "");
return hash;
}
SHA-256 is a cryptographic (one-way) hash function, so there is no direct way to decode it. The whole purpose of a cryptographic hash function is that you cannot reverse it.
Comments
0 comments
Please sign in to leave a comment.