A possible way is to generate some wide random id. 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. your system would need to run many billions years to observe a single collision). (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. So the simplest way is simply to use a library function generating them, e.g. 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. using /dev/random (read carefully random(4).) or getrandom(2). This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. Star Notifications Code Pull requests 0 Actions Projects 0 Wiki Security Insights omdahshaabi/LuckCid. 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). MIT license 0 stars 2 forks Branches Tags Activity. 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).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |