Giter VIP home page Giter VIP logo

chuck-norris-cipher's Introduction

Chuck Norris Encryption

The Chuck Norris Unary cipher in Kotlin

Now With Included Decrypter Function for $0.00!

This is a common code puzzle found on a number of sites (Codewars, Leetcode etc..) and consists of encrypting words or a series of characters using only 0s. The characters are first converted to a binary string 7 bits long (i.e. 1001010), which is the length of ASCII character codes. These binary strings are then joined into a single string and form the input for the encrypting function.

The rules of the cipher dictate that the first occurrence of:

1 (bit on) == 0 + a space

0 (bit off) == 00 + a space

Then, each subsequent recurring 1 or 0 will not include a space until a different digit occurs. These digits will indicate the total number of 1/0s until the sequence breaks. Example:

1100110 would be: 0 00 (two 1s) 00 00 (two 0s) 0 00 (two 1s) 00 0 (one zero)

This script allows the user to choose a mode, and it includes a decrypter function which will decode a Chuck-Norris encoded string to a human-discernible message. There is also error handling which checks for illegal strings in both modes.

chuck-norris-cipher's People

Contributors

g3th avatar

Watchers

 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.