T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 64
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 220
  Visitor Online : 4
  Today Visit: 126
  Total Visitor : 326348
  Most Online : 41
::: Sponsored Links :::

PR 4 For This Webpage

Vinaora Logo
Home Today :

Yahoo! Messenger(tm) Encryption algorithm

Author : Cody Brocious

The yahoo_login function is required for logging into the Yahoo! Messenger(tm) servers. The seed is sent by the server in the form of a challenge string. A good description of the Yahoo! Messenger(tm) protocol is available at http://www.venkydude.com/

PHP Example :

<?php
    
/*
        * $Id: yahoo.crypt.php,v 6.00 2003/05/07 4:45:00 Daeken Exp $
        *
        * Copyright (C) 2003 by Cody Brocious (daeken_9999 AT yahoo DOT com)
        *
        * This program 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; either
        * version 2 of the License, or (at your option) any later version.
        *
        * 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. See the GNU
        * General Public License for more details.
        *
        * You should have received a copy of the GNU General Public License
        * along with this program; if not, write to the
        * Free Software Foundation, Inc.,
        * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
        *
    */
function md5_raw($str)
{
    
$md5 md5($str);
    
$ctx '';
    for (
$i 0$i 32$i += 2)
    {
        
$ctx .= chr(hexdec($md5{$i} . $md5{$i 1}));
    }
    return 
$ctx;
}
function 
yahoo_login($username$password$seed)
{
    
$sv $seed[15];
    
$sv ord($sv) % 8;
    
$sv chr($sv);
    
$ctx '';
    
$ctx .= $password;
    
$result md5_raw($ctx);
    
$password_hash to_y64($result16);

    
$ctx '';
    
$crypt_result crypt($password'$1$_2S43d5f$');
    
$ctx .= $crypt_result;
    
$result md5_raw($ctx);
    
$crypt_hash to_y64($result16);
    switch (
ord($sv)) {
        case 
1:
        case 
6:
            
$checksum $seed[ord($seed[9]) % 16];
            
$hash_string_p substr(sprintf("%s%s%s%s"$checksum$username$seed$password_hash), 0, (strlen($username) + 50));
            
$hash_string_c substr(sprintf("%s%s%s%s"$checksum$username$seed$crypt_hash), 0, (strlen($username) + 50));
            break;
        case 
2:
        case 
7:
            
$checksum $seed[ord($seed[15]) % 16];
            
$hash_string_p substr(sprintf("%s%s%s%s"$checksum$seed$password_hash$username), 0, (strlen($username) + 50));
                        
$hash_string_c substr(sprintf("%s%s%s%s"$checksum$seed$crypt_hash$username), 0, (strlen($username) + 50));
            break;
        case 
3:
            
$checksum $seed[ord($seed[1]) % 16];
            
$hash_string_p substr(sprintf("%s%s%s%s"$checksum$username$password_hash$seed), 0, (strlen($username) + 50));
                        
$hash_string_c substr(sprintf("%s%s%s%s"$checksum$username$crypt_hash$seed), 0, (strlen($username) + 50));
            break;
        case 
4:
            
$checksum $seed[ord($seed[3]) % 16];
            
$hash_string_p substr(sprintf("%s%s%s%s"$checksum$password_hash$seed$username), 0, (strlen($username) + 50));
            
$hash_string_c substr(sprintf("%s%s%s%s"$checksum$crypt_hash$seed$username), 0, (strlen($username) + 50));
            break;
        case 
0:
        case 
5:
            
$checksum $seed[ord($seed[7]) % 16];
            
$hash_string_p substr(sprintf("%s%s%s%s"$checksum$password_hash$username$seed), 0, (strlen($username) + 50));
                        
$hash_string_c substr(sprintf("%s%s%s%s"$checksum$crypt_hash$username$seed), 0, (strlen($username) + 50));
            break;
        }
        
$ctx '';
        
$ctx .= $hash_string_p;
        
$result md5_raw($ctx);
        
$result6 to_y64($result16);

        
$ctx '';
        
$ctx .= $hash_string_c;
        
$result md5_raw($ctx);
        
$result96 to_y64($result16);
        return array(
$result6$result96);
}
function 
to_y64($str$length)
{
    
$string base64_encode(substr($str0$length));
    
$string str_replace('+''.'$string);
    
$string str_replace('/''_'$string);
    
$string str_replace('=''-'$string);
    return 
$string;
}
function 
from_y64($string)
{
    
$string str_replace('-''='$string);
    
$string str_replace('_''\', $string);
    $string = str_replace('
.', '+', $string);
    $string = base64_decode($string);
    return $string;
}
?>



Other Example


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
  QH Online
  Thai Cuc Quyen
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007