3 ms·
Per recent postings on HN about /dev/urandom, wouldn't it fine to use data from that, rather than bothering with AES output. /dev/urandom should be cryptographi
by JensRex 7y ago
Per recent postings on HN about /dev/urandom, wouldn't it fine to use data from that, rather than bothering with AES output. /dev/urandom should be cryptographically safe.
- jpdaigle 7y agoBut how would you detect corruption in this case? If you write random bytes then read them back, you have nothing to compare them to.
- tzs 7y agoLet b be the number of bytes per block. 1. Test N blocks of the disk, where N is small enough that you can keep a 128-bit hash of each block of random test data in memory for the duration of the test. You can use the hashes to verify that read data is correct. 2. Then test another Nb/8 blocks using the N blocks from #1 to store 128-bit hashes of the Nb/8 test blocks. 3. Then test N(1+b/8)/8 blocks, using the blocks from #1 and #2 to hold the hashes. 4. Then test N(1+b/8 + b/8^2)/8 blocks, using the blocks from #1 and #2 and #3 to hold the hashes. ... (Maybe replace the 8's in that with 7's, and in each block of hashes include a hash of the 7 hashes, so you can check that hash blocks are reading back fine?)
- jeremysalwen 7y agoSo basically you are demonstrating that the method is more complex than OPs, with absolutely no benefit, which I think was the point.
- JoachimSchipper 7y agotzs' solution is clever, but if you're planning to simply toss a bad drive (and don't particularly care which blocks are bad), something like tee /dev/the/disk </dev/urandom | sha256sum and sha256sum /dev/the/disk should also work fine.
- JensRex 7y agoYou're right, I don't know what I was thinking with that comment.
- rini17 7y agoHave you ever tried dd'ing fom it? It is slooooow.