Jump to content


Photo

Please help me...


  • Please log in to reply
6 replies to this topic

#1 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 26 July 2006 - 11:46 AM

Dont tell me this is in the wrong forum or something, my brain is getting angry at PHP and GD. (move it if you want to)
1. How do you encrypt strings and being allowed to decrypt them?
2. The latest version of GD available on windows does not support PHP, how can i get an older one? (i might be able to get older ones but yet help me if you can)

I really need help.
and for the first one dun give me MD5 or SHA1 cause they cant be decrypted
I am a PHP Guru, ask me questions if you want to

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 11:50 AM

gd is built into php enable it in php.ini

and lookup hash ok
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 26 July 2006 - 11:56 AM

gd is built into php enable it in php.ini

and lookup hash ok

Yep, GD has been packaged with PHP since version 4.3. Although I believe all hashing algorythms are one way.

For what reason do you want to be able to encrypt/decrypt strings? I don't think there are any encrypt/decrypt functions built into PHP as standard...

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 12:00 PM

<?PHP
/*
Description : A function with a very simple but powerful xor method to encrypt
              and/or decrypt a string with an unknown key. Implicitly the key is
              defined by the string itself in a character by character way.
              There are 4 items to compose the unknown key for the character
              in the algorithm
              1.- The ascii code of every character of the string itself
              2.- The position in the string of the character to encrypt
              3.- The length of the string that include the character
              4.- Any special formula added by the programmer to the algorithm
                  to calculate the key to use
*/
FUNCTION ENCRYPT_DECRYPT($Str_Message) {
//Function : encrypt/decrypt a string message v.1.0  without a known key
//Author  : Aitor Solozabal Merino (spain)
//Email    : aitor-3@euskalnet.net
//Date    : 01-04-2005
    $Len_Str_Message=STRLEN($Str_Message);
    $Str_Encrypted_Message="";
    FOR ($Position = 0;$Position<$Len_Str_Message;$Position++){
        // long code of the function to explain the algoritm
        //this function can be tailored by the programmer modifyng the formula
        //to calculate the key to use for every character in the string.
        $Key_To_Use = (($Len_Str_Message+$Position)+1); // (+5 or *3 or ^2)
        //after that we need a module division because canĀ“t be greater than 255
        $Key_To_Use = (255+$Key_To_Use) % 255;
        $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);
        $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);
        $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;  //xor operation
        $Encrypted_Byte = CHR($Xored_Byte);
        $Str_Encrypted_Message .= $Encrypted_Byte;
       
        //short code of  the function once explained
        //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
    }
    RETURN $Str_Encrypted_Message;
} //end function
?>



sample use of the function
$Str_Test="This function is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation in any version
of the License."."<br>"."This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."."<br>"."Hello Aitor, Wellcome Home"."<br>";
ECHO $Str_Test."<br>";
$Str_Test2 = ENCRYPT_DECRYPT($Str_Test);
ECHO $Str_Test2."<br><br>";
$Str_Test3 = ENCRYPT_DECRYPT($Str_Test2);
ECHO "<br>".$Str_Test3."<br>";
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 July 2006 - 12:03 PM

know thats a post lol.................
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 July 2006 - 02:02 PM

You encrypt/decrypt strings with basic encryption such as base64_encode/decode

#7 Chetan

Chetan
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts
  • LocationIndia

Posted 26 July 2006 - 04:32 PM

thx you all :)
I am a PHP Guru, ask me questions if you want to




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users