From 38af197ebf6ff9f947d02338262ad8ebe48f26d3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Dec 2018 20:53:58 +0300 Subject: fixes #1668 (ICQ: contact search) --- protocols/Icq10/src/utils.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'protocols/Icq10/src/utils.cpp') diff --git a/protocols/Icq10/src/utils.cpp b/protocols/Icq10/src/utils.cpp index 12ba8eaacf..412484ebda 100644 --- a/protocols/Icq10/src/utils.cpp +++ b/protocols/Icq10/src/utils.cpp @@ -33,6 +33,17 @@ IcqCacheItem* CIcqProto::FindContactByUIN(DWORD dwUin) return m_arCache.find((IcqCacheItem*)&dwUin); } +///////////////////////////////////////////////////////////////////////////////////////// + +void CIcqProto::CalcHash(AsyncHttpRequest *pReq) +{ + CMStringA hashData(FORMAT, "POST&%s&%s", ptrA(mir_urlEncode(pReq->m_szUrl)), ptrA(mir_urlEncode(pReq->m_szParam))); + unsigned int len; + BYTE hashOut[MIR_SHA256_HASH_SIZE]; + HMAC(EVP_sha256(), m_szSessionKey, m_szSessionKey.GetLength(), (BYTE*)hashData.c_str(), hashData.GetLength(), hashOut, &len); + pReq << CHAR_PARAM("sig_sha256", ptrA(mir_base64_encode(hashOut, sizeof(hashOut)))); +} + ///////////////////////////////////////////////////////////////////////////////////////// // Avatars -- cgit v1.2.3