次のように、文字列 "123124125" を長さ 3 の整数配列に変換するプログラムを作成しています。
int[0] = 123
int[1] = 124
int[2] = 125
暗号文の文字列が 123124125 だとしましょう。
私が使用した:
int number[100];
int length1 = ciphertext-> Length;
int count = 0;
int count1 = 0;
char w[100];
while (count1 < length1)
{
number[count] = (ciphertext[count1] * 100) + (ciphertext[count1 + 1] * 10) + ciphertext[count1 + 2];
count++;
count1 = count1 + 3;
}
次に、この式を使用して復号化し、文字列に直接変換します。
for (int i = 0; i < sizeof(number); i++)
{
String ^ demessage += Convert::ToChar(number[i] ^ (int(key) * 2 + int(key) / int(key)) % 255);
}
しかし、次の結果が表示されます。
5553195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195195-....................................1849664615
どこが間違っていますか?最初に int を char に変換してから式を進める必要がありますか?
ありがとう。ご協力いただき、誠にありがとうございます。