HACKER Q&A
📣 danielovichdk

Could true randomness come from sparkles from light reflecting the sea?


I am not well rounded in cryptography, but I had this thought about having a camera take pictures of the sea, and somehow turn the sparkles from the light hitting the sea into a useful indicator for some kind of randomness.

So the camera takes a shot. Software looks at the image, collects the "sparkles", somehow counts and sums them up, perhaps multiples them with a second random counter and then we have a true random number.

Does it make sense ?


  👤 Hatrix Accepted Answer ✓
This reminds me of the wall of lava lamps for random numbers: https://en.wikipedia.org/wiki/Lavarand

👤 h2odragon
There is randomness there, but it'd require a lot of filtering to get: there's a lot of rhythms too. The lavarand stuff already mentioned probably resembles what you'd need.

Once you're going to all that work the noise source you use can be almost anything: sensitive enough ADC hooked up to a ground rod would probably do.


👤 talldayo
It makes sense, but I wouldn't rely on it. Current pseudorandom number generation kinda works the same way; you just seed entropy from random peripherals until you have enough randomness to pretend that you're random. It's not a perfect solution, but the "kitchen sink" nature of PRNG seeds makes it hard to crack.

The problem with seeding natural patterns like water anistropy is the fact that it's still a pattern. Depending on the time of day, large bodies of water will vary their chop and present more or less sparkles depending on the position of the sun/moon. If an adversary wanted to bruteforce your sea-sparkle cipher, they could reference recent moon phases and weather to narrow down the potential entropy that seeded the key.

It's a cool idea worth building, but still a toy.


👤 rini17
Noise from the waves hitting shore would be more practical, works in the night and software to seed randomness from audio already exists.

👤 g4zj
I'm not convinced true randomness exists. If every attribute of every particle in the universe could be known at a given time, like a snapshot, and we had unlimited resources to simulate the universe as a whole from that point in time, we could perfectly predict literally anything about the future, including the sparkles in every waveform of all of earth's oceans.

This is my understanding of what distinguishes randomness, e.g. pseudorandomness, from "true" randomness. Then again, I'm an idiot, so I would welcome any respectful attempt at helping me better understand the difference, or why true randomness might actually somehow be possible (even theoretically).


👤 pizza
Tile a ton of these photos into one large image, grayscale it and threshold for high brightness, then apply a lossless image compression algorithm. Compare it with the combined size of the same process on each image individually. I bet (excluding the amortized cost of file metadata overhead) the tiled image will be smaller in terms of bits per pixel, suggesting correlation.

Also, the perplexity is 2^H(x) ~ 2^len(compressed(x)) when compressed optimally. You could compare it to an image of the same size where each pixel, on average, draws values from a uniform '2^H(x)'-sided die. So you could use this trick to compare it to other images, lets say.


👤 lnwlebjel
I'm not sure if it makes sense from a randomness generator point of view, but it shouldn't be to hard. You could even use the buoy cameras provided by NOAA, eg:

https://www.ndbc.noaa.gov/images/buoycam/W00A_2024_08_16_143...

FFT the image and/or remove the signal with a high pass filter and you would have a pretty good source of high frequency noise. The opposite of this is done for measuring waves, for the record.


👤 qazxcvbnm
Many comments point to regularities being present in waves. This makes me wonder; for eg sampling problems, it is possible to construct a sampling of a fair coin given a biased coin (eg discard HH, TT, take HT and TH to be the flip; I believe many other sampling methods exist). Given a source of low entropy randomness, what is the best way to convert it into a source indistinguishable from true randomness? Would suitably hashing the low entropy source be sufficient, since good hash functions are supposed to possess avalanche effect and be indistinguishable from randomness (perhaps with schemes of eg recursive hash salting to guard against “replays” from the source) (Is this the kind of stuff that goes on in the kernel /dev/random)?

👤 creer
Light sparkles probably contain randomness yes, if your image processing doesn't remove it. So for example, perhaps find a way to not discard location in the image, timing from image to image, intensity - all of which will contain some randomness. Subject to someone learning that you are doing this and shining a light into your camera. And I don't think you need to go to any effort at all to remove the non-random part - as long as you actually do collect the random aspect.

An issue with randomness is how much you are collecting. Ideally your system generates both the random numbers and an estimate of how much randomness it is collecting. Some uses require a lot, some very little.


👤 dekhn
Yes but you need additional processing to turn it into a high quality random stream. There are other alternatives based on solid state electronics that are more affordable, easier to implement, and far more amenable to scale-up

👤 BobbyTables2
Correlation is also the enemy of random generators since it causes bias and makes some values easier to predict.

The number of sparkles may have some periodic correlations due to wave activity, wind, etc.

There are perhaps easier ways, involving simpler hardware, such as measuring electrical noise in a diode, etc.


👤 ericpauley
Yes, but getting true randomness is not actually that hard. Many modern chips have true randomness generators, and other noisy system components can also be used. The RNGs used in operating systems are designed to take in arbitrary data to improve randomness.

👤 bell-cot
Yes. Kinda. If you're savvy about how predictable those patterns of sparkles tend to be, and never try to harvest more randomness than is actually there.

👤 fred_is_fred
Could we do the same with sunspots and flares?

👤 vunderba
I mean if you're going to do that, you could probably just dial up the ISO setting way up on your camera, place it on a lazy susan spinning motorized dolly, and continuously poll the noise as a means of establishing a RNG seed. I don't know how truly random that would be, but it'd be a helluva lot simpler than oceanic reflection data.