Hello,
How to calculate the crc32 string of a wxString?
calculate the crc32 of a wxString
calculate the crc32 of a wxString
Currently developing, with wxWidgets, an open sources multi-platform (Windows, Linux, MacOs) download manager/accelerator with an Web sites aspiration function named SPGet:
http://spget.sourceforge.net/
http://spget.sourceforge.net/
Not that hard. You can start with a 32 bits begin hash (you will have to find a hastable) and then do the following:
- Fetch byte
- Shift byte into 32 bits from the left
- XOR with previous hash
- Set new hash as previous one
And continue to do this until you have shifted all bytes in there. You end up with a CRC32 hash you can use to test if your data is changed or not.
There are better ways, I think for more certaintly changed contents arte spotted. you should use a MD5 checksum. This one is more powerful.
- Jorgen
- Fetch byte
- Shift byte into 32 bits from the left
- XOR with previous hash
- Set new hash as previous one
And continue to do this until you have shifted all bytes in there. You end up with a CRC32 hash you can use to test if your data is changed or not.
There are better ways, I think for more certaintly changed contents arte spotted. you should use a MD5 checksum. This one is more powerful.
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact:
Hi,
Isn't that what I wrote? Anyway, if it was unclear thanks for clarifiying for me It was written around 10:00 dutch time so I am pretty impressed with my own clarification at that hour
- Jorgen
Isn't that what I wrote? Anyway, if it was unclear thanks for clarifiying for me It was written around 10:00 dutch time so I am pretty impressed with my own clarification at that hour
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact:
Hi!
If you need a quick solution, wxChecksums (http://wxchecksums.sourceforge.net/mainpage_en.html) has support for CRC32, MD5 and SFV.
If you need a quick solution, wxChecksums (http://wxchecksums.sourceforge.net/mainpage_en.html) has support for CRC32, MD5 and SFV.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Ahh ok. No that's not what I meant.
Good call upCASE I still believe MD5 is better then CRC32. But it all depends on where you are going to use it for, or what the performance will be.
- Jorgen
Good call upCASE I still believe MD5 is better then CRC32. But it all depends on where you are going to use it for, or what the performance will be.
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Yes, it really depends as CRC and MD5 are more or less completely different. CRC, as the name suggest, is a cyclic redundancy algo, whereas MD5 is a hashing algo.Jorg wrote:Good call upCASE I still believe MD5 is better then CRC32. But it all depends on where you are going to use it for, or what the performance will be.
With CRC32 you can identify bit errors and (if I'm not mistaken) correct one bit erros. With MD5 this is not possible. But MD5 is more "secure".
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
-
- wxWorld Domination!
- Posts: 1339
- Joined: Wed Aug 03, 2005 8:10 am
- Location: BANGALORE, INDIA
- Contact: