Beta

Jack & Jill's cipher

Description
Loading description...
Cryptography
Ciphers
Arrays
Algorithms
View
AllIssues2QuestionsSuggestions1Show Resolved
  • Please sign in or sign up to leave a comment.
  • behan Avatar

    Usefull for newbies

  • adri326 Avatar

    Maybe have some examples in the description? Here'd be a revised version:

    Jack and Jill invented a cipher: each letter's char code is converted in the ternary number system (radix=3) and their digits *(trigits?)* are bumped by one (`0` → `1`, `1` → `2`, `2` → `3`). The transformed characters are then separated by a vertical beam (`|`).
    
    For instance: `Hello` becomes `3311|21313|22111|22111|22121` and `Such an easy kata` becomes `21113|22211|21311|21323|2123|21232|22113|2123|21313|21232|22132|22222|2123|21333|21232|22133|21232`
    
    You task is to write two functions: `encrypt` and `decrypt`. All test strings are guaranteed to be valid.
    
    Good luck, warrior!
    
    • FArekkusu Avatar

      trigits

      There's no such thing as "trigit". Even ABCDEF in hexadecimal are called digits.

    • adri326 Avatar

      I know, it just sounded funny. Thinking about the ethymology of digit, it could make sense: we have ten fingers, not three or sixteen. Referring to hexadecimal digits as digits doesn't really mean anything, as we don't have any 12th or 14th finger

  • Voile Avatar

    Needs random tests.