Re: [SMARTY] MD5
| From: | Jan Rosier | Date: | Thu, 06 Jun 2002 08:04:55 +0000 |
| Subject: | Re: [SMARTY] MD5 | ||
| References: | 1 2 3 4 5 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4643@lists.php.net to get a copy of this message | ||
This gave my an idea. To speed up things, why not just always prepend a
letter T (of template ;-) ). I try this in Smarty. Works and saves 3
str_replace
Greetz,
Jan Rosier
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Matt Berg" <mberg@inspidered.com>
Cc: "Andrei Zmievski" <andrei@ispi.net>; <smarty-general@lists.php.net>
Sent: Wednesday, June 05, 2002 6:55 PM
Subject: Re: [SMARTY] MD5
> fyi, crc32 can create negative numbers. Although starting
> filenames/dirnames with "-" seems to work in Solaris/Linux, I'm not sure
> how other OS's might behave, so we replace the "-" with an "N" to be
> safe.
>
> Matt Berg wrote:
> > Thanks.
> >
> > I was unaware of crc32 which should be perfect since I plan on using in
> > a similar fashion to the way you name your compiled templates.
> >
> >
> > Matt
> >
> > Andrei Zmievski wrote:
> >
> >> On Wed, 05 Jun 2002, Monte Ohrt wrote:
> >>
> >>> We switched everything internal to Smarty to use crc32 instead, it is
> >>> ~10 times faster. It may or may not suit your needs.
> >>>
> >>
> >> Yes, but while crc32 fits our needs, md5() is a much more robust
> >> algorithm.
> >>
> >> -Andrei
http://www.gravitonic.com/
> >> * It said 'Winmodem' on the box, but I still feel like I lost. *
> >>
> >
> >
>
>
>
> --
> Monte Ohrt <monte@ispi.net>
> Director of Technology, ispi Inc.
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
1391,1393c1391,1395 < $source_hash = 'T' . crc32($auto_source); < return $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . < $source_hash . DIR_SEP . 'T' . crc32($auto_id) . '.php'; --- > $source_hash = str_replace('-','N',crc32($auto_source)); > $res = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . > $source_hash . DIR_SEP . str_replace('-','N',crc32($auto_id)) . '.php'; > > return $res; 1412,1413c1414,1415 < $source_hash = 'T' . crc32($auto_source); < $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . $source_hash; --- > $source_hash = str_replace('-','N',crc32($auto_source)); > $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash;
1391,1393c1391,1395 < $source_hash = 'T' . crc32($auto_source); < return $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . < $source_hash . DIR_SEP . 'T' . crc32($auto_id) . '.php'; --- > $source_hash = str_replace('-','N',crc32($auto_source)); > $res = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . > $source_hash . DIR_SEP . str_replace('-','N',crc32($auto_id)) . '.php'; > > return $res; 1412,1413c1414,1415 < $source_hash = 'T' . crc32($auto_source); < $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 5) . DIR_SEP . $source_hash; --- > $source_hash = str_replace('-','N',crc32($auto_source)); > $tname = $auto_base . DIR_SEP . substr($source_hash, 0, 3) . DIR_SEP . $source_hash;