Git Product home page Git Product logo

cipher-challenge's Introduction

General Assembly Logo

Caesar Cipher Challenge

Prerequisites

  • None.

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Install dependencies.
  4. Create and checkout a new branch to work on.
  5. Fulfill the listed requirements.

Work in lib/challenge.js. A pull request is not required, but it is necessary if you want a code review.

You may wish to refer to FAQs related to forking, cloning.

Ceasar Cipher

In cryptography, a Caesar cipher is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. The method is named after Julius Caesar, who used it in his private correspondence.

Caesar cipher - Wikipedia, the free encyclopedia

We're going to implement a simple Caesar Cipher called ROT13 ("rotate by 13 places"). The transformation can be represented by aligning two alphabets:

Plain:    abcdefghijklmnopqrstuvwxyz
Cipher:   nopqrstuvwxyzabcdefghijklm

ROT13 is its own inverse; that is, to undo ROT13, the same algorithm is applied, so the same action can be used for encoding and decoding. The algorithm provides virtually no cryptographic security, and is often cited as a canonical example of weak encryption. ROT13 is used in online forums as a means of hiding spoilers, punchlines, puzzle solutions, and offensive materials from the casual glance.

Requirements

  1. Plan using the whiteboard for about 10 minutes.

  2. Implement your ROT13Cipher module.

  3. You should implment a method .encode that takes a single word as an argument and returns the encrypted text. Read and run the tests. Try your code out in node. You should be able to use your code like this:

    let cipher = require('./lib/challenge');
    cipher.encode('hello'); //=> 'uryyb'
    cipher.encode('jeff'); //=> 'wrss'
  4. Implement a .decode method that takes an encrypted word as an argument and returns the unencrypted text.

NOTE: It is okay to hard-code alphabet and rotated. Try generating them with code after you get the solution working.

Bonus

First, change your cipher so that it can take a string with spaces, allowing you to encode and decode entire sentences, not just words.

cipher.encode('hello jeff'); //=> 'uryyb wrss'

Then, change your cipher again so that it can also take a string with upper-case characters.

cipher.encode('Hello Jeff'); //=> 'Uryyb Wrss'

Next, implement a ROT25 cipher. You should implement both .ecnode and .decode methods. Test drive your solution, and use the module pattern.

let cipher = require('./lib/challenge').rot25;
cipher.encode('Hello Jeff'); //=> 'Gdkkn Idee'

Very Challenging: Finally, implement a cipher that takes a number between one and twenty-five as a parameter when it is instantiated. This number n will be used to rotate the alphabet by n places. For example, if you instantiate your cipher with 13, you should get the same results as the in-class lab. Use ROT-n Rotation Encryption online to build your test strings for each potential input.

Additional Resources

  1. All content is licensed under a CC­BY­NC­SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].

cipher-challenge's People

Contributors

fishermanswharff avatar micfin avatar bengitscode avatar laurenfazah avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.