11 ms·
My favourite PDF fact is that it doesn't have to start at the beginning or end at the end of a file. Any sea of bytes that contains a PDF file is an acceptable
by rvense 6y ago
My favourite PDF fact is that it doesn't have to start at the beginning or end at the end of a file. Any sea of bytes that contains a PDF file is an acceptable PDF file...
- TeMPOraL 6y agoDid anyone try to pluck out PDFs from /dev/urandom? How about from radiotelescope feed? Maybe the first evidence of extraterrestrial life will be some poor alien's tax form?
- willis77 6y agoThe digits of pi contain every pdf that ever could and ever will exist.
- mtzet 6y agoWell maybe. We don't know if pi is a normal number.
- SteveGoob 6y ago> We don't know if pi is a normal number. Sure we do. There are plenty of proofs out there that pi is an irrational number.
- andreareina 6y agoIrrational does not imply normal. For example, 1.01001000100001... is irrational but it's certainly not normal.
- x3c 6y agoTechnically, 1.01001000100001... can be normal depending on what ... stands for. :)
- coddle-hark 6y agoOr what 1 or 0 or . stands for.
- bscphil 6y agoWell, obviously. But presumably the ... is meant to imply that this is the summation of 1/(10^(x(x+3)/2)).
- landryl 6y agoActually I'd argue the example you provided is normal, as long as you authorise a particular encoding where every number n you're looking for is encoded as a string of n zeros. It's then trivial to see that every number you can think of is encoded in there, and therefore any data, piece of music or movie that ever existed. (I'm not sure we're allowed to fiddle with the encoding, but since we allow ourselves to represent a piece of music into a number, we're already talking about encoding anyway, so it doesn't seem like cheating to me...)
- enedil 6y agoNormality of a number is with respect to number bases, so your trick with encoding is invalid. Otherwise, every computable number could be considered normal - take an algorithm for generating of it, supply a random string (this is the encoding), disregard the random string, and you have a perfectly valid normal representation of your number. So it is cheating.
- NieDzejkob 6y agoI agree that normality is a specific formalized concept, but you could always require that an encoding function like this is injective.
- dheera 6y agoEncoding doesn't count. Normality is a very specific mathematical concept: https://en.wikipedia.org/wiki/Normal_number https://en.wikipedia.org/wiki/Normal_number Also, 1.01001000100001... is a good example of a number that is both irrational and transcendental but not normal.
- jimktrains2 6y agoNormal in this sense means that all the frequency of all digits approaches a uniform distribution as the length of the sample increases towards infinity. Basically if we could see "all of" π and count all the 0s, 1s 2s, 3s, &c to 9 all the counts would be equal.
- gugagore 6y agoThat on its own can't be right, because 0.12345678901234..... According to wikipédia, you gave a definition for "simply normal", and for normal numbers the distribution of any sequence of digits is uniform. So 00, 01, ..., 99 each occur uniformally too.
- enedil 6y agoMoreover you need to consider it with regards to all other bases than 10 too.
- poizan42 6y agoActually it only needs to be a disjunctive (or rich) number which is a weaker condition. We don't know whether pi is that either for any integer base.
- vcxy 6y ago"Find the earliest valid pdf in consecutive digits of pi"
- btown 6y agoImagine if it was a PDF that simply rendered the number 42.
- ddalex 6y agoIf that happens we know for a fact that we are in a simulation
- paulmd 6y agoI mean, the answer is trivially zero, there exists a PDF-like structure somewhere in Pi, and the offset of that doesn't have to be zero, it can start or end anywhere. So the range [0, N] is a valid PDF.
- ducktective 6y agoI don't think that is a proven fact.
- nroets 6y ago<citation needed> Including a PDF that generates the digits of pi
- adtac 6y agoactually, if you find the citation, let me know, you might be in for an award
- dheera 6y agoPi is thought to be normal but it hasn't been proven yet, so we can't say that for sure, but it's likely true.
- rbonvall 6y agoSince a PDF can begin with non-PDF content, then pi itself is a valid PDF file.
- deleted 6y ago[deleted]
- egocodedinsol 6y agoI'm not sure that's necessarily true. It is true (at least with a non-constructive proof) that if you pick a 'random' real number then it contains all possible PDFs with probability one ( or that the set of numbers for which this is not true has lebesgue measure zero). But I'm not sure it's known that pi has this property.
- gorgoiler 6y agoIs this correct, mathematically? I understand the point that PI contains every possible piece of information, theoretically. However, the chance of finding a given string in PI depends on the string’s length. The longer the string, the more the probability tends to 0. The paradox therefore is that PI contains every PDF, but you will never find them, so in what sense does it really contain them at all?
- lsiebert 6y agoNo, all strings theoretically exist in 𝛑 given enough digits, so longer strings don't reduce probability of existence, they just mean that it will take more digits to find them.
- tsbertalan 6y agoSee Borell-Cantelli lemma.
- gorgoiler 6y agoI looked this up but I’m not sure I grasp your point. Are you saying that: - given a long string, we might ask “can this string be found in PI?” - the probability of finding a long string in PI is infinitely small - the number of possible strings in PI is infinitely large - it’s not possible to decide if the answer is yes or no?
- rezeroed 6y agoIf a tree falls in the forest and no one is around to hear it fall. Or a modern take, if a disease has no symptoms is it really a disease.
- sp332 6y agoOn the other hand, this allows for some incredible polyglot files, like some of the tricks with PoC||GtfO issues where the file is a readable PDF but also a game cartridge and also a zip file with the proof-of-concept code in the issue. And the front cover has the MD5 hash of the whole file printed on it... but that's another trick entirely!
- rvense 6y agoYeah, next time I need a CV it'll be a single-file Ruby web server and PDF that's also an archive of its own sources.
- toomanybeersies 6y agoI'm currently looking for a job as a Rails Developer. I might just do that. Probably won't send it to any recruiters, but it will be a funny anecdote for interviews.
- maddyboo 6y agoCan a PDF file contain a PDF file, and if so can that PDF file contain a PDF file?
- betatim 6y agoYes. Because the PDF standard specifies a mechanism that lets you "attach" files to a PDF :)
- brailsafe 6y agoI worked for PDFTron on their WebViewer product earlier this year, and primarily spent time implementing this feature in JS. Understanding the spec on this was tricky, because standard PDF viewers need to be able to uncompress the stuff you jam in there. It kind of blew my mind that you can literally jam any arbitrary file into a PDF.
- layoutIfNeeded 6y agoZIP files can: https://research.swtch.com/zip https://research.swtch.com/zip
- brailsafe 6y agoYes.
- folmar 6y agoMy stupid bank sends encrypted attachments as an encrypted PDF with HTML file attached.
- cgb223 6y agoMy favorite pdf fact is that the security flags for things like copy protection and passwords are on the viewer to implement so you can just turn them off and all the security is gone
- Drdrdrq 6y agoMy somewhat less favorite pdf fact is that if you do that, you are still breaking protection, legally speaking.
- maxerickson 6y agoSeems to be a reasonable analogy with trespass, where you are violating the law when you cross an invisible line. The need for marking the line varies considerably. And even places with strong roaming rights tend place limits on well marked land.
- smegger001 6y agoSo what if you open it in a postscript viewer instead of a PDF viewer? Because they are compatible formats except for some edge cases like security flags.
- mkl 6y agoPostscript and PDF are definitely not compatible formats. The drawing model is similar, but the structure and code are completely different.
- toomanybeersies 6y agoYou can also circumvent copy protection on PDFs by taking a screenshot, or taking a photo of the screen with your phone.
- r00fus 6y agoThis is not entirely true, you can encrypt PDFs [1] since v1.3 of the spec but the cypher is often so weak (RC4 until v1.6) they can be bruteforced in reasonable amounts of time. [1] https://www.pdflib.com/pdf-knowledge-base/pdf-password-security/encryption/ https://www.pdflib.com/pdf-knowledge-base/pdf-password-secur...
- nostoc 6y agoIt'll depend on the pdf reader you're using, but I'm pretty sure the PDF header needs to start in the first 1K of the file.
- mkl 6y agoSome readers won't need a header at all, I think. Near the end (usually!) of the file there's an index of objects (page data etc.) with byte offsets, which can point to anywhere in the file.
- alexott 6y agoYou can imagine the pain when you need to reliably detect PDF mime type on web proxy, or something like...
- agumonkey 6y agoI can never find the PDF hack talk where author explains all 100 ways to embed things in pdf or pdf into things
- wffurr 6y agoIt's hidden in a PDF in the digits of Pi.
- chuinard 6y agoI never understood that Google security blog post on how they could make 2 different PDFs with different content have the same SHA but now that you mention you can stuff bytes in a file unrelated to the PDF, it makes sense...