我正在尝试使用他们的API连接到MediaFire。
根据文档get_session_token请求,需要的参数之一是:
签名:一个包含以下4个元素的SHA1 1散列字符串:电子邮件+密码+ application_id + API密钥。例如,电子邮件: SHA1('testemail@domain.com1111119999abcdefghijklmnopqrst'):testemail@domain.com,密码: 111111,application_id: 9999,API键: abcdefghijklmnopqrst,则签名应按以下方式计算:
我遇到的问题是SHA1,我不知道如何将字符串散列到所需的SHA1。我正在使用.NET (我尝试了几种方法),但我甚至尝试使用python (hashlib.sha1('token').hexdigest()),但它没有工作(尝试通过Internet浏览器访问)。
以前有人经历过这个问题吗?
发布于 2013-03-11 00:35:19
这是我在为一些散列数据创建字符串表示时遵循的模式:
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();https://stackoverflow.com/questions/15329092
复制相似问题