Suggest a fast way to do?
-
You can't, CRC is one way only: see here[^].
Unrequited desire is character building. OriginalGriff
-
I am getting the desired string which generate given CRC but it slow because I am generating string from length 1 to n. Is there a way to make it faster? Or Can I get the string legnth from CRC?
john5632 wrote:
Is there a way to make it faster?
It's unlikely, given that you have to try every possible combination.
john5632 wrote:
Can I get the string legnth from CRC?
No, it's a one-way value.
Unrequited desire is character building. OriginalGriff
-
john5632 wrote:
Is there a way to make it faster?
It's unlikely, given that you have to try every possible combination.
john5632 wrote:
Can I get the string legnth from CRC?
No, it's a one-way value.
Unrequited desire is character building. OriginalGriff
-
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?
Do you know what CRCs are for? They are for checking the validity of the data, to make sure it hasnt got corrupted. It is not a representation of the data, it is merely a numerical sum of the data. Therefore you cannot reconstruct the data from the CRC. If you wanted to know all the strings that could create a particular check sum you would have to run through all the permutations and calculate the sum.
============================== Nothing to say.
-
But I read somwhat like this somewhere that do some opeartion with calculated CRC untill we get zero? Is there something like this?
john5632 wrote:
But I read somwhat like this somewhere
Well I guess you need to use Google to find the reference again.
Unrequited desire is character building. OriginalGriff
-
Do you know what CRCs are for? They are for checking the validity of the data, to make sure it hasnt got corrupted. It is not a representation of the data, it is merely a numerical sum of the data. Therefore you cannot reconstruct the data from the CRC. If you wanted to know all the strings that could create a particular check sum you would have to run through all the permutations and calculate the sum.
============================== Nothing to say.
-
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?
What kind of
CRC
you are dealing with?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
What kind of
CRC
you are dealing with?If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I know I can not construct data from CRC, my aim is to get the string which generate the same CRC value
I don't know if it is just a typo but ... your aim is impossible to get. There are infinite strings that can give the same CRC. So first start to think as "plural", then ... the only way is "try/retry/retry ...." until you retain to have enough of them.
2 bugs found. > recompile ... 65534 bugs found. :doh:
-
-
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?
Lookup tables are fast.
-
Lookup tables are fast.
-
I know I can not construct data from CRC, my aim is to get the string which generate the same CRC value
john5632 wrote:
...my aim is to get the string which generate the same CRC value
So are you wanting help with permutations or creating a CRC? Those are two unrelated tasks.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
john5632 wrote:
...my aim is to get the string which generate the same CRC value
So are you wanting help with permutations or creating a CRC? Those are two unrelated tasks.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
So then why not focus on a much smaller problem? Trying to build the space shuttle in one setting will never work. You need to build it in pieces. When each of those smaller pieces are working, your overall problem will be solved.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
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?
I have read through this chain (I was going to say 'string' but that would only confuse the issue) You have to understand folks here, many are just as curious about the 'why' as about the 'how'. You haven't answered 'why are you doing this?' To many, myself included, you have embarked on a totally useless exercise. Why in the world would you want a random string of characters that happens to generate the same CRC32 that you already have in your hand? You cannot possible reconstruct the original string so of what interest is a random string with the same CRC32. Unless you are trying to fool some other program who knows the CRC32 of the data it wants and you are trying to pump some junk at it for some amusing or nefarious reason. So, tell us 'why' you need such a string, you may find some folks who find the problem more interesting than it seems so far.
-
I have read through this chain (I was going to say 'string' but that would only confuse the issue) You have to understand folks here, many are just as curious about the 'why' as about the 'how'. You haven't answered 'why are you doing this?' To many, myself included, you have embarked on a totally useless exercise. Why in the world would you want a random string of characters that happens to generate the same CRC32 that you already have in your hand? You cannot possible reconstruct the original string so of what interest is a random string with the same CRC32. Unless you are trying to fool some other program who knows the CRC32 of the data it wants and you are trying to pump some junk at it for some amusing or nefarious reason. So, tell us 'why' you need such a string, you may find some folks who find the problem more interesting than it seems so far.
Chuck O'Toole wrote:
Unless you are trying to fool some other program who knows the CRC32 of the data it wants and you are trying to pump some junk at it for some amusing or nefarious reason.
seems likely, to me.
-
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 -
But I read somwhat like this somewhere that do some opeartion with calculated CRC untill we get zero? Is there something like this?
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.