| I had "security of information" as a
subject at university and there are theorem "cryptographics hash,
crypographics pseudo-random numbers generator and symetric cipher is
equivalent". Few weeks after I needed symetric cipher in php, so I
applied that theorem on hash function md5. After md5 was declared broken,
I used same principle on hash function sha1, which exists in better version
of PHP. |
|
Usage: name.php mode password file ....
mode can be 'c' for crypt or 'd' for decrypt. Crypted file $file will be named
$file.md5crypted, decrypted file will be named $file.plain. |
|
| Functions crypt_md5 and decrypt_md5 (resp crypt_sha1 and decrypt_sha1) is called with
parameters buffer to be (de)crypted, password, time of crypting. Password
and time is part of key. I put it extra to emphasize need of dynamic part
of key. |
|