7 kyu

Ciphers #1 - The 01 Cipher

700 of 1,363ngmhprogramming

Description:

This is my first Kata in the Ciphers series. This series is meant to test our coding knowledge.

Ciphers #1 - The 01 Cipher

This cipher doesn't exist, I just created it by myself. It can't actually be used, as there isn't a way to decode it. It's a hash. Multiple sentences may also have the same result.

How this cipher works

It looks at the letter, and sees it's index in the alphabet, the alphabet being a-z, if you didn't know. If it is odd, it is replaced with 1, if it's even, its replaced with 0. Note that the index should start from 0. Also, if the character isn't a letter, it remains the same.

Example

encode("Hello World!"); // => "10110 00111!"

This is because H's index is 7, which is odd, so it is replaced by 1, and so on.

Have fun (en)coding!

Fundamentals

More By Author:

Check out these other kata created by ngmhprogramming

Stats:

CreatedJun 13, 2017
PublishedJun 13, 2017
Warriors Trained1989
Total Skips26
Total Code Submissions3919
Total Times Completed1363
Python Completions700
JavaScript Completions521
Ruby Completions75
PHP Completions134
Total Stars23
% of votes with a positive feedback rating92% of 323
Total "Very Satisfied" Votes278
Total "Somewhat Satisfied" Votes39
Total "Not Satisfied" Votes6
Total Rank Assessments14
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • ngmhprogramming Avatar
  • anter69 Avatar
  • donaldsebleung Avatar
  • yLaWy Avatar
Ad