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. General Programming
  3. C / C++ / MFC
  4. Suggest a fast way to do?

Suggest a fast way to do?

Scheduled Pinned Locked Moved C / C++ / MFC
question
30 Posts 11 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.
  • J john5632

    how table will be fast?

    S Offline
    S Offline
    Software_Developer
    wrote on last edited by
    #21

    http://en.wikipedia.org/wiki/Lookup_table says: A Lookup table is a data structure, usually an array or associative array, often used to replace a runtime computation with a simpler array indexing operation. The savings in terms of processing time can be significant, since retrieving a value from memory is often faster than undergoing an 'expensive' computation or calculation operation. For example this is regularly done as part of CRC calculations.

    #include <iostream.h>

    // The CRC lookup table size is 8x32=256
    const static unsigned int table[] =
    {
    0x000000000, 0x077073096, 0x0EE0E612C, 0x0990951BA, 0x0076DC419, 0x0706AF48F, 0x0E963A535, 0x09E6495A3,
    0x00EDB8832, 0x079DCB8A4, 0x0E0D5E91E, 0x097D2D988, 0x009B64C2B, 0x07EB17CBD, 0x0E7B82D07, 0x090BF1D91,
    0x01DB71064, 0x06AB020F2, 0x0F3B97148, 0x084BE41DE, 0x01ADAD47D, 0x06DDDE4EB, 0x0F4D4B551, 0x083D385C7,
    0x0136C9856, 0x0646BA8C0, 0x0FD62F97A, 0x08A65C9EC, 0x014015C4F, 0x063066CD9, 0x0FA0F3D63, 0x08D080DF5,
    0x03B6E20C8, 0x04C69105E, 0x0D56041E4, 0x0A2677172, 0x03C03E4D1, 0x04B04D447, 0x0D20D85FD, 0x0A50AB56B,
    0x035B5A8FA, 0x042B2986C, 0x0DBBBC9D6, 0x0ACBCF940, 0x032D86CE3, 0x045DF5C75, 0x0DCD60DCF, 0x0ABD13D59,
    0x026D930AC, 0x051DE003A, 0x0C8D75180, 0x0BFD06116, 0x021B4F4B5, 0x056B3C423, 0x0CFBA9599, 0x0B8BDA50F,
    0x02802B89E, 0x05F058808, 0x0C60CD9B2, 0x0B10BE924, 0x02F6F7C87, 0x058684C11, 0x0C1611DAB, 0x0B6662D3D,
    0x076DC4190, 0x001DB7106, 0x098D220BC, 0x0EFD5102A, 0x071B18589, 0x006B6B51F, 0x09FBFE4A5, 0x0E8B8D433,
    0x07807C9A2, 0x00F00F934, 0x09609A88E, 0x0E10E9818, 0x07F6A0DBB, 0x0086D3D2D, 0x091646C97, 0x0E6635C01,
    0x06B6B51F4, 0x01C6C6162, 0x0856530D8, 0x0F262004E, 0x06C0695ED, 0x01B01A57B, 0x08208F4C1, 0x0F50FC457,
    0x065B0D9C6, 0x012B7E950, 0x08BBEB8EA, 0x0FCB9887C, 0x062DD1DDF, 0x015DA2D49, 0x08CD37CF3, 0x0FBD44C65,
    0x04DB26158, 0x03AB551CE, 0x0A3BC0074, 0x0D4BB30E2, 0x04ADFA541, 0x03DD895D7, 0x0A4D1C46D, 0x0D3D6F4FB,
    0x04369E96A, 0x0346ED9FC, 0x0AD678846, 0x0DA60B8D0, 0x044042D73, 0x033031DE5, 0x0AA0A4C5F, 0x0DD0D7CC9,
    0x05005713C, 0x0270241AA, 0x0BE0B1010, 0x0C90C2086, 0x05768B525, 0x0206F85B3, 0x0B966D409, 0x0CE61E49F,
    0x05EDEF90E, 0x029D9C998, 0x0B0D09822, 0x0C7D7A8B4, 0x059B33D17, 0x02EB40D81, 0x0B7BD5C3B, 0x0C0BA6CAD,
    0x0EDB88320, 0x09ABFB3B6, 0x003B6E20C, 0x074B1D29A, 0x0EAD54739, 0x09DD277AF, 0x004DB2615, 0x073DC1683,
    0x0E3630B12, 0x094643B84, 0x00D6D6A3E, 0x07A

    1 Reply Last reply
    0
    • J john5632

      But I read somwhat like this somewhere that do some opeartion with calculated CRC untill we get zero? Is there something like this?

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #22

      It sounds the same to me the same as trying to take a 128 bit md5 hash and regenerate the data that this hash corresponds to. You quite simply cannot do it accurately. a md5 may be used to hash anything from a 5 character password to a 700MB iso file - yet in both instances the hash will still be 128 bits long. While you can generate sequences of characters that will produce the same result when hashed/CRCed, there's no relaiable way without context of choosing the original string.

      1 Reply Last reply
      0
      • J john5632

        I know I can not construct data from CRC, my aim is to get the string which generate the same CRC value

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #23

        john5632 wrote:

        my aim is to get the string which generate the same CRC value

        Hi John, You wouldn't happen to be experimenting with MS10-092[^] would you? :-\ Best Wishes, -David Delaune

        1 Reply Last reply
        0
        • J john5632

          I have a CRC code for particuler string. I need to get the string corssspoding to CRC. My mean to say I need to generate all possible combination of string from lenght 1 to n untill I get the desired CRC value. I know, string may be different from original one. How can I acoomplish this in a fast way?

          J Offline
          J Offline
          john5632
          wrote on last edited by
          #24

          My Aim is to generate a string from know CRC32 value in fastest way.

          L 1 Reply Last reply
          0
          • J john5632

            I know I can not construct data from CRC, my aim is to get the string which generate the same CRC value

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #25

            john5632 wrote:

            I know I can not construct data from CRC, my aim is to get the string which generate the same CRC value

            You have just answered your own quesation them; trial and error is the only way to acchieve what you want, which is going to be very time consuming.

            ============================== Nothing to say.

            1 Reply Last reply
            0
            • J john5632

              My Aim is to generate a string from know CRC32 value in fastest way.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #26

              Having read all the above answers why do you persist in believing this is possible?

              Unrequited desire is character building. OriginalGriff

              L 1 Reply Last reply
              0
              • L Lost User

                Having read all the above answers why do you persist in believing this is possible?

                Unrequited desire is character building. OriginalGriff

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #27

                Richard MacCutchan wrote:

                Having read all the above answers why do you persist in believing this is possible?

                Head, meet brick wall. He just doesnt get it. :)

                ============================== Nothing to say.

                J L 2 Replies Last reply
                0
                • L Lost User

                  Richard MacCutchan wrote:

                  Having read all the above answers why do you persist in believing this is possible?

                  Head, meet brick wall. He just doesnt get it. :)

                  ============================== Nothing to say.

                  J Offline
                  J Offline
                  john5632
                  wrote on last edited by
                  #28

                  I got it :). And everything is possible which can be thought...got it...:)

                  L 1 Reply Last reply
                  0
                  • L Lost User

                    Richard MacCutchan wrote:

                    Having read all the above answers why do you persist in believing this is possible?

                    Head, meet brick wall. He just doesnt get it. :)

                    ============================== Nothing to say.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #29

                    :thumbsup: Thanks, I was a bit worried it was me!

                    Unrequited desire is character building. OriginalGriff

                    1 Reply Last reply
                    0
                    • J john5632

                      I got it :). And everything is possible which can be thought...got it...:)

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #30

                      john5632 wrote:

                      And everything is possible which can be thought

                      Good luck with the impossible. :)

                      ============================== Nothing to say.

                      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