破解Caesar挪移碼JVMVEKVVE
提示:以下為加密的部份,破解請用暴力破解,共25把金鑰而已
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
python pandas對黃金、外匯匯率的爬蟲練習,並使用matplotlib.pyplot的函數plot, scatter做資料視覺化處理,採用numpy的統計函數,分析黃金價格波動與歐元走勢的關聯。
-
Python C C++ 2 pointer速解Leetcode 2337 Move Pieces to Obtain a String 多日Leetcode的問題都可用2-pointer法來解,今日2337. Move Pieces to Obtain a String也不例...
-
你會用C的算子sizeof?
54 則留言:
public class CS {
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
seventeen
SEVENTEEN
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
key=9
SEVENTEEN
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
public class ex1 {
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
key:17
明文:seventeen
public class aaa
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class ket
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class san
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class wie
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
public class ex1{
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
程式碼太長了
我簡短說明
int key=9;
明文:SEVENTEEN
public class Caesar
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<26;key++)
System.out.println("key="+key+" "+decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class wie
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
key:17
明文:seventeen
Seventeen
Key=17
B10133139_林志鴻
資管二丙
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
key=9
SEVENTEEN
key:
明文:SEVENTEEN
Key:17
明文:SEVENTEEN
SEVENTEEN
SEVENTEEN
SEVENTEEN
SEVENTEEN
SEVENTEEN
金鑰為17
金鑰為17
SEVENTEEN
seventeen
Seventeen
Key=17
public class Caesar
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
seventeen
key:17
明文:seventeen
package AA111;
public class ket
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class key
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
package p1;
public class san
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
SEVENTEEN
SEVENTEEN
key:17
明 :seventeen
seventeen
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
public class abc
{
public static void main(String[] args)
{
String ciphertext="JVMVEKVVE";
for (int key=1;key<=26;key++)
System.out.println(decrypt(ciphertext,key));
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
}
public class ex {
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
Seventeen
Key=17
SEVENTEEN
public class CaesarShiftCipher {
static String encrypt(String plaintext, int key){
plaintext=plaintext.replace(" ","").
toLowerCase();
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<m.length; i++)
c[i]=(char)((m[i]-'a'+26+key)%26+'A');
String ciphertext=new String(c);
return ciphertext;
}
static String decrypt(String ciphertext, int key){
char [] c=ciphertext.toCharArray();
char [] m=new char[c.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'A'+26-key)%26+'a');
String plaintext=new String(m);
return plaintext;
}
public static void main(String[] args) {
String plaintext="JVMVEKVVE";
int key=9;
String ciphertext=encrypt(plaintext, key );
System.out.println(ciphertext);
System.out.println(decrypt(ciphertext, key));
}
}
SEVENTEEN
seventeen
b10041032林佳雯
public class Caesar {public static void main(String[] args) {String ciphertext="JVMVEKVVE";for (int key=1;key<26;key++)System.out.println("key="+key+" "+decrypt(ciphertext,key));}static String decrypt(String ciphertext, int key){char [] c=ciphertext.toCharArray();char [] m=new char[c.length];for (int i=0; i<c.length; i++)m[i]=(char)((c[i]-'A'+26-key)%26+'a');String plaintext=new String(m);return plaintext;}}
seventeen
public class ex1{
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
public class ex1{
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
key:17
明文:seventeen
public class CS {
static String encrypt(String plaintext, int key){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-key)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int key=3;
System.out.println(encrypt(plaintext,key));
}
}
public class CSC {
static String encrypt(String plaintext, int keys){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-keys)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int keys=3;
System.out.println(encrypt(plaintext,key));
}
}
public class CS {
static String encrypt(String plaintext, int keys){
char [] m=plaintext.toCharArray();
char [] c=new char[m.length];
for (int i=0; i<c.length; i++)
m[i]=(char)((c[i]-'a'+26-keys)%26+'A');
String ciphertext=new String(m);
return ciphertext;
}
public static void main(String[] args) {
String plaintext="caesar";
int keys=3;
System.out.println(encrypt(plaintext,keys));
}
}
張貼留言