I didn't know whether to put this in webmastering/programming, or here... but decided it's probably more fit for here.
I was dissecting a PHP example found in the manual to better understand it, which I feel I now do. The example is found here. After understanding what it does (and after understanding - for the most part - the other hashing functions like hash and crypt) is whether or not mcrypt (more specifically, mcrypt_encrypt) can be used for password hashing, or if it should only be used for data. It seems like it's only to be used for data, so I answered this myself... but correct me if I'm wrong.
The answer I found here explains how one-way hashing functions shouldn't be used for passwords... which I understand (since mcrypt isn't one way). However, why isn't it?
I know mcrypt uses both a key and IV's to encrypt/decrypt data so that the encrypted data is never the same (even in different parts of the same block of data). I also know that WEP (in 802.11 wireless) isn't a one-way function (correct me if I'm wrong) and also uses initialization vectors, which can be analyzed to figure out the encryption key and ultimately decode transmissions. Is this the same thing with PHP's mcrypt(), and the reason it's not a one-way hashing function? Could enough IV's be gathered to recognize/compute a pattern to discover the key?
Also.. what are some examples of one-way hashing functions? I don't really know any other than WEP... since it seems like at first they're thought to be... or aren't they?
I know a lot of this sounds like I already know.. but I was just wanting to strengthen my understanding of it all... especially since I'm know dealing with some of this first hand somewhat (with PHP).
Thanks
Edit: Nevermind.. I just thought about it and realized why. mcrypt_encrypt has an opposite function for decryption - mcrypt_decrypt, which decrypts it using the IV/key. The other functions are one way because they don't have an opposite function to decrypt the encrypted data. I guess I should wait a little bit before asking question... although this one I did
If anyone wants to go into why one way functions are one-way... go ahead, however.. because that I don't really know, although the algorithm can't be used directly in reverse and must be bruteforced. Thanks anyways guys..
I was dissecting a PHP example found in the manual to better understand it, which I feel I now do. The example is found here. After understanding what it does (and after understanding - for the most part - the other hashing functions like hash and crypt) is whether or not mcrypt (more specifically, mcrypt_encrypt) can be used for password hashing, or if it should only be used for data. It seems like it's only to be used for data, so I answered this myself... but correct me if I'm wrong.
The answer I found here explains how one-way hashing functions shouldn't be used for passwords... which I understand (since mcrypt isn't one way). However, why isn't it?
I know mcrypt uses both a key and IV's to encrypt/decrypt data so that the encrypted data is never the same (even in different parts of the same block of data). I also know that WEP (in 802.11 wireless) isn't a one-way function (correct me if I'm wrong) and also uses initialization vectors, which can be analyzed to figure out the encryption key and ultimately decode transmissions. Is this the same thing with PHP's mcrypt(), and the reason it's not a one-way hashing function? Could enough IV's be gathered to recognize/compute a pattern to discover the key?
Also.. what are some examples of one-way hashing functions? I don't really know any other than WEP... since it seems like at first they're thought to be... or aren't they?
I know a lot of this sounds like I already know.. but I was just wanting to strengthen my understanding of it all... especially since I'm know dealing with some of this first hand somewhat (with PHP).
Thanks
Edit: Nevermind.. I just thought about it and realized why. mcrypt_encrypt has an opposite function for decryption - mcrypt_decrypt, which decrypts it using the IV/key. The other functions are one way because they don't have an opposite function to decrypt the encrypted data. I guess I should wait a little bit before asking question... although this one I did
Last edited: