🔒 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,219
Guests online
3,984
Total visitors
5,203

Forum statistics

Threads
2,306,418
Posts
29,171,558
Members
1,194,807
Latest member
ddiko
Back
Top