C library with auto checksum

Asked

Viewed 47 times

0

I’m creating a library/library for Android in C, and I’d like to know how to get it to display its own checksum, so, should you suffer any "alteration" once compiled, the checksum change.

  • 1

    I don’t know if there is something specific for android, but I have a case like this in an application of mine for another platform, that made me stop to think a little. The checksum changes if you put its value within the application itself. There are some properties of CRC32 that would even make a "discount" in the calculation, but the solution I found was a little different, was to put the checksum and its position in the code, so the code "jumps" the own position in the conference calculation. The precaution you have to take is that so it’s easy for someone to change the code + value.

  • I think I get what you mean, it’s gonna be hard for me to get it on my own. It is to crack the cuckoo :) Yeah, have this but to change the code, I do not doubt this possibility.

  • You could simply add a CRC32 in the last 4 bytes of the executable, but it is much easier to move. If it is an online application, it is much easier for CRC to stay on your server. The application connects, passes the CRC32 of it, and the version, and the server simply says whether it’s right or not.

  • I’ve been thinking, is that using a fopen opening its own library and checking the md5 would not be a possible solution?

  • I prefer CRC to these things. MD5 is slow and not suitable for extensive data. Anyway, it falls into the initial problem I commented: how do you store this MD5 in the application later, without changing the value itself?

  • This is the question, not store, to prevent it from being changed, so it should be taken dynamically, only the server has this value, for checking. Unfortunately I do not have chief to create a code like this, but I’ve found a remains to know if this is what it does, take the CRC32.

  • CRC32 usually has simple implementation in any language. just go reading the file to pieces, and feed the function. Usually implementations allow CRC32( string, previous value ) so you don’t need to read the whole file in memory. It will calculate to pieces, and using the last calculation as the previous value.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.