Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. I don't mean to undermine your authority, Zane, but I have one last comment. PugJr, the thing you're missing here is that this is mathematics. In mathematics a statement must be proven true, so it doesn't matter how big you make your range, and it doesn't matter that you say "I know your string is shorter". That's not a math proof. People who still believe they can "crack"/decrypt/reverse a hash needs to reread this topic or preferably take some math courses. Okay, now I'll leave.
  2. This is where we are missing each other. No, my answer would be is that its either 1 or 0. But it can not be 2, 3, 4, 5, +. Well, then it's not really an answer is it? Saying "it's either 1 or 0" in response to "is it 1 or 0" isn't an answer. And of course it's not 2, 3 or 4. Those were undefined for that purpose. I could have "square or triangle", "monkey or donkey", "A or B". It is pointless because it's false. How do you know when your "large number" is large enough? Also, this is my new lottery coupon: [tex]|A| = 7, \forall a_i \in A : 0 < a \leq 36[/tex] Now I won the Danish lottery. I'm a millionaire. YAY!! I'll go claim my money tomorrow morning, and they better give it to me because I was right about the numbers that were drawn.
  3. The problem with your logic is just that the range of all integers reaches beyond a googolplex. You can always add +1. That's kind of what infinity means. Besides, that is completely irrelevant. If I give you two numbers: 1 and 0, and tell you that one is correct (what whatever arbitrary purpose) and the other is incorrect., how are you going to know which one? You can guess all you want, but you won't know the answer until I tell you. I think the biggest problem is that you don't understand what a hash table is. It's just a data structure like many others such as a heap, trie, linked list, array and so on. It's not just a "string of characters" or whatever you seem to believe it is.
  4. You need to learn how to read. You cannot "crack" a hash. It doesn't make any sense to say that. Believe it or not, but hash tables are not exclusively used for passwords. In fact, I'm sure you've used them extensively. An associative array is just another word for a hash table. Taking it completely away from this password thing (which is clearly confusing you), imagine a dictionary. We define the hash of a word as the first letter of the word. Using the English alphabet this means it can be a through z, i.e. 26 different hashes. So "monkey" has the hash "m" and "house" has the hash "h". If I simply give you the hash "f" you cannot possibly revert that back to the word I had in mind. You cannot have an infinite amount of anything. Hilbert's paradox of the grand hotel illustrates this in a very clear way. Imagine a hotel with an infinite number of rooms that are all booked. A guest's room number is denoted n. Now someone comes into the hotel asking for a room so the hotel manager asks all the guests to move to room number 1+n. This leaves room for our new guest in room number 1. Now an infinite number of new people ask for rooms, so the hotel manager asks everybody to move to room number 2n. This leaves all the odd room numbers available. So even though all the infinite number of rooms were booked there were place for an infinite number of new guests. You cannot both have everything booked and have rooms available, so it must be impossible to have an infinite number of something. This kind of argument is called reductio ad absurdum. You first assume that something is true, but find that it being true leads to an absurd situation thus the initial assumption must be false.
  5. Well, Danish phone numbers are eight digits, so now you're down to 10,000,000 (remember that numbers start from 0). However, you know that it ends with 4, so that means you're down to 1,000,000. Not all numbers are used though. Nobody has the phone number (+45) 00000000 for instance, so if you lookup the valid ranges you can further decrease it. See how easy I am making it. Limiting the range by telling it's a phone number, giving you hints to further decrease the possible range. Yeah, @MadTechie, that password is probably pretty random consisting of lowercase/uppercase/numbers etc. I said you can crack MD5. But only if it's relatively simple. But tbh, who actually puts effort into making a secure password (except programmers etc)? Most people use the same password for everything. Something like "hello" or "i love xxx". They would be crackable. This is a mathematical subject. It doesn't matter if "hello" matches the hash you are given because there are an infinite number of other matches, so you have no means of verifying that "hello" was the original value or one of the other infinite matches.
  6. I suppose I can also reiterate one of my previous challenges in this topic. Given a hashing function f(x) = x mod 10, my phone number inserted into that function has the output 4. Now give me a call. I'll pay fees on your phone bill and a little extra.
  7. You know, I could write a long post now, or you could read this thread
  8. It solves that by having some inputs share the same hash. Consider this function: f(x) = x mod 10. Here you have f(1) = f(11) = f(21), etc. (I had an example with that one earlier) Also consider this: g(x) = x2 => g(x) = g(|x|) (e.g. g(1) = g(-1), but 1 != -1). These functions are surjections, that's to say they "fill out" their codomains. Said in another way, a hashing function is a function of the form [tex]f : X \to Y[/tex] where [tex]|X| = \infty[/tex] and [tex]|Y| \in \mathbb{R}[/tex].
  9. That could actually work (like one second, or even lower if it allows that). Set a really low timeout and then use ignore_user_abort on the called script.
  10. Well, foreach is easy to do using a for loop, but only for enumerated arrays. foreach is a language construct too though, so you can't really implement it yourself. The string and array functions should be possible without too much trouble though. You could try str_rot13, str_replace, trim or perhaps ucwords.
  11. isset() is a language construct, so I still win Here you have a few others: function myImplode($glue, array $pieces) { $string = ''; $maxIndex = myStrlen($pieces)-1; // myStrlen() will work for arrays because of the way it's written foreach ($pieces as $i => $piece) { $string .= $piece; if ($i != $maxIndex) { $string .= $glue; } } return $string; } function myStrpos($haystack, $needle, $offset = 0) { for ($i = $offset, $length = myStrlen($haystack); $i < $length; $i++) { if ($haystack[$i] == $needle) { return $i; } } return false; } function myStrrpos($haystack, $needle, $offset = 0) { for ($i = myStrlen($haystack) - 1 - $offset; $i >= 0; $i--) { if ($haystack[$i] == $needle) { return $i; } } return false; }
  12. It's in TBB. You should be able to view it.
  13. Heh... you cheated and used built-in functions. Here you go with a with an explode() implementation that doesn't use any of PHP's built-in functions whatsoever. function myStrlen($string) { for ($length = 0; isset($string[$length]); $length++) {} return $length; } function myExplode($delimiter, $string, $limit = null) { $parts = array(); for ($i = 0, $j = 0, $length = myStrlen($string); $i < $length; $i++) { if ($string[$i] == $delimiter && ($limit === null || $limit > $j+1)) { $j++; continue; } if (!isset($parts[$j])) { $parts[$j] = $string[$i]; } else { $parts[$j] .= $string[$i]; } } return $parts; }
  14. Sorry, something like this: $doc = new DOMDocument(); $doc->LoadHTMLFile('http://www.phpfreaks.com/'); $d = new DOMDocument(); $d->appendChild($d->importNode($doc->getElementById('header'), true)); $html = trim(preg_replace('#(^<[^>]+>|</[^>]+>$)#', '', $d->saveHTML()));
  15. Well, I think pcntl_exec doesn't wait for the process to finish. I'm not entirely sure though. It's not available on Windows though. Edit: Wait, no, it says "Executes specified program in current process space". I just thought there was some function that could do that. Maybe I'm wrong.
  16. <?php function getInnerHTML(DOMElement $node) { $body = $node->ownerDocument->documentElement->firstChild->firstChild; $document = new DOMDocument(); $document->appendChild($document->importNode($body,true)); return $document->saveHTML(); } $doc = new DOMDocument(); $doc->LoadHTMLFile('http://www.phpfreaks.com/'); echo getInnerHTML($doc->getElementById('header')); Output: <title>PHP Freaks - Index</title>
  17. What exactly are you having trouble with? I don't think anyone is going to walk you through it line by line. Just read the code.
  18. Actually, you could make the user request spawn an additional process and just move on.
  19. What is there to explain? All we know is that it's an array. You're the person who found it, so you know more about it than us.
  20. Why doesn't nl2br() work for you?
  21. Nowhere are you allowed to advertise (except in your signature in a non-distracting manner). You can ask for comments in the beta testing forum, but if it's worded like an advertisement it will be regarded as such.
  22. Well, what does "watermarking" mean? "Adding an image on top of another" or "adding some text on an image". Now go take a look at the manual for functions that do that.
  23. I remember that one. I completely owned you all. There wasn't even any competition
  24. I guarantee you, in half a year you'll think what you did sucks. If you don't something is wrong and you haven't learned anything in the mean time.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.