title: RSA get wrong result when input 3 or more plaintext
body: <p>I'm working on a rsa implementation, this my encryption code :</p>
  
  <pre><code>  plain = plaintext.Text;
    char[] charValues = plain.ToCharArray();
    string temp = "", temp2 = "";
    foreach (char _eachChar in charValues)
    {
          int value = Convert.ToInt32(_eachChar);
          temp += String.Format("{0:X}", value); 
    }
  
    temp2 = Convert.ToString(Convert.ToInt64(temp, 16));
    M = Convert.ToInt64(temp2);
    nilai_p = Convert.ToInt64(p.Text);
    nilai_q = Convert.ToInt64(q.Text);
    nilai_d = Convert.ToInt64(d.Text);
    nilai_n = nilai_p * nilai_q;
    nilai_delta_n = (nilai_p - 1) * (nilai_q - 1);
    long atas, tengah1 = a, tengah2 = b, bawah1 = 0, bawah2 = 1, temp;
    for (int i = 0; i &lt;= b; i++)
    {
       atas = tengah1 / tengah2;
       temp = tengah1 - (tengah2 * atas);
       tengah1 = tengah2;
       tengah2 = temp;
       temp = bawah1 - (bawah2 * atas);
       bawah1 = bawah2;
       bawah2 = temp;
       if (tengah2 == 0)
           break;
    }
    if (bawah1 &lt; 0)
         nilai_e = bawah1 + nilai_delta_n;
    else
          nilai_e = bawah1;
    BigInteger hasil = 0;
    hasil = BigInteger.ModPow(M, nilai_e, nilai_n);
  </code></pre>
  
  <p>and this my decryption code :</p>
  
  <pre><code>nilai_c = Convert.ToInt64(chipertext.Text);
  nilai_d = Convert.ToInt64(D.Text);
  nilai_n = Convert.ToInt64(N.Text);
  BigInteger hasil = 0;
  hasil = BigInteger.ModPow(nilai_c, nilai_d, nilai_n);
  </code></pre>
  
  <p>if I did input with 1 or 2 plaintext, the result is true, binary from plaintext will get back. but if 3 or 4 plaintext, the result will false. </p>
  
  <p>I think the problem is here :</p>
  
  <blockquote>
    <p>BigInteger.ModPow(M, nilai_e, nilai_n);</p>
  </blockquote>
  
  <p>and here :</p>
  
  <blockquote>
    <p>BigInteger.ModPow(nilai_c, nilai_d, nilai_n);</p>
  </blockquote>
  
  <p>but I don't know what should I do</p>
  
  <p>anyone can help me, what's wrong with my code ?</p>