Class CaesarUtil
java.lang.Object
com.sure.tool.codec.CaesarUtil
凯撒密码编解码工具。
原理:英文字母按指定位移量轮转,非英文字母字符原样保留,大小写分别处理。 经典位移:ROT-13(shift 13)、ROT-3(shift 3,军事用途)。
示例:
String encoded = CaesarUtil.encode("Hello, World!", 3); // "Khoor, Zruog!"
String plain = CaesarUtil.decode("Khoor, Zruog!", 3); // "Hello, World!"
String rot13 = CaesarUtil.encode("suretool", 13); // "fhergbby"
null 语义:入参为 null 时返回 null(空安全)。
- Since:
- 1.19.1
- Author:
- suretool
-
Method Summary
-
Method Details
-
encode
-
decode
-