diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2016-04-07 18:53:06 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2016-04-07 18:53:06 +0000 |
commit | 45795f0e01be0f51ac647cac4e7c35463f39636a (patch) | |
tree | a2e8dbd515f4006b09ff913e70a05214cf90b6a2 /protocols/AimOscar/src/utility.cpp | |
parent | 6d823d15030bc2ccb7237a15492d20a204244ce0 (diff) |
aim:
"clientlogin":
implemented hmac_sha256
"clientlogin" is fully implemented now
//TODO: make some testing
//TODO: turn it on
git-svn-id: http://svn.miranda-ng.org/main/trunk@16607 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/AimOscar/src/utility.cpp')
-rwxr-xr-x | protocols/AimOscar/src/utility.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 06849fb8b9..4ba0cc56c5 100755 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -651,3 +651,19 @@ unsigned short get_random(void) id &= 0x7fff;
return id;
}
+
+void hmac_sha256(const char *key, const char *msg, char *buf)
+{
+ unsigned char hash[32];
+
+ HMAC_CTX hmac;
+ HMAC_CTX_init(&hmac);
+ HMAC_Init_ex(&hmac, &key[0], strlen(key), EVP_sha256(), NULL);
+ HMAC_Update(&hmac, (unsigned char*)&msg[0], strlen(msg));
+ unsigned int len = 32;
+ HMAC_Final(&hmac, hash, &len);
+ HMAC_CTX_cleanup(&hmac);
+
+ mir_strncpy(buf, key, len);
+
+}
\ No newline at end of file |