Trifid Cipher (without keyword)











up vote
2
down vote

favorite












Introduction:



I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post all of them, or only a few. Here is the second one (the Computer Cipher was the first one I posted).





For the Trifid Cipher (without using a keyword) the alphabet (and an additional wildcard) is divided into three 3 by 3 tables:



table 1:     table 2:     table 3:
|1 2 3 |1 2 3 |1 2 3
-+----- -+----- -+-----
1|a b c 1|j k l 1|s t u
2|d e f 2|m n o 2|v w x
3|g h i 3|p q r 3|y z


A text we want to encipher is first character by character encoded into table-row-column numbers. For example, the text this is a trifid cipher becomes:



        t h i s   i s   a   t r i f i d   c i p h e r
table: 3 1 1 3 3 1 3 3 1 3 3 2 1 1 1 1 3 1 1 2 1 1 2
row: 1 3 3 1 3 3 1 3 1 3 1 3 3 2 3 2 3 1 3 3 3 2 3
column: 2 2 3 1 3 3 1 3 1 3 2 3 3 3 3 1 3 3 3 1 2 2 3


We then put everything after one another row by row in the table above in groups of three:



311 331 331 332 111 131 121 121 331 331 313 133 232 313 332 322 313 313 132 333 313 331 223


And those are transformed back to characters using the same tables:



s   y   y   z   a   g   d   d   y   y   u   i   q   u   z   w   u   u   h       u   y   o


One thing to note, the input-length should be coprime to 3. So if the length is a multiple of 3, we append one or two trailing spaces to make the input-length not a multiple 3 anymore.



Challenge:



Given a string sentence_to_encipher, encipher it as described above.



You only have to encipher given the sentence_to_encipher, so no need to create a deciphering program/function as well. I might make a part 2 challenge for the deciphering in the future however (although I have the feeling it's to trivial/similar to the enciphering process).



Challenge rules:




  • You can assume the sentence_to_encipher will only contain letters and spaces.

  • You can use either full lowercase or full uppercase (please state which one you've used in your answer).

  • You can choose to append either one or two trailing spaces when the input-length is 3 to make it not a multiple of 3 anymore.


General rules:




  • This is code-golf, so shortest answer in bytes wins.

    Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (i.e. TIO).

  • Also, adding an explanation for your answer is highly recommended.


Test cases:



Input:            "this is a trifid cipher"
Output: "syyzagddyyuiquzwuuh uyo"

Input: "test"
Output: "utbk"

Input: "output"
Possible outputs: "rrvgivx" (one space) or "rrzcc lr" (two spaces)

Input: "trifidcipher"
Possible output: "vabbuxlzz utr" (one space) or "vabbyzv rx ie " (two spaces)









share|improve this question


























    up vote
    2
    down vote

    favorite












    Introduction:



    I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post all of them, or only a few. Here is the second one (the Computer Cipher was the first one I posted).





    For the Trifid Cipher (without using a keyword) the alphabet (and an additional wildcard) is divided into three 3 by 3 tables:



    table 1:     table 2:     table 3:
    |1 2 3 |1 2 3 |1 2 3
    -+----- -+----- -+-----
    1|a b c 1|j k l 1|s t u
    2|d e f 2|m n o 2|v w x
    3|g h i 3|p q r 3|y z


    A text we want to encipher is first character by character encoded into table-row-column numbers. For example, the text this is a trifid cipher becomes:



            t h i s   i s   a   t r i f i d   c i p h e r
    table: 3 1 1 3 3 1 3 3 1 3 3 2 1 1 1 1 3 1 1 2 1 1 2
    row: 1 3 3 1 3 3 1 3 1 3 1 3 3 2 3 2 3 1 3 3 3 2 3
    column: 2 2 3 1 3 3 1 3 1 3 2 3 3 3 3 1 3 3 3 1 2 2 3


    We then put everything after one another row by row in the table above in groups of three:



    311 331 331 332 111 131 121 121 331 331 313 133 232 313 332 322 313 313 132 333 313 331 223


    And those are transformed back to characters using the same tables:



    s   y   y   z   a   g   d   d   y   y   u   i   q   u   z   w   u   u   h       u   y   o


    One thing to note, the input-length should be coprime to 3. So if the length is a multiple of 3, we append one or two trailing spaces to make the input-length not a multiple 3 anymore.



    Challenge:



    Given a string sentence_to_encipher, encipher it as described above.



    You only have to encipher given the sentence_to_encipher, so no need to create a deciphering program/function as well. I might make a part 2 challenge for the deciphering in the future however (although I have the feeling it's to trivial/similar to the enciphering process).



    Challenge rules:




    • You can assume the sentence_to_encipher will only contain letters and spaces.

    • You can use either full lowercase or full uppercase (please state which one you've used in your answer).

    • You can choose to append either one or two trailing spaces when the input-length is 3 to make it not a multiple of 3 anymore.


    General rules:




    • This is code-golf, so shortest answer in bytes wins.

      Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


    • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


    • Default Loopholes are forbidden.

    • If possible, please add a link with a test for your code (i.e. TIO).

    • Also, adding an explanation for your answer is highly recommended.


    Test cases:



    Input:            "this is a trifid cipher"
    Output: "syyzagddyyuiquzwuuh uyo"

    Input: "test"
    Output: "utbk"

    Input: "output"
    Possible outputs: "rrvgivx" (one space) or "rrzcc lr" (two spaces)

    Input: "trifidcipher"
    Possible output: "vabbuxlzz utr" (one space) or "vabbyzv rx ie " (two spaces)









    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Introduction:



      I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post all of them, or only a few. Here is the second one (the Computer Cipher was the first one I posted).





      For the Trifid Cipher (without using a keyword) the alphabet (and an additional wildcard) is divided into three 3 by 3 tables:



      table 1:     table 2:     table 3:
      |1 2 3 |1 2 3 |1 2 3
      -+----- -+----- -+-----
      1|a b c 1|j k l 1|s t u
      2|d e f 2|m n o 2|v w x
      3|g h i 3|p q r 3|y z


      A text we want to encipher is first character by character encoded into table-row-column numbers. For example, the text this is a trifid cipher becomes:



              t h i s   i s   a   t r i f i d   c i p h e r
      table: 3 1 1 3 3 1 3 3 1 3 3 2 1 1 1 1 3 1 1 2 1 1 2
      row: 1 3 3 1 3 3 1 3 1 3 1 3 3 2 3 2 3 1 3 3 3 2 3
      column: 2 2 3 1 3 3 1 3 1 3 2 3 3 3 3 1 3 3 3 1 2 2 3


      We then put everything after one another row by row in the table above in groups of three:



      311 331 331 332 111 131 121 121 331 331 313 133 232 313 332 322 313 313 132 333 313 331 223


      And those are transformed back to characters using the same tables:



      s   y   y   z   a   g   d   d   y   y   u   i   q   u   z   w   u   u   h       u   y   o


      One thing to note, the input-length should be coprime to 3. So if the length is a multiple of 3, we append one or two trailing spaces to make the input-length not a multiple 3 anymore.



      Challenge:



      Given a string sentence_to_encipher, encipher it as described above.



      You only have to encipher given the sentence_to_encipher, so no need to create a deciphering program/function as well. I might make a part 2 challenge for the deciphering in the future however (although I have the feeling it's to trivial/similar to the enciphering process).



      Challenge rules:




      • You can assume the sentence_to_encipher will only contain letters and spaces.

      • You can use either full lowercase or full uppercase (please state which one you've used in your answer).

      • You can choose to append either one or two trailing spaces when the input-length is 3 to make it not a multiple of 3 anymore.


      General rules:




      • This is code-golf, so shortest answer in bytes wins.

        Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


      • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


      • Default Loopholes are forbidden.

      • If possible, please add a link with a test for your code (i.e. TIO).

      • Also, adding an explanation for your answer is highly recommended.


      Test cases:



      Input:            "this is a trifid cipher"
      Output: "syyzagddyyuiquzwuuh uyo"

      Input: "test"
      Output: "utbk"

      Input: "output"
      Possible outputs: "rrvgivx" (one space) or "rrzcc lr" (two spaces)

      Input: "trifidcipher"
      Possible output: "vabbuxlzz utr" (one space) or "vabbyzv rx ie " (two spaces)









      share|improve this question













      Introduction:



      I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post all of them, or only a few. Here is the second one (the Computer Cipher was the first one I posted).





      For the Trifid Cipher (without using a keyword) the alphabet (and an additional wildcard) is divided into three 3 by 3 tables:



      table 1:     table 2:     table 3:
      |1 2 3 |1 2 3 |1 2 3
      -+----- -+----- -+-----
      1|a b c 1|j k l 1|s t u
      2|d e f 2|m n o 2|v w x
      3|g h i 3|p q r 3|y z


      A text we want to encipher is first character by character encoded into table-row-column numbers. For example, the text this is a trifid cipher becomes:



              t h i s   i s   a   t r i f i d   c i p h e r
      table: 3 1 1 3 3 1 3 3 1 3 3 2 1 1 1 1 3 1 1 2 1 1 2
      row: 1 3 3 1 3 3 1 3 1 3 1 3 3 2 3 2 3 1 3 3 3 2 3
      column: 2 2 3 1 3 3 1 3 1 3 2 3 3 3 3 1 3 3 3 1 2 2 3


      We then put everything after one another row by row in the table above in groups of three:



      311 331 331 332 111 131 121 121 331 331 313 133 232 313 332 322 313 313 132 333 313 331 223


      And those are transformed back to characters using the same tables:



      s   y   y   z   a   g   d   d   y   y   u   i   q   u   z   w   u   u   h       u   y   o


      One thing to note, the input-length should be coprime to 3. So if the length is a multiple of 3, we append one or two trailing spaces to make the input-length not a multiple 3 anymore.



      Challenge:



      Given a string sentence_to_encipher, encipher it as described above.



      You only have to encipher given the sentence_to_encipher, so no need to create a deciphering program/function as well. I might make a part 2 challenge for the deciphering in the future however (although I have the feeling it's to trivial/similar to the enciphering process).



      Challenge rules:




      • You can assume the sentence_to_encipher will only contain letters and spaces.

      • You can use either full lowercase or full uppercase (please state which one you've used in your answer).

      • You can choose to append either one or two trailing spaces when the input-length is 3 to make it not a multiple of 3 anymore.


      General rules:




      • This is code-golf, so shortest answer in bytes wins.

        Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.


      • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.


      • Default Loopholes are forbidden.

      • If possible, please add a link with a test for your code (i.e. TIO).

      • Also, adding an explanation for your answer is highly recommended.


      Test cases:



      Input:            "this is a trifid cipher"
      Output: "syyzagddyyuiquzwuuh uyo"

      Input: "test"
      Output: "utbk"

      Input: "output"
      Possible outputs: "rrvgivx" (one space) or "rrzcc lr" (two spaces)

      Input: "trifidcipher"
      Possible output: "vabbuxlzz utr" (one space) or "vabbyzv rx ie " (two spaces)






      code-golf string cipher encoding






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      Kevin Cruijssen

      35k554184




      35k554184






















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          2
          down vote














          Python 2, 180 bytes





          lambda s:''.join(chr(65+a*9+3*b+c)for a,b,c in zip(*[iter(sum(zip(*[(~-c%32/9,~-c%32/3%3,~-c%32%3)for c in map(ord,s.replace(' ','[')+'['*(len(s)%3<1))]),()))]*3)).replace('[',' ')


          Try it online!



          Input can be upper or lower. Output is uppercase






          share|improve this answer






























            up vote
            2
            down vote














            Charcoal, 39 bytes



            ≔E⁺θ× ¬﹪Lθ³⌕βιθ⭆⪪E⁺÷θ⁹⁺÷θ³θ﹪鳦³§⁺β ↨³ι


            Try it online! Link is to verbose version of code. Explanation:



            ≔               Assign
            θ Input string
            ⁺ Concatenated with
            Literal space
            × Repeated
            θ Input string
            L Length
            ﹪ Modulo
            ³ Literal 3
            ¬ Logical not
            E Mapped over characters
            ι Current character
            ⌕ Position found in
            β Lowercase alphabet
            θ To variable

            θ List of positions
            ÷ Vectorised integer divide by
            ⁹ Literal 9
            ⁺ Concatenated with
            θ List of positions
            ÷ Vectorised integer divide by
            ³ Literal 3
            ⁺ Concatenated with
            θ List of positions
            E Map over values
            ι Current value
            ﹪ Modulo
            ³ Literal 3
            ⪪ Split into
            ³ Groups of 3
            ⭆ Map over groups and join
            β Lowercase alphabet
            ⁺ Concatenated with
            Literal space
            § Cyclically indexed by
            ι Current group
            ↨ Converted from
            ³ Base 3
            Implicitly print





            share|improve this answer






























              up vote
              1
              down vote














              Ruby, 153 bytes





              ->s{(s+"#{' '[s.size%3]}").chars.map{|c|[(b=c[" "]?26:c.ord-97)/9,b%9/3,b%3]}.transpose.flatten.each_slice(3).map{|x,y,z|(w=x*9+y*3+z+97)>122?" ":w.chr}}


              Try it online!



              A quick and naive approach, works with lowercase strings. Outputs arrays of characters. Will try to golf later.






              share|improve this answer





















                Your Answer





                StackExchange.ifUsing("editor", function () {
                return StackExchange.using("mathjaxEditing", function () {
                StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                });
                });
                }, "mathjax-editing");

                StackExchange.ifUsing("editor", function () {
                StackExchange.using("externalEditor", function () {
                StackExchange.using("snippets", function () {
                StackExchange.snippets.init();
                });
                });
                }, "code-snippets");

                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "200"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177353%2ftrifid-cipher-without-keyword%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                2
                down vote














                Python 2, 180 bytes





                lambda s:''.join(chr(65+a*9+3*b+c)for a,b,c in zip(*[iter(sum(zip(*[(~-c%32/9,~-c%32/3%3,~-c%32%3)for c in map(ord,s.replace(' ','[')+'['*(len(s)%3<1))]),()))]*3)).replace('[',' ')


                Try it online!



                Input can be upper or lower. Output is uppercase






                share|improve this answer



























                  up vote
                  2
                  down vote














                  Python 2, 180 bytes





                  lambda s:''.join(chr(65+a*9+3*b+c)for a,b,c in zip(*[iter(sum(zip(*[(~-c%32/9,~-c%32/3%3,~-c%32%3)for c in map(ord,s.replace(' ','[')+'['*(len(s)%3<1))]),()))]*3)).replace('[',' ')


                  Try it online!



                  Input can be upper or lower. Output is uppercase






                  share|improve this answer

























                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote










                    Python 2, 180 bytes





                    lambda s:''.join(chr(65+a*9+3*b+c)for a,b,c in zip(*[iter(sum(zip(*[(~-c%32/9,~-c%32/3%3,~-c%32%3)for c in map(ord,s.replace(' ','[')+'['*(len(s)%3<1))]),()))]*3)).replace('[',' ')


                    Try it online!



                    Input can be upper or lower. Output is uppercase






                    share|improve this answer















                    Python 2, 180 bytes





                    lambda s:''.join(chr(65+a*9+3*b+c)for a,b,c in zip(*[iter(sum(zip(*[(~-c%32/9,~-c%32/3%3,~-c%32%3)for c in map(ord,s.replace(' ','[')+'['*(len(s)%3<1))]),()))]*3)).replace('[',' ')


                    Try it online!



                    Input can be upper or lower. Output is uppercase







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited 45 mins ago

























                    answered 52 mins ago









                    TFeld

                    13.9k21240




                    13.9k21240






















                        up vote
                        2
                        down vote














                        Charcoal, 39 bytes



                        ≔E⁺θ× ¬﹪Lθ³⌕βιθ⭆⪪E⁺÷θ⁹⁺÷θ³θ﹪鳦³§⁺β ↨³ι


                        Try it online! Link is to verbose version of code. Explanation:



                        ≔               Assign
                        θ Input string
                        ⁺ Concatenated with
                        Literal space
                        × Repeated
                        θ Input string
                        L Length
                        ﹪ Modulo
                        ³ Literal 3
                        ¬ Logical not
                        E Mapped over characters
                        ι Current character
                        ⌕ Position found in
                        β Lowercase alphabet
                        θ To variable

                        θ List of positions
                        ÷ Vectorised integer divide by
                        ⁹ Literal 9
                        ⁺ Concatenated with
                        θ List of positions
                        ÷ Vectorised integer divide by
                        ³ Literal 3
                        ⁺ Concatenated with
                        θ List of positions
                        E Map over values
                        ι Current value
                        ﹪ Modulo
                        ³ Literal 3
                        ⪪ Split into
                        ³ Groups of 3
                        ⭆ Map over groups and join
                        β Lowercase alphabet
                        ⁺ Concatenated with
                        Literal space
                        § Cyclically indexed by
                        ι Current group
                        ↨ Converted from
                        ³ Base 3
                        Implicitly print





                        share|improve this answer



























                          up vote
                          2
                          down vote














                          Charcoal, 39 bytes



                          ≔E⁺θ× ¬﹪Lθ³⌕βιθ⭆⪪E⁺÷θ⁹⁺÷θ³θ﹪鳦³§⁺β ↨³ι


                          Try it online! Link is to verbose version of code. Explanation:



                          ≔               Assign
                          θ Input string
                          ⁺ Concatenated with
                          Literal space
                          × Repeated
                          θ Input string
                          L Length
                          ﹪ Modulo
                          ³ Literal 3
                          ¬ Logical not
                          E Mapped over characters
                          ι Current character
                          ⌕ Position found in
                          β Lowercase alphabet
                          θ To variable

                          θ List of positions
                          ÷ Vectorised integer divide by
                          ⁹ Literal 9
                          ⁺ Concatenated with
                          θ List of positions
                          ÷ Vectorised integer divide by
                          ³ Literal 3
                          ⁺ Concatenated with
                          θ List of positions
                          E Map over values
                          ι Current value
                          ﹪ Modulo
                          ³ Literal 3
                          ⪪ Split into
                          ³ Groups of 3
                          ⭆ Map over groups and join
                          β Lowercase alphabet
                          ⁺ Concatenated with
                          Literal space
                          § Cyclically indexed by
                          ι Current group
                          ↨ Converted from
                          ³ Base 3
                          Implicitly print





                          share|improve this answer

























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote










                            Charcoal, 39 bytes



                            ≔E⁺θ× ¬﹪Lθ³⌕βιθ⭆⪪E⁺÷θ⁹⁺÷θ³θ﹪鳦³§⁺β ↨³ι


                            Try it online! Link is to verbose version of code. Explanation:



                            ≔               Assign
                            θ Input string
                            ⁺ Concatenated with
                            Literal space
                            × Repeated
                            θ Input string
                            L Length
                            ﹪ Modulo
                            ³ Literal 3
                            ¬ Logical not
                            E Mapped over characters
                            ι Current character
                            ⌕ Position found in
                            β Lowercase alphabet
                            θ To variable

                            θ List of positions
                            ÷ Vectorised integer divide by
                            ⁹ Literal 9
                            ⁺ Concatenated with
                            θ List of positions
                            ÷ Vectorised integer divide by
                            ³ Literal 3
                            ⁺ Concatenated with
                            θ List of positions
                            E Map over values
                            ι Current value
                            ﹪ Modulo
                            ³ Literal 3
                            ⪪ Split into
                            ³ Groups of 3
                            ⭆ Map over groups and join
                            β Lowercase alphabet
                            ⁺ Concatenated with
                            Literal space
                            § Cyclically indexed by
                            ι Current group
                            ↨ Converted from
                            ³ Base 3
                            Implicitly print





                            share|improve this answer















                            Charcoal, 39 bytes



                            ≔E⁺θ× ¬﹪Lθ³⌕βιθ⭆⪪E⁺÷θ⁹⁺÷θ³θ﹪鳦³§⁺β ↨³ι


                            Try it online! Link is to verbose version of code. Explanation:



                            ≔               Assign
                            θ Input string
                            ⁺ Concatenated with
                            Literal space
                            × Repeated
                            θ Input string
                            L Length
                            ﹪ Modulo
                            ³ Literal 3
                            ¬ Logical not
                            E Mapped over characters
                            ι Current character
                            ⌕ Position found in
                            β Lowercase alphabet
                            θ To variable

                            θ List of positions
                            ÷ Vectorised integer divide by
                            ⁹ Literal 9
                            ⁺ Concatenated with
                            θ List of positions
                            ÷ Vectorised integer divide by
                            ³ Literal 3
                            ⁺ Concatenated with
                            θ List of positions
                            E Map over values
                            ι Current value
                            ﹪ Modulo
                            ³ Literal 3
                            ⪪ Split into
                            ³ Groups of 3
                            ⭆ Map over groups and join
                            β Lowercase alphabet
                            ⁺ Concatenated with
                            Literal space
                            § Cyclically indexed by
                            ι Current group
                            ↨ Converted from
                            ³ Base 3
                            Implicitly print






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited 12 mins ago

























                            answered 1 hour ago









                            Neil

                            78.6k744175




                            78.6k744175






















                                up vote
                                1
                                down vote














                                Ruby, 153 bytes





                                ->s{(s+"#{' '[s.size%3]}").chars.map{|c|[(b=c[" "]?26:c.ord-97)/9,b%9/3,b%3]}.transpose.flatten.each_slice(3).map{|x,y,z|(w=x*9+y*3+z+97)>122?" ":w.chr}}


                                Try it online!



                                A quick and naive approach, works with lowercase strings. Outputs arrays of characters. Will try to golf later.






                                share|improve this answer

























                                  up vote
                                  1
                                  down vote














                                  Ruby, 153 bytes





                                  ->s{(s+"#{' '[s.size%3]}").chars.map{|c|[(b=c[" "]?26:c.ord-97)/9,b%9/3,b%3]}.transpose.flatten.each_slice(3).map{|x,y,z|(w=x*9+y*3+z+97)>122?" ":w.chr}}


                                  Try it online!



                                  A quick and naive approach, works with lowercase strings. Outputs arrays of characters. Will try to golf later.






                                  share|improve this answer























                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote










                                    Ruby, 153 bytes





                                    ->s{(s+"#{' '[s.size%3]}").chars.map{|c|[(b=c[" "]?26:c.ord-97)/9,b%9/3,b%3]}.transpose.flatten.each_slice(3).map{|x,y,z|(w=x*9+y*3+z+97)>122?" ":w.chr}}


                                    Try it online!



                                    A quick and naive approach, works with lowercase strings. Outputs arrays of characters. Will try to golf later.






                                    share|improve this answer













                                    Ruby, 153 bytes





                                    ->s{(s+"#{' '[s.size%3]}").chars.map{|c|[(b=c[" "]?26:c.ord-97)/9,b%9/3,b%3]}.transpose.flatten.each_slice(3).map{|x,y,z|(w=x*9+y*3+z+97)>122?" ":w.chr}}


                                    Try it online!



                                    A quick and naive approach, works with lowercase strings. Outputs arrays of characters. Will try to golf later.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 16 mins ago









                                    Kirill L.

                                    3,4151118




                                    3,4151118






























                                        draft saved

                                        draft discarded




















































                                        If this is an answer to a challenge…




                                        • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                        • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                          Explanations of your answer make it more interesting to read and are very much encouraged.


                                        • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                        More generally…




                                        • …Please make sure to answer the question and provide sufficient detail.


                                        • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                        Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                        Please pay close attention to the following guidance:


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177353%2ftrifid-cipher-without-keyword%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        What visual should I use to simply compare current year value vs last year in Power BI desktop

                                        How to ignore python UserWarning in pytest?

                                        Alexandru Averescu