-1
int main(void) {
char plain[6] = "lorem";
char cipher[27] = "nbajyfowlzmpxikuvcdegrqsth";
int length = strlen(plain);
char encrypted_text[6] = "pkcyx";
/*encryption*/
for (int i = 0 ; i < length ; i++) {
plain[i] = cipher[plain[i] - 97];
//printf("%c", plain[i]);
}
/*decryption*/
for (int i = 0 ; i < length ; i++) {
encrypted_text[i] = cipher index of encryted text.... how to write this...
eg: cipher index of o is 6 (0-n ,1-b, 2-a, 3-j, 4-y, 5-f, 6-o) ... i want this index so i + 97 will decrypt the msg
//printf("%c", plain[i]);
}
}
暗号化された文字の暗号インデックスはどのように取得できますか?あなたはencrypted_text
に書き込むべきではありませんcのモノラルアルファベット置換暗号の復号化
@ jwdonahue返信ありがとうございます! Iは、Visual Studioコード、出力でこれを実行したメインpkcyx(これは次いで、暗号化される) の#include の#include INT(ボイド){ チャー無地[6] = "Loremの"。 char cipher [27] = "nbajyfowlzmpxikuvcdegrqsth"; int length = strlen(プレーン); /*暗号化/ for(int i = 0; i
Beansprout
。 暗号[27] = "nbajyfowlzmpxikuvcdegrqsth";これを解読するために 私だけのオリジナルの手紙の小数に到達するために手紙を表すの暗号と+ 97のインデックス番号を使用して考えることができます。この場合、pは暗号[11]にあり、11 + 97は私に元の文字 "l"(Lの小文字)である108を与えます。 しかし、私はコードでそれを書く方法を知りません。実装のヒントを教えていただけますか? – Beansprout