cryptographic service provider (CSP)

Abdulhakim M. Elrhumi 356 Reputation points
2020-12-22T16:02:32.29+00:00

Hi
Initializes an instance of System.Security.Cryptography.MD5CryptoServiceProvider.
it's work in source code run.
but after compiler my code and run exe file not work under windows 10 64bit.

public static string EncryptPassword(string s)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(s));
byte[] Result = md5.Hash;
StringBuilder str = new StringBuilder();
for(int i=1;i<Result.Length;i++)
{
str.Append(Result[i].ToString("x4"));
}
return str.ToString();
}

the Encrypt password is true.
string password = HelperClass.EncryptPassword(txtPassword.Text);

Best Regards.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,011 questions
{count} votes

Accepted answer
  1. Michael Taylor 54,811 Reputation points
    2020-12-22T16:54:45.31+00:00

    This doesn't tell us what is wrong. Are you getting an error? If so what error message, type and stack trace?

    Is this crypto algorithm even supported on your OS? Use IISCrypto to identify whether the MD5 crypto algorithm is enabled on your OS version. It is an older version and, as the docs indicate, shouldn't be used. It is possible your OS version has disabled the older algorithms for security reasons.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.