I was looking into this code base (https://github.com/vstoykovbg/doubleslow) and the following phrase caught my attention:

DANGER of catastrophic data loss! One bit flip (due to cosmic rays for example) can make the result of the hash functions completely different. Run the scripts several times to confirm that they produce the same output given the same input. Read how these scripts work and why the risk of bit flip is high (hint: RAM usage).

Should we be hashing inputs more than one time to avoid this kind of issue?

  • You're far more likely to encounter a failed ram bit than a cosmic ray flip, assuming you are on Earth. It used to be common to have 9-bit bytes with the 9th bit acting as parity to detect single bit errors. Parity is less common today in most environments because of cost and performance trade offs with the probability of increased error due to the parity itself failing. Spacecraft subject to Cosmic Rays generally use a more complex ECC (Error Correcting Code) memory to auto correct single bit errors and detect an odd number of bit errors. Aug 31, 2020 at 20:18

1 Answer 1


It is very unlikely that the bit flip happens during hashing - which is a very short time and there are only comparably few instructions involved compared to the preceding processing of the input. It is instead much more likely that any bit flips already happened before, i.e that the hashing is already done on corrupted input.

  • I think the quote (not a security warning just danger) not restricted to the cosmic rays, it is just an example. Also, it only considers this case and warns about it. The post tries to warn you that 1/1M you may get incorrect, so execute again...
    – kelalaka
    Aug 31, 2020 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .