🔒 Closed Ciphers & codes list ascii type: substitution

Status
Not open for further replies.
Example of Caesar Cipher (Java)

public static String encrypt(String pass){
StringBuilder encrypt = new StringBuilder();
int num0_3 = 50;
int upperA_C = 67;
int lowerA_C = 99;
int place = 3;
for (char c : pass.toCharArray()) {
int ascii = (int) c;
if(ascii <= num0_3){
ascii = 57 - (num0_3 - ascii);
encrypt.append((char) ascii);
}
else if(ascii <= upperA_C){
ascii = 90 - (upperA_C - ascii);
encrypt.append((char) ascii);
}
else if(ascii <= lowerA_C){
ascii = 122 - (lowerA_C - ascii);
encrypt.append((char) ascii);
}
else{
ascii -= place;
encrypt.append((char) ascii);
}
}
return encrypt.toString();
}
 
Status
Not open for further replies.

About this Thread

  • 43
    Replies
  • 4K
    Views
  • 15
    Participants
Last reply from:
sum1

Trending Topics

Online now

Members online
1,084
Guests online
1,616
Total visitors
2,700

Forum statistics

Threads
2,286,189
Posts
29,036,168
Members
1,217,827
Latest member
kian_masarap
Back
Top