Page 1 of 1
Encryption Types
Posted: Fri May 20, 2005 11:32 pm
by milsaw
Howdy folks,
I was wondering if PHP offered any sort of encyption that was different for each server.
So like on my server it could be like encrypt($string)...that equals jfdaso8u34wnfa8
While on my friends server if I did the same string so...encrypt($string)....his equals dfjasjfwo3ihfsna
I hope that makes sense, and thanks for your time
Also, I have PHP v4.2.
Thanks again
Posted: Sat May 21, 2005 12:09 am
by method_man
... what?
Posted: Sat May 21, 2005 12:13 am
by method_man
are you saying that you saved a variable on your server then went to his server and it was different? if this is the case ,that is because his server probably already has that variable saved as something else
Posted: Sat May 21, 2005 12:16 am
by infolock
PHP only offers encryptions that is built into its compiler (ie : crypt, md5, etc.). if you want to use a server-based encryption, you are going to need to check with that webserver's website and check with them..
but if ur question is if you use md5 on an apache server and then try to run the same code on an IIS server, and simply want to know if the values will change, then the answer is no. whatever the encryption string is created using an apacehe server is goign to be on an IIS server as the server isn't what is controlling your encryption, but php is. The server just says "ok, you send me a string, and I'll send it wherever you specify". again, that's unless the server has its own built in encryption method and you call that encryption via the server directly.
hope this helps.
Re: Encryption Types
Posted: Sat May 21, 2005 12:49 am
by Roja
milsaw wrote:
I was wondering if PHP offered any sort of encyption that was different for each server.
Yes and no.
Yes, there is an encryption that you can setup to be different per server - multiple types in fact.
What you are describing is essentially "Salting". If you do md5("whatever") on both servers, the answer will be consistent - the same.
However, by adding a unique "Salt", you can get different results from one machine to the other. So that:
md5("whatever" + $salt) (on server one)
md5("whatever" + $salt) (on server two)
would not be the same, as long as $salt was different between the two. For example, you could do:
$salt = $SERVER['SERVER_NAME'];
and of course it would be different on each.
However, to answer the original question, NO, there is not a type of encryption that automatically salts differently from one server to another, as far as I know.
Posted: Sat May 21, 2005 1:15 am
by infolock
good call, i didn't even think of it that way...