![]() ![]() Then if two distinct users would upload exactly the same content (for example, the text of GPLv3) you would store it once on your disk (in some shared file). Or you could buy some random generating hardware source (like OneRNG).īTW, if you suppose that the user's files contents do not change (so each file is written once at creation time), you could use some cryptographic hash function on them (like SHA 256). using /dev/random (read carefully random(4).) or getrandom(2). ![]() You may want to do likewise (that is code your own random id generator), but you need to be careful about randomness.Īt least, you could use a good PRNG (such as a Mersenne twister one) that you would seed periodically (and at startup) with some random noise, e.g. So the simplest way is simply to use a library function generating them, e.g. ![]() (collisions are not always an issue, if you can make their probability tiny enough) If you want to estimate that probability, use the birthday problem approach. your system would need to run many billions years to observe a single collision). If you generate some random name of several dozen of characters like _5E960vkoXF8_6t2yfMbEM0A_6uBsy060PxH_2YKKKmZkTR6 the collision probability can be made small enough to be negligible (e.g. A possible way is to generate some wide random id.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |