「愷撒密碼」據(jù)傳是古羅馬愷撒大帝用來保護(hù)重要軍情的加密系統(tǒng)。
愷撒加密(Caesar cipher)是一種簡單的消息編碼方式:它根據(jù)字母表將消息中的每個字母移動常量位k。舉個例子如果k等于3,則在編碼后的消息中,每個字母都會向前移動3位:a會被替換為d;b會被替換成e;依此類推。字母表末尾將回卷到字母表開頭。于是,w會被替換為z,x會被替換為a。
Our beloved Republic is in the hands of madmen. This is a dark day and I stand at a fork of the road. I can abide the law and surrender my arms to the senate and watch the Repubic fall to tyranny and chaos! Or, I can go home with my sword in my hand and run those maniacs to the Tarpeian Rock!
將這段演講(《Rome》中Caesar反攻Pompey所作演講)以key=13加密得到如下結(jié)果:
bhe orybirq erchoyvp vf va gur unaqf bs znqzra. guvf vf n qnex qnl naq v fgnaq ng n sbex bs gur ebnq. v pna novqr gur ynj naq fheeraqre zl nezf gb gur frangr naq jngpu gur erchovp snyy gb glenaal naq punbf! be, v pna tb ubzr jvgu zl fjbeq va zl unaq naq eha gubfr znavnpf gb gur gnecrvna ebpx!
愷撒加密法Python代碼,愷撒加密法暴力破解(窮舉)代碼:

