Chetan Posted July 26, 2006 Share Posted July 26, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/ Share on other sites More sharing options...
redarrow Posted July 26, 2006 Share Posted July 26, 2006 gd is built into php enable it in php.iniand lookup hash ok Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-63953 Share on other sites More sharing options...
zq29 Posted July 26, 2006 Share Posted July 26, 2006 [quote author=redarrow link=topic=101912.msg403779#msg403779 date=1153914620]gd is built into php enable it in php.iniand lookup hash ok[/quote]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... Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-63954 Share on other sites More sharing options...
redarrow Posted July 26, 2006 Share Posted July 26, 2006 <?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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-63955 Share on other sites More sharing options...
redarrow Posted July 26, 2006 Share Posted July 26, 2006 know thats a post lol................. Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-63956 Share on other sites More sharing options...
wildteen88 Posted July 26, 2006 Share Posted July 26, 2006 You encrypt/decrypt strings with basic encryption such as base64_encode/decode Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-64019 Share on other sites More sharing options...
Chetan Posted July 26, 2006 Author Share Posted July 26, 2006 thx you all :) Quote Link to comment https://forums.phpfreaks.com/topic/15680-please-help-me/#findComment-64144 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.