【发布时间】:2019-12-30 09:25:36
【问题描述】:
我尝试在对我的密码进行编码后调用 Equinix 身份验证 API,但哈希不成功。
我尝试了以下在线生成器,但编码的密码似乎不正确。
【问题讨论】:
标签: rest authentication oauth-2.0
我尝试在对我的密码进行编码后调用 Equinix 身份验证 API,但哈希不成功。
我尝试了以下在线生成器,但编码的密码似乎不正确。
【问题讨论】:
标签: rest authentication oauth-2.0
我遇到了同样的问题,并使用 Jython 解决了这个问题。 http://www.java2s.com/Code/Jar/j/Downloadjythonstandalone252jar.htm
代码很简单:
import hashlib
import base64
password = "my_password"
hashObject = hashlib.md5(password.encode())
md5password = hashObject.digest()
base64Password = base64.b64encode(md5password)
encode() 函数 - 将密码编码为字节字符串,用作 hashlib.md5() 方法的输入
digest() 函数 - 以字节格式返回编码数据 而b64encode()对digest()方法返回的数据进行编码
你也可以在这里测试一下 https://repl.it/repls/JampackedShowyLocatorprogram
希望这会有所帮助:)
【讨论】: