Skip to content

Commit 3518501

Browse files
committed
fixed rotation order
1 parent ae54e8f commit 3518501

File tree

1 file changed

+3
-3
lines changed
  • algorithm/cryptography/caesar_cipher/basic

1 file changed

+3
-3
lines changed

algorithm/cryptography/caesar_cipher/basic/code.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ function cipher(str, rotation, direction, cipherTracer) {
3737
str = str.substring(0, i) + currChar + str.substring(i + 1);
3838
logger._print('Current result: ' + str);
3939
}
40-
40+
4141
return str;
4242
}
4343

4444
function encrypt(str, rotation) {
4545
logger._print('Encrypting: ' + str);
46-
return cipher(str, rotation, 'down', encryptTracer);
46+
return cipher(str, rotation, 'up', encryptTracer);
4747
}
4848

4949
function decrypt(str, rotation) {
5050
logger._print('Decrypting: ' + str);
51-
return cipher(str, rotation, 'up', decryptTracer);
51+
return cipher(str, rotation, 'down', decryptTracer);
5252
}
5353

5454
var encrypted = encrypt(string, rotation);

0 commit comments

Comments
 (0)