in reply to Re: Calculating corruption
in thread Calculating corruption

well yeah that would work great if all these files were identical and encrypted the exact same way, but sadly they are not. upon further reading, i started looking for "checking a string for randomess", and that is a dead end it seems as well because how would you define "random" isnt everything "random"? lol

Replies are listed 'Best First'.
Re^3: Calculating corruption
by LanX (Saint) on Oct 18, 2014 at 21:49 UTC
    You asked how to check if a file is corrupted.

    Store a checksum of the encrypted file, best together with the file, maybe appended to the end.

    If you meant something different, you may want to try to explain it...

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

    update

    btw: Trying to decrypt it should be enough, I'm not aware of any common encryption which can be reversed if corrupted.

      but storing a checksum of the encrypted file will be useless wouldnt it? because i am not sure if even the first file will be corrupted. i wouldnt want to generate a hash for a corrupted file to check with. i need to check the first original file for corruption. and like i say, the file cannot be decrypted because the keys to decrypt it are unknown afaik :l

      the next idea i had would be checking it for randomness. an excrypted files should be very low or null on repeating byte characters, shouldnt it? but how do you check a file for byte character randomness, or randomess at all? <.<

        There's no solution to the problem you've described. And I don't loosely mean there's no tractable solution to the problem; I mean there's utterly no solution at all.

        UPDATE:  I just realized someone else has already made this same point elsewhere in the thread.

        If you can't checksum the file right after encryption then better try Dowsing !

        Anyway I expect most encryption methods to detect corruptions by themselves, hence a pretty fruitless discussion.

        Cheers Rolf

        (addicted to the Perl Programming Language and ☆☆☆☆ :)

        PS: Talking about statistics, ignoring users with many trailing digits proofs to be an excellent rule of thumb to avoid "corrupted" (and cryptic) questions.

        Thanks! :)

Re^3: Calculating corruption
by GotToBTru (Prior) on Oct 19, 2014 at 16:23 UTC

    The idea is to generate the checksum right after encryption has occurred. Then whenever the integrity of the file needs to be checked, the checksum of the encrypted file can be recomputed and compared to the baseline value. This will detect corruption to a high level a confidence, if a suitable checksum function is used. It appears in your case that this was not done, so there is no baseline with which to compare. Detecting if the encrypted files have been corrupted from their original state is now impossible.

    Computing the checksum of the files in their current state will enable you to detect any further corruption. If the concern is deteriorating media, this might be useful.

    I understand that certain encryption methods leave telltales in their encrypted files, some of which could be detected via a statistical analysis. This would allow you to tell if a certain file still looks "pretty much like most files encrypted using this method." If that would actually provide any level of reassurance to you, go for it.

    1 Peter 4:10