凯撒密码用c语言实现 |
您所在的位置:网站首页 › 大表哥2怎么共享 › 凯撒密码用c语言实现 |
凯撒密码是历史上最简单的加密方式之一,它基于一种替换方法,即将明文中的每个字母都替换成它之后的第 N 个字母。下面是一个简单的 C 语言实现: #include #include // 加密函数,plaintext 为明文,key 为加密密钥 void encrypt(char plaintext[], int key) { int len = strlen(plaintext); for (int i = 0; i < len; i++) { if (plaintext[i] >= 'a' && plaintext[i] = 'A' && plaintext[i] = 'a' && ciphertext[i] = 'A' && ciphertext[i] |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |