[PHP] Encrypt data to base for authentication...

2003-03-18 Thread Scott Fletcher
Hi Fellas,

I am trying to figure out how to encrypt the data using the base only.
The webserver use the base authentication.  I have been searching the PHP
manual and I only saw base64_encode() but it is not the right algorithm.
Does anyone know the php function for the Base encryption?

Thanks,
 Scott Fletcher



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] encrypt data with pgp

2003-01-21 Thread ermelir
Hello everyody,

I search to encode a string with a strong alogrythm. I choose pgp my 
desktop is a windows computer; I have found a function but I can't use it 
because on windows, pgp cant encrypt on commandline.
have you found something for windows station?
your help will be helpfull.

greetings




_
GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321
(prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné.
Règlement : http://www.ifrance.com/_reloc/sign.sms


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] encrypt data with pgp

2003-01-21 Thread David T-G
ermelir --

[You know, this message really has nothing to do with converting ASP to
PHP...]

...and then ermelir said...
% 
% Hello everyody,

Hi!


% 
% I search to encode a string with a strong alogrythm. I choose pgp my 
% desktop is a windows computer; I have found a function but I can't use it 
% because on windows, pgp cant encrypt on commandline.
% have you found something for windows station?
% your help will be helpfull.

I don't use pgp at all or windows much, but IIRC gnupg will work from the
command line with no problem.  You might try that instead.  Check out

  http://gnupg.org/

for info and downloads.


% 
% greetings


HTH  HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, Science and Health
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg93788/pgp0.pgp
Description: PGP signature


Fw: [PHP] encrypt data with pgp

2003-01-21 Thread Ermelir
just for explain me another better: if I had post in this mailing list, it's
just because I want to find another way to use this function under windows
system

 function pgp_encrypt($keyring_location, $public_key_id, $plain_text) {
$key_id = EscapeShellArg($public_key_id);
putenv(PGPPATH=$keyring_location);
// encrypt the message
 $pipe = popen(pgpe -r $key_id -af, r);
fwrite($pipe, $plain_text);
$encrypted_text = '';
 while($s = fgets($pipe, 1024)) {
 // read from the pipe
 $encrypted_text .= $s;
}
 pclose($pipe);
return $encrypted_text; }

thanks for the tip on winPT, I will try it and will post the code of the
function I will developp if some are interest in...

_
GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321
(prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné.
Règlement : http://www.ifrance.com/_reloc/sign.sms


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Encrypt data...

2002-09-26 Thread Scott Fletcher

Aww!  Neat!  That look better than the one I came up with.  Thanks for your
time on this one.

Thanks,
  FletchSOD

Tom Rogers [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi,

 Thursday, September 26, 2002, 4:45:04 AM, you wrote:
 SF How do I encrypt the data and decrypt it back using PHP?  I do know
that hte
 SF random number can not be used becuase it will make it impossible to
decrypt
 SF it.

 SF Thanks!

 Here is a simple class for encoding and decoding:

 class encrypt_class{
 var $secret;
 function encrypt_class(){
 $this-secret = 'this is a very long key, even too long
for the cipher';
 }
 Function encode($id){
 $eid = $iv = 0;
 $len = strlen($id);
 $id = $len.'-'.$id;
 $td = mcrypt_module_open(MCRYPT_TripleDES, ,
MCRYPT_MODE_ECB, );
 $key = substr($this-secret, 0, mcrypt_enc_get_key_size
($td));
 $iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
 mcrypt_generic_init ($td, $key, $iv);
 $eid = base64_encode(mcrypt_generic ($td, $id));
 mcrypt_generic_deinit($td);
   return $eid;
 }
 Function decode($eid){
 $id = $iv = 0;
 $td = mcrypt_module_open (MCRYPT_TripleDES, ,
MCRYPT_MODE_ECB, );
 $key = substr($this-secret, 0, mcrypt_enc_get_key_size
($td));
 $iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
 mcrypt_generic_init ($td, $key, $iv);
 $id = mdecrypt_generic ($td, base64_decode($eid));
 $len = strtok($id,'-');
 $id = substr($id,(strlen($len)+1),$len);
 mcrypt_generic_deinit($td);
 return $id;
 }
 }


 Usage

 ?
 $word = 'Hello';
 $e = new encrypt_class();
 $encrypted = $e-encode($word);
 echo encrypted = $encrypted br;
 $decrypted = $e-decode($encrypted);
 echo decrypted = $decrypted br;
 if($word == $decrypted){
 echo They match br;
 }
 else{
 echo Oops they don't match br;
 }
 ?
 --
 regards,
 Tom




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Encrypt data...

2002-09-25 Thread Scott Fletcher

How do I encrypt the data and decrypt it back using PHP?  I do know that hte
random number can not be used becuase it will make it impossible to decrypt
it.

Thanks!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Encrypt data...

2002-09-25 Thread Mike Dunlop

http://php.net/mcrypt

How do I encrypt the data and decrypt it back using PHP?  I do know that hte
random number can not be used becuase it will make it impossible to decrypt
it.

Thanks!



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
Mike Dunlop
Webmaster
Animation World Network
[EMAIL PROTECTED]
http://www.awn.com
(323) 606-4238 office
(323) 466-6619 fax
6525 Sunset Blvd.  GS10 Los Angeles, CA  90028
USA


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Encrypt data...

2002-09-25 Thread Scott Fletcher

Well, I meant a script.  I do have mcrypt but I don't feel comfortable with
that becuase if I upgrade PHP or Mcrypt, then it could affected the encrypt
data.


Mike Dunlop [EMAIL PROTECTED] wrote in message
news:a05100304b9b7b58c8d3b@[65.106.126.146]...
 http://php.net/mcrypt

 How do I encrypt the data and decrypt it back using PHP?  I do know that
hte
 random number can not be used becuase it will make it impossible to
decrypt
 it.
 
 Thanks!
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 --
 Mike Dunlop
 Webmaster
 Animation World Network
 [EMAIL PROTECTED]
 http://www.awn.com
 (323) 606-4238 office
 (323) 466-6619 fax
 6525 Sunset Blvd.  GS10 Los Angeles, CA  90028
 USA




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Encrypt data...

2002-09-25 Thread Tom Rogers

Hi,

Thursday, September 26, 2002, 4:45:04 AM, you wrote:
SF How do I encrypt the data and decrypt it back using PHP?  I do know that hte
SF random number can not be used becuase it will make it impossible to decrypt
SF it.

SF Thanks!

Here is a simple class for encoding and decoding:

class encrypt_class{
var $secret;
function encrypt_class(){
$this-secret = 'this is a very long key, even too long for the 
cipher';
}
Function encode($id){
$eid = $iv = 0;
$len = strlen($id);
$id = $len.'-'.$id;
$td = mcrypt_module_open(MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
$eid = base64_encode(mcrypt_generic ($td, $id));
mcrypt_generic_deinit($td);
  return $eid;
}
Function decode($eid){
$id = $iv = 0;
$td = mcrypt_module_open (MCRYPT_TripleDES, , MCRYPT_MODE_ECB, );
$key = substr($this-secret, 0, mcrypt_enc_get_key_size ($td));
$iv = pack(a.mcrypt_enc_get_iv_size($td),$iv);
mcrypt_generic_init ($td, $key, $iv);
$id = mdecrypt_generic ($td, base64_decode($eid));
$len = strtok($id,'-');
$id = substr($id,(strlen($len)+1),$len);
mcrypt_generic_deinit($td);
return $id;
}
}


Usage

?
$word = 'Hello';
$e = new encrypt_class();
$encrypted = $e-encode($word);
echo encrypted = $encrypted br;
$decrypted = $e-decode($encrypted);
echo decrypted = $decrypted br;
if($word == $decrypted){
echo They match br;
}
else{
echo Oops they don't match br;
}
?
-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php