Hi,
If I have CRC32 (Cyclic Redundancy Checksum) then how can I get string from this.
Hi,
If I have CRC32 (Cyclic Redundancy Checksum) then how can I get string from this.
If you want to get the crc32_value
as an hexadecimal string:
char crc32_string[64];
sprintf(crc32_string, "%8X", crc32_value);
You were not clear enough what format, what kind of string you want. Look at MSDN to find out which sprintf
works for you. There are plenty of them with a more secure parameter checking.
The C++ way to convert an hexadecimal number to a string is the following :
std::stringstream s;
s << std::hex << crc32 /*the CRC32 number that you have computed somewhere*/;
std::string resultString = s.str();
Hope this answers your question. Otherwise precise what you expect !
The question is ambiguous.
If you mean "how can I convert the CRC32 integer to a string?", that is fairly easy. You can use a std::ostringstream or the sprintf() or itoa() functions.
If, as I suspect, you mean "I have a CRC32 generated from a string and I want to get back to the original string", then the answer is "it is impossible". CRC is a one-way transformation and there is no way to go backwards.