Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. I didn't write this..

I didn't write this..

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
16 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Sascha Lefevre

    no I didn't... ..a much younger me wrote this piece of "code" which is bad in so many ways I don't even want to count them:

    CString StrEncode(CString str, bool decode)
    {
    CString map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";

    short len = map.GetLength();
    short add = decode ? len : 0;
    short mul = decode ? -1 : 1;
    short off = str.GetLength() % len;
    
    CString out;
    
    for(short i=0; iThe only good thing about it is that it served its purpose of weakly obfuscating strings.
    

    Please absolve me :laugh:

    If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #4

    Pfft... Dictionaries are so much faster than string searches... :~

    S 1 Reply Last reply
    0
    • S Sascha Lefevre

      no I didn't... ..a much younger me wrote this piece of "code" which is bad in so many ways I don't even want to count them:

      CString StrEncode(CString str, bool decode)
      {
      CString map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";

      short len = map.GetLength();
      short add = decode ? len : 0;
      short mul = decode ? -1 : 1;
      short off = str.GetLength() % len;
      
      CString out;
      
      for(short i=0; iThe only good thing about it is that it served its purpose of weakly obfuscating strings.
      

      Please absolve me :laugh:

      If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #5

      Sascha Lefèvre wrote:

      Please absolve me

      Et nunc absolvo te ab peccatis tuis. Amen.

      Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

      OriginalGriffO S 2 Replies Last reply
      0
      • B Bernhard Hiller

        Sascha Lefèvre wrote:

        Please absolve me

        Et nunc absolvo te ab peccatis tuis. Amen.

        Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #6

        And ten Hail Marys.

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        P 1 Reply Last reply
        0
        • M Marc Clifton

          Sascha Lefèvre wrote:

          Please absolve me

          To be forgiven, you must obtain an abacus from ebay and perform the computations of your algorithm by hand with nothing but the abacus. ;)

          Latest Article - Class-less Coding - Minimalist C# and Why F# and Function Programming Has Some Advantages Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          S Offline
          S Offline
          Sascha Lefevre
          wrote on last edited by
          #7

          I'll possibly carry this burden forever then :laugh:

          If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

          1 Reply Last reply
          0
          • raddevusR raddevus

            I fixed it for you : FTFY - rewrote it in C# so you can run it in LINQPad[^] I'll put this out on GitHub as soon as possible. :laugh:

            void Main()
            {
            Console.WriteLine(StrEncode("Here it is", true));
            Console.WriteLine(StrEncode("´;µsDUkGäB", false));
            }

            String StrEncode(String str, bool decode)
            {
            String map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";

            int len = map.Length;
            int add = decode ? len : 0;
            int mul = decode ? -1 : 1;
            int off = str.Length % len;
            
            String outMsg = String.Empty;
            //Console.WriteLine(map);
            for(int i=0; i
            

            Here's the resulting output:

            ´;µsDUkGäB
            Here it is

            S Offline
            S Offline
            Sascha Lefevre
            wrote on last edited by
            #8

            I can see you caught fire - maybe we can achieve great things together :laugh:

            If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

            raddevusR 1 Reply Last reply
            0
            • B Bernhard Hiller

              Sascha Lefèvre wrote:

              Please absolve me

              Et nunc absolvo te ab peccatis tuis. Amen.

              Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!

              S Offline
              S Offline
              Sascha Lefevre
              wrote on last edited by
              #9

              Thank you :-D

              If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

              1 Reply Last reply
              0
              • P PIEBALDconsult

                Pfft... Dictionaries are so much faster than string searches... :~

                S Offline
                S Offline
                Sascha Lefevre
                wrote on last edited by
                #10

                That's one of those things I didn't even want to start counting..

                If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                1 Reply Last reply
                0
                • S Sascha Lefevre

                  I can see you caught fire - maybe we can achieve great things together :laugh:

                  If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                  raddevusR Offline
                  raddevusR Offline
                  raddevus
                  wrote on last edited by
                  #11

                  Yes, this could be bigger than base64 encoding which is far easier to use. :laugh: People using base64 are just lazy. :-D

                  1 Reply Last reply
                  0
                  • OriginalGriffO OriginalGriff

                    And ten Hail Marys.

                    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #12

                    And put a pound in the poor box.

                    1 Reply Last reply
                    0
                    • S Sascha Lefevre

                      no I didn't... ..a much younger me wrote this piece of "code" which is bad in so many ways I don't even want to count them:

                      CString StrEncode(CString str, bool decode)
                      {
                      CString map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";

                      short len = map.GetLength();
                      short add = decode ? len : 0;
                      short mul = decode ? -1 : 1;
                      short off = str.GetLength() % len;
                      
                      CString out;
                      
                      for(short i=0; iThe only good thing about it is that it served its purpose of weakly obfuscating strings.
                      

                      Please absolve me :laugh:

                      If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                      D Offline
                      D Offline
                      Daniel Pfeffer
                      wrote on last edited by
                      #13

                      Sascha Lefèvre wrote:

                      Please absolve me :laugh:

                      In order to receive absolution, you must rewrite the entire application in VB6.

                      If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                      S 1 Reply Last reply
                      0
                      • D Daniel Pfeffer

                        Sascha Lefèvre wrote:

                        Please absolve me :laugh:

                        In order to receive absolution, you must rewrite the entire application in VB6.

                        If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack. --Winston Churchill

                        S Offline
                        S Offline
                        Sascha Lefevre
                        wrote on last edited by
                        #14

                        It might actually end up being better than it is.. :~

                        If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                        1 Reply Last reply
                        0
                        • S Sascha Lefevre

                          no I didn't... ..a much younger me wrote this piece of "code" which is bad in so many ways I don't even want to count them:

                          CString StrEncode(CString str, bool decode)
                          {
                          CString map = "S)y³T<.zÖ?tp3~o`u^F}G\\0D_K:>1µ5&|ßJ§ö $E!rÜq-I]W%=Xü´Yl/(78A#dHm@BvQLM'*Pc+2Äxf,ghCnsä;6UO{9a[b4Ne²wjkViRZ°";

                          short len = map.GetLength();
                          short add = decode ? len : 0;
                          short mul = decode ? -1 : 1;
                          short off = str.GetLength() % len;
                          
                          CString out;
                          
                          for(short i=0; iThe only good thing about it is that it served its purpose of weakly obfuscating strings.
                          

                          Please absolve me :laugh:

                          If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                          R Offline
                          R Offline
                          Rob Grainger
                          wrote on last edited by
                          #15

                          I've actually seen a Caeser Cipher[^] used to encode passwords, so that's not too bad by comparison.

                          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                          S 1 Reply Last reply
                          0
                          • R Rob Grainger

                            I've actually seen a Caeser Cipher[^] used to encode passwords, so that's not too bad by comparison.

                            "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

                            S Offline
                            S Offline
                            Sascha Lefevre
                            wrote on last edited by
                            #16

                            ;)

                            If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups