# Digital signature

• I'll see. `Wikipedia` This algorithm. Entered the staurus when he created the hesch for the text. `M`

``````  string M = "baaqab";
var y = BigInteger.ModPow(g, x, p);
var hM = CalculateMD5Hash(M);
var r = BigInteger.ModPow(g, k, p);
``````

`hM` We're getting a line. `8A79B2FA38507C93B87022C065DEA270`♪ Next in calculation `s` We're taking it away. `m-xr`♪ It is clear that all variables in the article are computed, and they can take a different number from number 3) But I have a hangover. There's half the numbers, half the text. I don't think I'm using the Hessing function for the M line. Who can tell?

• Your implementation `CalculateMD5Hash` Something's converting the MD5 numerical value into a line. You probably have a code like:

``````public string CalculateMD5Hash(string input)
{
// step 1, calculate MD5 hash from input
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
// step 2, convert byte array to hex string
StringBuilder sb = new StringBuilder();
for (int i = 0; i &lt; hash.Length; i++)
{
sb.Append(hash[i].ToString("X2"));
}
return sb.ToString();

}
``````

Remove the transformation from it to line, leave only the heshing itself:

``````public BigInteger CalculateMD5Hash(string input)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
byte[] hash = md5.ComputeHash(inputBytes);
// добавить байт в конце чтобы получить гарантированно положительное значение
return new BigInteger(hash.Concat(new byte[] { 0 }).ToArray());

}
``````

and work with the Hash as a lot.

2

2

2

2

2

2

2

2

2

2

2

2

2

2

2