From 3518501a74875de07064cb8259058224d0e0c632 Mon Sep 17 00:00:00 2001 From: Nemanja Stojanovic Date: Tue, 31 May 2016 17:53:27 -0400 Subject: [PATCH] fixed rotation order --- algorithm/cryptography/caesar_cipher/basic/code.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/algorithm/cryptography/caesar_cipher/basic/code.js b/algorithm/cryptography/caesar_cipher/basic/code.js index 128f9c25..1b562e32 100644 --- a/algorithm/cryptography/caesar_cipher/basic/code.js +++ b/algorithm/cryptography/caesar_cipher/basic/code.js @@ -37,18 +37,18 @@ function cipher(str, rotation, direction, cipherTracer) { str = str.substring(0, i) + currChar + str.substring(i + 1); logger._print('Current result: ' + str); } - + return str; } function encrypt(str, rotation) { logger._print('Encrypting: ' + str); - return cipher(str, rotation, 'down', encryptTracer); + return cipher(str, rotation, 'up', encryptTracer); } function decrypt(str, rotation) { logger._print('Decrypting: ' + str); - return cipher(str, rotation, 'up', decryptTracer); + return cipher(str, rotation, 'down', decryptTracer); } var encrypted = encrypt(string, rotation);