gpt4 book ai didi

.net - MediaFire Rest API session 签名 SHA1?

转载 作者:行者123 更新时间:2023-12-04 05:07:34 24 4
gpt4 key购买 nike

我正在尝试连接到 MediaFire使用他们的 API。

根据文档 get_session_token 请求所需的参数之一是:

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('token').hexdigest() ),但它不起作用(尝试通过 Internet 浏览器访问)。

有没有人遇到过这个问题?

最佳答案

这是我在创建一些散列数据的字符串表示时遵循的那种模式:

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();

关于.net - MediaFire Rest API session 签名 SHA1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15329092/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com