| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2004
28 posts
Gave thanks: 0
Thanked 0 times
|
PHP parse error.
I'm getting an error on this line of code but it looks fine to me.
unexpected T_VARIABLE on line 13 $size = mcrypt_get_iv_size('rijndael-256', 'ofb'); Anyone see what the problem is, I haven't done this sort of thing for a long time. Thanks. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2004
28 posts
Gave thanks: 0
Thanked 0 times
|
I am more or less using the code from the second example on this page. I'm just trying to get it to work -- elegance comes later.
http://us4.php.net/manual/en/functio...odule-open.php Code:
<?php
$pacs = "texttexttext";
$pcsi = "lfact";
echo "this is a test for crypt <br>";
echo "we'll crypt texttexttext can you see it below<br><br>";
/* Open the cipher */
$dfact = mcrypt_module_open('rijndael-256', '', 'ofb', '');
/* Create the IV and determine the keysize length, used MCRYPT_RAND
on Windows instead */
$size = mcrypt_get_iv_size('rijndael-256', 'ofb');
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
$ks = mcrypt_enc_get_key_size($dfact);
/* Create key */
$key = substr(md5($pcsi),0,$ks);
/* Intialize encryption */
mcrypt_generic_init($dfact,$key,$iv);
/* Encrypt data */
$pfact = mcrypt_generic($dfact,'$pacs');
/* Terminate encryption handler */
mcrypt_generic_deinit($dfact);
echo "is this text crypt $pfact";
/* Initialize encryption module for decryption */
mcrypt_generic_init($dfact,$key,$iv);
/* Decrypt encrypted string */
$efact = mdecrypt_generic($dfact,$pfact);
/* Terminate decryption handle and close module */
mcrypt_generic_deinit($dfact);
mcrypt_module_close($dfact);
/* Show string */
echo "is this text decrypt $efact <br><br>";
echo "thanks either way";
?>
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|