String / Character Conversion Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • anon

    #1

    String / Character Conversion Question

    How can following two statement be the same?

    (1) using System.l1001

    (2) using System.Globaliz ation;

    That is, how does the compilier know these two representations , at the using
    declaration level, are the same?

    Thanks.


  • Jon Skeet [C# MVP]

    #2
    Re: String / Character Conversion Question

    anon <anon@hotmail.c om> wrote:[color=blue]
    > How can following two statement be the same?
    >
    > (1) using System.l1001
    >
    > (2) using System.Globaliz ation;
    >
    > That is, how does the compilier know these two representations , at the using
    > declaration level, are the same?[/color]

    It doesn't, as far as I know. Do you have an example which leads you to
    suspect that they are the same?

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Jon Skeet [C# MVP]

      #3
      Re: String / Character Conversion Question

      anon <anon@hotmail.c om> wrote:[color=blue]
      > How can following two statement be the same?
      >
      > (1) using System.l1001
      >
      > (2) using System.Globaliz ation;
      >
      > That is, how does the compilier know these two representations , at the using
      > declaration level, are the same?[/color]

      It doesn't, as far as I know. Do you have an example which leads you to
      suspect that they are the same?

      --
      Jon Skeet - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      • anon

        #4
        Re: String / Character Conversion Question

        It's from an Obfuscation example. I want to know how this is possible in
        the first place.




        "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
        news:MPG.1af22c 2652dc8ae798a72 8@msnews.micros oft.com...[color=blue]
        > anon <anon@hotmail.c om> wrote:[color=green]
        > > How can following two statement be the same?
        > >
        > > (1) using System.l1001
        > >
        > > (2) using System.Globaliz ation;
        > >
        > > That is, how does the compilier know these two representations , at the[/color][/color]
        using[color=blue][color=green]
        > > declaration level, are the same?[/color]
        >
        > It doesn't, as far as I know. Do you have an example which leads you to
        > suspect that they are the same?
        >
        > --
        > Jon Skeet - <skeet@pobox.co m>
        > http://www.pobox.com/~skeet
        > If replying to the group, please do not mail me too[/color]


        Comment

        • anon

          #5
          Re: String / Character Conversion Question

          It's from an Obfuscation example. I want to know how this is possible in
          the first place.




          "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
          news:MPG.1af22c 2652dc8ae798a72 8@msnews.micros oft.com...[color=blue]
          > anon <anon@hotmail.c om> wrote:[color=green]
          > > How can following two statement be the same?
          > >
          > > (1) using System.l1001
          > >
          > > (2) using System.Globaliz ation;
          > >
          > > That is, how does the compilier know these two representations , at the[/color][/color]
          using[color=blue][color=green]
          > > declaration level, are the same?[/color]
          >
          > It doesn't, as far as I know. Do you have an example which leads you to
          > suspect that they are the same?
          >
          > --
          > Jon Skeet - <skeet@pobox.co m>
          > http://www.pobox.com/~skeet
          > If replying to the group, please do not mail me too[/color]


          Comment

          • Jon Skeet [C# MVP]

            #6
            Re: String / Character Conversion Question

            anon <anon@hotmail.c om> wrote:[color=blue]
            > It's from an Obfuscation example. I want to know how this is possible in
            > the first place.[/color]

            Unless the obfuscator is also obfuscating the system libraries, I don't
            see how those two *are* going to be equivalent.

            Of course, the obfuscator could have decided to change all namespaces
            to System.XXX in order to confuse people - in which case it's worked!

            --
            Jon Skeet - <skeet@pobox.co m>
            Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

            If replying to the group, please do not mail me too

            Comment

            • Jon Skeet [C# MVP]

              #7
              Re: String / Character Conversion Question

              anon <anon@hotmail.c om> wrote:[color=blue]
              > It's from an Obfuscation example. I want to know how this is possible in
              > the first place.[/color]

              Unless the obfuscator is also obfuscating the system libraries, I don't
              see how those two *are* going to be equivalent.

              Of course, the obfuscator could have decided to change all namespaces
              to System.XXX in order to confuse people - in which case it's worked!

              --
              Jon Skeet - <skeet@pobox.co m>
              Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

              If replying to the group, please do not mail me too

              Comment

              • anon

                #8
                Re: String / Character Conversion Question

                This is where I saw it. So I looked and I saw they started to change the
                names at the system level and then I said, how did they manage to do this.





                "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                news:MPG.1af239 2cdd02e8ee98a72 d@msnews.micros oft.com...[color=blue]
                > anon <anon@hotmail.c om> wrote:[color=green]
                > > It's from an Obfuscation example. I want to know how this is possible[/color][/color]
                in[color=blue][color=green]
                > > the first place.[/color]
                >
                > Unless the obfuscator is also obfuscating the system libraries, I don't
                > see how those two *are* going to be equivalent.
                >
                > Of course, the obfuscator could have decided to change all namespaces
                > to System.XXX in order to confuse people - in which case it's worked!
                >
                > --
                > Jon Skeet - <skeet@pobox.co m>
                > http://www.pobox.com/~skeet
                > If replying to the group, please do not mail me too[/color]


                Comment

                • anon

                  #9
                  Re: String / Character Conversion Question

                  This is where I saw it. So I looked and I saw they started to change the
                  names at the system level and then I said, how did they manage to do this.





                  "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                  news:MPG.1af239 2cdd02e8ee98a72 d@msnews.micros oft.com...[color=blue]
                  > anon <anon@hotmail.c om> wrote:[color=green]
                  > > It's from an Obfuscation example. I want to know how this is possible[/color][/color]
                  in[color=blue][color=green]
                  > > the first place.[/color]
                  >
                  > Unless the obfuscator is also obfuscating the system libraries, I don't
                  > see how those two *are* going to be equivalent.
                  >
                  > Of course, the obfuscator could have decided to change all namespaces
                  > to System.XXX in order to confuse people - in which case it's worked!
                  >
                  > --
                  > Jon Skeet - <skeet@pobox.co m>
                  > http://www.pobox.com/~skeet
                  > If replying to the group, please do not mail me too[/color]


                  Comment

                  • Jon Skeet [C# MVP]

                    #10
                    Re: String / Character Conversion Question

                    anon <anon@hotmail.c om> wrote:[color=blue]
                    > This is where I saw it. So I looked and I saw they started to change the
                    > names at the system level and then I said, how did they manage to do this.
                    >
                    > http://www.semdesigns.com/Products/O...onExample.html[/color]

                    They basically can't, as far as I can tell - not without also providing
                    an obfuscated version of the system libraries themselves. If they've
                    done that, then that's a different matter. Not that creating obfuscated
                    *source* code is a particularly useful thing anyway, IMO. They've said
                    how clever they are for removing line breaks, converting text using
                    \uxxxx format etc - all of which is pointless when, for the most part,
                    obfuscation is used for *binaries*, not source: just compiling and then
                    decompiling would remove all the protection there apart from the name
                    changes.

                    --
                    Jon Skeet - <skeet@pobox.co m>
                    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

                    If replying to the group, please do not mail me too

                    Comment

                    • Jon Skeet [C# MVP]

                      #11
                      Re: String / Character Conversion Question

                      anon <anon@hotmail.c om> wrote:[color=blue]
                      > This is where I saw it. So I looked and I saw they started to change the
                      > names at the system level and then I said, how did they manage to do this.
                      >
                      > http://www.semdesigns.com/Products/O...onExample.html[/color]

                      They basically can't, as far as I can tell - not without also providing
                      an obfuscated version of the system libraries themselves. If they've
                      done that, then that's a different matter. Not that creating obfuscated
                      *source* code is a particularly useful thing anyway, IMO. They've said
                      how clever they are for removing line breaks, converting text using
                      \uxxxx format etc - all of which is pointless when, for the most part,
                      obfuscation is used for *binaries*, not source: just compiling and then
                      decompiling would remove all the protection there apart from the name
                      changes.

                      --
                      Jon Skeet - <skeet@pobox.co m>
                      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

                      If replying to the group, please do not mail me too

                      Comment

                      • anon

                        #12
                        Re: String / Character Conversion Question

                        Do you think these guys know something we don't know? At least for changing
                        the names to system classes?

                        But in regards to obfuscating source code, let's say if you did compile it
                        and then decompiled it.

                        The decompiled version would like or be similar to the source code which
                        would be obfuscated anyway.

                        The name changes would be, at least to me, a somewhat considerable hurdle to
                        figure out or use the source code in the first place. You would have only a
                        glimmer of an idea of what the source code did as you could not read that
                        anyway.




                        "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                        news:MPG.1af243 01fe7a213a98a72 e@msnews.micros oft.com...[color=blue]
                        > anon <anon@hotmail.c om> wrote:[color=green]
                        > > This is where I saw it. So I looked and I saw they started to change[/color][/color]
                        the[color=blue][color=green]
                        > > names at the system level and then I said, how did they manage to do[/color][/color]
                        this.[color=blue][color=green]
                        > >
                        > >[/color][/color]
                        http://www.semdesigns.com/Products/O...onExample.html[color=blue]
                        >
                        > They basically can't, as far as I can tell - not without also providing
                        > an obfuscated version of the system libraries themselves. If they've
                        > done that, then that's a different matter. Not that creating obfuscated
                        > *source* code is a particularly useful thing anyway, IMO. They've said
                        > how clever they are for removing line breaks, converting text using
                        > \uxxxx format etc - all of which is pointless when, for the most part,
                        > obfuscation is used for *binaries*, not source: just compiling and then
                        > decompiling would remove all the protection there apart from the name
                        > changes.
                        >
                        > --
                        > Jon Skeet - <skeet@pobox.co m>
                        > http://www.pobox.com/~skeet
                        > If replying to the group, please do not mail me too[/color]


                        Comment

                        • anon

                          #13
                          Re: String / Character Conversion Question

                          Do you think these guys know something we don't know? At least for changing
                          the names to system classes?

                          But in regards to obfuscating source code, let's say if you did compile it
                          and then decompiled it.

                          The decompiled version would like or be similar to the source code which
                          would be obfuscated anyway.

                          The name changes would be, at least to me, a somewhat considerable hurdle to
                          figure out or use the source code in the first place. You would have only a
                          glimmer of an idea of what the source code did as you could not read that
                          anyway.




                          "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                          news:MPG.1af243 01fe7a213a98a72 e@msnews.micros oft.com...[color=blue]
                          > anon <anon@hotmail.c om> wrote:[color=green]
                          > > This is where I saw it. So I looked and I saw they started to change[/color][/color]
                          the[color=blue][color=green]
                          > > names at the system level and then I said, how did they manage to do[/color][/color]
                          this.[color=blue][color=green]
                          > >
                          > >[/color][/color]
                          http://www.semdesigns.com/Products/O...onExample.html[color=blue]
                          >
                          > They basically can't, as far as I can tell - not without also providing
                          > an obfuscated version of the system libraries themselves. If they've
                          > done that, then that's a different matter. Not that creating obfuscated
                          > *source* code is a particularly useful thing anyway, IMO. They've said
                          > how clever they are for removing line breaks, converting text using
                          > \uxxxx format etc - all of which is pointless when, for the most part,
                          > obfuscation is used for *binaries*, not source: just compiling and then
                          > decompiling would remove all the protection there apart from the name
                          > changes.
                          >
                          > --
                          > Jon Skeet - <skeet@pobox.co m>
                          > http://www.pobox.com/~skeet
                          > If replying to the group, please do not mail me too[/color]


                          Comment

                          • mikeb

                            #14
                            Re: String / Character Conversion Question

                            anon wrote:[color=blue]
                            > This is where I saw it. So I looked and I saw they started to change the
                            > names at the system level and then I said, how did they manage to do this.
                            >
                            > http://www.semdesigns.com/Products/O...onExample.html
                            >[/color]

                            it's hard to know what they're doing in the example, but there are a
                            couple of comments that I think I can make:

                            1) using statements (of the namespace sort) do not get compiled down to
                            IL - they're used by the C# compiler to make dealing with nested
                            namespace names more convenient. However, the emited IL always deals
                            with the full typenames, so I'm not sure how a decompiler would generate
                            using statements, except by noting which nested namespaces are used in
                            the entire assembly and emitting a using statement for some or all of
                            those. In this case, the using statements would not magically appear in
                            the same order in the decompiled source as they were in the original
                            source as they seem to do in the example.

                            2) More importantly, there are no types from the System.Globaliz ation
                            namespace being used in the example. If no types from that namespace
                            are used, then the decompiler would be free to put pretty much any
                            namespace it wanted in place of "using System.Globaliz ation;". However,
                            I'm at a loss as to why it would decide to do anything with
                            System.Globaliz ation if no types from that namespace are used.

                            Looking at the example some more, I notice that the following namespaces
                            get renamed:

                            antlr
                            antlr.collectio ns
                            System.Globaliz ation
                            System.IO


                            These seem to correspond to the namespaces that don't actually get used.
                            That would explain why they can rename those namespaces, but it
                            doesn't explain why they'd have anything at all for those namespaces in
                            the decompiled code. Maybe I'm mistaken in my point #1, but I don't
                            think so.


                            [color=blue]
                            >
                            >
                            > "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                            > news:MPG.1af239 2cdd02e8ee98a72 d@msnews.micros oft.com...
                            >[color=green]
                            >>anon <anon@hotmail.c om> wrote:
                            >>[color=darkred]
                            >>>It's from an Obfuscation example. I want to know how this is possible[/color][/color]
                            >
                            > in
                            >[color=green][color=darkred]
                            >>>the first place.[/color]
                            >>
                            >>Unless the obfuscator is also obfuscating the system libraries, I don't
                            >>see how those two *are* going to be equivalent.
                            >>
                            >>Of course, the obfuscator could have decided to change all namespaces
                            >>to System.XXX in order to confuse people - in which case it's worked!
                            >>
                            >>--
                            >>Jon Skeet - <skeet@pobox.co m>
                            >>http://www.pobox.com/~skeet
                            >>If replying to the group, please do not mail me too[/color]
                            >
                            >
                            >[/color]


                            --
                            mikeb

                            Comment

                            • mikeb

                              #15
                              Re: String / Character Conversion Question

                              anon wrote:[color=blue]
                              > This is where I saw it. So I looked and I saw they started to change the
                              > names at the system level and then I said, how did they manage to do this.
                              >
                              > http://www.semdesigns.com/Products/O...onExample.html
                              >[/color]

                              it's hard to know what they're doing in the example, but there are a
                              couple of comments that I think I can make:

                              1) using statements (of the namespace sort) do not get compiled down to
                              IL - they're used by the C# compiler to make dealing with nested
                              namespace names more convenient. However, the emited IL always deals
                              with the full typenames, so I'm not sure how a decompiler would generate
                              using statements, except by noting which nested namespaces are used in
                              the entire assembly and emitting a using statement for some or all of
                              those. In this case, the using statements would not magically appear in
                              the same order in the decompiled source as they were in the original
                              source as they seem to do in the example.

                              2) More importantly, there are no types from the System.Globaliz ation
                              namespace being used in the example. If no types from that namespace
                              are used, then the decompiler would be free to put pretty much any
                              namespace it wanted in place of "using System.Globaliz ation;". However,
                              I'm at a loss as to why it would decide to do anything with
                              System.Globaliz ation if no types from that namespace are used.

                              Looking at the example some more, I notice that the following namespaces
                              get renamed:

                              antlr
                              antlr.collectio ns
                              System.Globaliz ation
                              System.IO


                              These seem to correspond to the namespaces that don't actually get used.
                              That would explain why they can rename those namespaces, but it
                              doesn't explain why they'd have anything at all for those namespaces in
                              the decompiled code. Maybe I'm mistaken in my point #1, but I don't
                              think so.


                              [color=blue]
                              >
                              >
                              > "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
                              > news:MPG.1af239 2cdd02e8ee98a72 d@msnews.micros oft.com...
                              >[color=green]
                              >>anon <anon@hotmail.c om> wrote:
                              >>[color=darkred]
                              >>>It's from an Obfuscation example. I want to know how this is possible[/color][/color]
                              >
                              > in
                              >[color=green][color=darkred]
                              >>>the first place.[/color]
                              >>
                              >>Unless the obfuscator is also obfuscating the system libraries, I don't
                              >>see how those two *are* going to be equivalent.
                              >>
                              >>Of course, the obfuscator could have decided to change all namespaces
                              >>to System.XXX in order to confuse people - in which case it's worked!
                              >>
                              >>--
                              >>Jon Skeet - <skeet@pobox.co m>
                              >>http://www.pobox.com/~skeet
                              >>If replying to the group, please do not mail me too[/color]
                              >
                              >
                              >[/color]


                              --
                              mikeb

                              Comment

                              Working...