Apr 25
ClientHash
icon1 admin | icon2 yahoo | icon4 04 25th, 2009| icon3No Comments »

Below is information on generating the clienthash for yahoo messenger 9+ web protocol

param2 will be ClientPost or ServerPost

Code to generate the clienthash
protected function _hash(param1:Object, param2:String) : String
{
var _loc_3:String;
var _loc_4:ByteArray;
YLog.log("YHttpTransport::_hash", g_session.nClientSeq, g_session.sSessionId, g_session.sSecret, param2);
_loc_3 = [g_session.nClientSeq, g_session.sSessionId, g_session.sSecret, param2].join("");
_loc_4 = new SHA1().hash(Hex.toArray(Hex.fromString(_loc_3)));
return Hex.fromArray(_loc_4);
}// end function

Code to generate the secret
protected function _generateSecret() : void
{
var _loc_1:Array;
var _loc_2:Number;
_loc_1 = [];
_loc_2 = 0;
while (_loc_2++ < 5)
{
// label
_loc_1[_loc_2] = Math.round((1234 + new Date().getMilliseconds()) * Math.random());
}// end while
g_session.sSecret = _loc_1.join("");
YLog.log("YHttpTransport::_generateSecret", "Secret: " + g_session.sSecret);
g_session.sEncryptedSecret = String(Hex.fromString(g_session.sSecret));
YLog.log("YHttpTransport::_generateSecret, Encrypted secret: " + g_session.sEncryptedSecret);
return;
}// end function