跳到主要内容

资源 · 指南或文章

Caesar Cipher Algorithm

简短讲解凯撒移位密码:每个字母沿字母表移动固定的位数。适合作为字符移位类字符串题的热身。

审核日期

打开原站: Caesar Cipher Algorithm (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. For example, with a left shift of 3, D would be replaced by A, E would become B, and so on. The method is named after Julius Caesar, who used it in his private correspondence. The transformation can be represented by aligning two alphabets; the cipher alphabet is the plain alphabet rotated left or right by some number of positions. For instance, here is a Caesar cipher using a left rotation of three places, equivalent to a right shift of 23 (the shift parameter is used as the key): When encrypting, a person looks up each letter of the message in the "plain" line and writes down the corresponding letter in the "cipher" line.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • 左移三位的明文与密文字母表对照,等同于右移 23 位
  • 对全字母句 THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG 的完整加密过程
  • 时间和空间复杂度均为 O(|n|)

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

写出接受任意位移量(包括负数)的加密和解密函数,并检查对 README 中的密文解密后能还原原句。

范围与局限

非常简短:没有解密过程讲解,没有涉及破解该密码,延伸阅读只有一个维基百科链接。

获取方式与形式

GitHub 上采用 MIT 许可的 trekhleb/javascript-algorithms 仓库中的免费英文 README。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/algorithms/cryptography/caesar-cipher/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱