------------------------------------------------
On Tue, 22 Jul 2003 17:10:36 +0430, "S. Naqashzade" <[EMAIL PROTECTED]> wrote:

> Dear Friends,
> I need to trnaslate thid code to PHP.
> Can any one help me?

This is a Perl list. You might try a PHP list for PHP help, even if it is coming from 
Perl code. Most people here would prefer to help you with finding a way to keep this 
being done in Perl, but that is a philosophical discussion.....

http://danconia.org

> 
> use constant MD5_CRYPT_MAGIC_STRING => '$1$';
> use constant I_TO_A64 =>
> './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
> 
> sub _to_yahoo_base64
> {
>  pos($_[0]) = 0;
> 
>  my $res = join '', map( pack('u',$_)=~ /^.(\S*)/, ($_[0]=~/(.{1,45})/gs));
>  $res =~ tr{` -_}{AA-Za-z0-9\._};
> 
>  my $padding = (3 - length($_[0]) % 3) % 3;
>  $res =~ s/.{$padding}$/'-' x $padding/e if $padding;
>  return $res;
> }
> 
> 
> sub _to64
> {
>  my ($v, $n) = @_;
>  my $ret = '';
>  while (--$n >= 0) {
>   $ret .= substr(I_TO_A64, $v & 0x3f, 1);
>   $v >>= 6;
>  }
>  $ret;
> }
> 
>  my $Magic = MD5_CRYPT_MAGIC_STRING;
>  $salt =~ s/^\Q$Magic//;
>  $salt =~ s/^(.*)\$.*$/$1/;
>  $salt = substr $salt, 0, 8;
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to