nokonoko / Pomf

Simple file uploading and sharing, source for the now shut down site Pomf.se
MIT License
463 stars 98 forks source link

Add capital letters to name generator in upload.php #20

Open mrjkuhl opened 10 years ago

mrjkuhl commented 10 years ago

This would increase the range of possible names by a wide margin, and so would be beneficial to a growing fiie host.

NuckChorris commented 10 years ago

there were capitals previously but math has occurred and determined that the current range is plenty. Additionally, adding capitals makes it harder to type manually. Perhaps adding digits would be better?

mrjkuhl commented 10 years ago

@NuckChorris , a simple way to avoid mathematical problems with using capital and lower case letters would be to do a preroll before determing the letter set chosen from. This could be done by calling mt_rand(0, 1) within an if function. If the result is 0, then a range of A-Z letters would be chosen from. If the result is 1, the letters chosen from would be a-z.

This is of course assuming that your math problems were from non-english characters being selected, as there are some of those sitting between Z and a on the ascii table ([, \, ], ^, _, and `).

mrjkuhl commented 10 years ago

@NuckChorris , I should also add that numerals can be taken into account as well, though the range of the roll would be have to expanded to 0-30, I believe, to get proper representation between all of the possible characters.

NuckChorris commented 10 years ago

There's no math problems, I simply said we ran the numbers and found the current set sufficient for now until we can produce something hugely better

NuckChorris commented 10 years ago

That ^ there's no reason to add substantially more because we only have a few hundred thousand files last I checked. 300 million names is plenty for now. Maybe we'll add 0-9 and then it'll be 36^6, but mixed case makes transcription of URLs hard.

zebracanevra commented 10 years ago

I deleted my comment because I thought maybe my math was wrong, but no, I'm right, ~308 million filenames.

I'd say as long as you fill less than 1% of those you should be fine. That's to prevent brute forcing the uploads. Maybe once 2 million files are uploaded a larger set should be chosen

nokonoko commented 9 years ago

Around 1,500,000+ are uploaded as of now, so change it around 2 million so it's harder to bruteforce?

thehowl commented 9 years ago

I guess you could add one letter, to get to 8,031,810,176 possible combinations. Even if we'd try to fill 1% of it, it would require 80,318,102 which can host 53 times the current number of uploaded files, approximately.

Or if we're evenfags and we'd want to increase it to 8, it would come to 208,827,064,576 possible combinations. To fit a 1% of it it would require 2,088,270,645 files, approximately 1392 times the current number of files. At that point pomf would have been already bought by Yahoo!.

So ¯_(ツ)_/¯ - whether one you choose it's kind of hard to reach than quantity of numbers.

(EDIT: lol markdown fucking up muh ¯_(ツ)_/¯ )