https://vk.com/video?act=subtitles&video=123_456&subtitles=xxxx&hash=yyyy
https://accounts.google.com/o/oauth2/auth?scope={scope}&redirect_uri={redirect_uri}&response_type=code&client_id={client_id}
Authorization: Bearer <полученный access_token>
Content-Type: application/json
{
"title": "Название папки"
"mimeType": "application/vnd.google-apps.folder"
}
runexplorer.exe c:\ 0 0 500 400
runexplorer.exe c:\ 0 0 500 400 d:\ 500 500 600 500
wc.cbWndExtra = DLGWINDOWEXTRA;
string s = "876c0e09-70f7-4190-ab3a-254b6e5f461e";
byte[] data = Encoding.Unicode.GetBytes(s);
byte[] hash = new MD5CryptoServiceProvider().ComputeHash(data);
StringBuilder sb = new StringBuilder();
foreach (var b in hash)
{
sb.Append(b.ToString("x2"));
}
string outVAR = sb.ToString();
Console.WriteLine(outVAR);
string ToBytes(const wstring& str) {
const char* d = reinterpret_cast<const char*>(&str[0]);
string result(d, d+str.size()*2);
return result;
}
int main() {
wstring data = L"876c0e09-70f7-4190-ab3a-254b6e5f461e"; // на винде это будет UTF-16 строка, как и в C#
cout << md5(ToBytes(data)) << endl;
system("pause");
}
d1206f6bcf6d9b31860482123c288650
std::string WinMD5(const void * data, const size_t data_size)
{
HCRYPTPROV hProv = NULL;
if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) {
return std::string();
}
HCRYPTPROV hHash = NULL;
BOOL hash_ok = CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash);
if (!hash_ok) {
CryptReleaseContext(hProv, 0);
return std::string();
}
if (!CryptHashData(hHash, static_cast<const BYTE *>(data), static_cast<DWORD>(data_size), 0)) {
CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0);
return std::string();
}
DWORD cbHashSize = 0, dwCount = sizeof(DWORD);
if (!CryptGetHashParam(hHash, HP_HASHSIZE, (BYTE *)&cbHashSize, &dwCount, 0)) {
CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0);
return std::string();
}
std::vector<BYTE> buffer(cbHashSize);
if (!CryptGetHashParam(hHash, HP_HASHVAL, reinterpret_cast<BYTE*>(&buffer[0]), &cbHashSize, 0)) {
CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0);
return std::string();
}
std::ostringstream oss;
for (auto item: buffer) {
oss << static_cast<unsigned int>(item);
}
CryptDestroyHash(hHash);
CryptReleaseContext(hProv, 0);
return oss.str();
}
string ToBytes(const wstring& str) {
const char* d = reinterpret_cast<const char*>(&str[0]);
string result(d, d+str.size()*2);
return result;
}
int main() {
wstring data = L"876c0e09-70f7-4190-ab3a-254b6e5f461e";
cout << WinMD5(data.data(), data.size()* sizeof(wchar_t));
system("pause");
}
2093211110720710915549134413018604013480