主人MediaFire REST API会话签名SHA1?主人、MediaFire、REST、API

由网友(- 我拿真心喂过狗 。)分享简介:我试图连接到使用他们的API主人MediaFire 的。据该documen的 get_session_token 请求所需的参数之一就是:According to the documen the get_session_token request one of the required parameters i...

我试图连接到使用他们的API主人MediaFire 的。

据该documen的 get_session_token 请求所需的参数之一就是:

According to the documen the get_session_token request one of the required parameters is:

签名:电子邮件+密码+ APPLICATION_ID + API密钥:包含此顺序以下4个元素的SHA1散列字符串。例如,电子邮件:testemail@domain.com,密码:111111,APPLICATION_ID:9999和API密钥:ABCDEFGHIJKLMNOPQRST,那么签名的计算方法如下:SHA1('testemail@domain.com1111119999abcdefghijklmnopqrst')

signature: a SHA1-hashed string that contains the following 4 elements in this sequence: email + password + application_id + API Key. For example, email: testemail@domain.com, password: 111111, application_id: 9999, and API key: abcdefghijklmnopqrst, then signature should be calculated as follows: SHA1('testemail@domain.com1111119999abcdefghijklmnopqrst')

我遇到的问题是与SHA1,我不知道如何散列字符串到所需的SHA1。 我使用.NET(我试过多种方法),但我甚至尝试与Python( hashlib.sha1('令牌')。hexdigest()),它没科技工作(试图通过互联网浏览器访问)。

The problem I'm having is with the SHA1, I don't know how to hash the string to the desired SHA1. I'm using .NET (and I tried several ways) but I even tried with python (hashlib.sha1('token').hexdigest()) and it didn't work (tried accessing via Internet browser).

有没有人经历过这个问题?

Has anyone experienced this issue before?

推荐答案

这是模式生成的字符串再一些散列数据presentations当我按照排序:

This is the sort of pattern I follow when creating string representations of some hashed data:

string data = "testemail@domain.com1111119999abcdefghijklmnopqrst";
byte[] bytes = Encoding.UTF8.GetBytes(data);
byte[] hash;

using (SHA1 sha1 = new SHA1Managed())
    hash = sha1.ComputeHash(bytes);

//You would use hashString for the signature parameter.
string hashString = BitConverter.ToString(hash).Replace("-", "").ToLower();
阅读全文

相关推荐

最新文章