🔒 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
721
Guests online
918
Total visitors
1,639

Forum statistics

Threads
2,273,099
Posts
28,947,596
Members
1,235,629
Latest member
draintal
Back
Top