3
I want to take the values, for example, 79 201 304 and store in one vector each number at one position.
Example :
int array[0] = 79;
int array[1] = 201;
int array[2] = 304;
public static int Descriptografa(string txt, int p, int q, int d, int e)
{
string[] aux;
int[] descrypt ;
int phi, n, res = 0,i;
string resultado;
n = p * q;
phi = (p - 1) * (q - 1);
d = ((phi * 2) + 1) / e; // d*e ≡ 1 mod (φ n)
for (i = 0; i < txt.Length; i++)
{
aux = txt.Split(' ');
descrypt[] = Array.ConvertAll(aux, str => int.Parse(str));
BigInteger big = BigInteger.Pow(descrypt[i], d) % n;
res = (int)big;
resultado = char.ConvertFromUtf32(res);
Console.Write(resultado);
}
return 0;
}
I’m doing a job for RSA encryption faculty and this giving problem in the decrypting part need to pick up what the user type that will be numbers separated by spaces and store in vector with to decrypt each number.
i did this with the split but it appears that "cannot implicitly convert type "string[]" into "string""
– Anderson
I got to see how Ideone works, see what I did wrong in the answer below
– Anderson
input would be txt pq it which will receive the numbers the user will type
– Anderson
got it now, I put where it does the conversion to int an int[] and it worked, obg
– Anderson