From 6522b4b858f71a3ed9035e935dc65145fa0efc66 Mon Sep 17 00:00:00 2001 From: chedulurivijayakumar <85997231+chedulurivijayakumar@users.noreply.github.com> Date: Wed, 24 Nov 2021 17:51:36 +1100 Subject: [PATCH] Update offset.coffee --- 08-cipher/lib/offset.coffee | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/08-cipher/lib/offset.coffee b/08-cipher/lib/offset.coffee index 90e9e1d..86cc3b4 100644 --- a/08-cipher/lib/offset.coffee +++ b/08-cipher/lib/offset.coffee @@ -12,8 +12,15 @@ exports.encrypt = (string, secret = 1) -> return result -exports.decrypt = (string, secret = 1) -> - # - # !!! Place your solition here !!! - # - return 'fix me' + exports.decrypt = (string) -> + result = '' + for char in string + index = alphabet0.indexOf char + if index is -1 + result += char + else + result += alphabet1[index] + + return result + +