在Flickr API docs中,您需要找到字符串的MD5和才能生成[api_sig]
值。
如何从字符串生成MD5 sum?
Flickr的例子:
字符串:000005fab4534d05api_key9a0554259914a86fb9e7eb014e4e5d52permswrite
MD5 sum:a02506b31c1cd46c2e0b6380fb94eb3d
发布于 2011-03-14 18:43:22
对于Python2.x,使用Python的hashlib
import hashlib
m = hashlib.md5()
m.update("000005fab4534d05api_key9a0554259914a86fb9e7eb014e4e5d52permswrite")
print m.hexdigest()
输出:a02506b31c1cd46c2e0b6380fb94eb3d
发布于 2021-01-07 21:22:04
在Python3中使用hashlib.md5。
import hashlib
source = '000005fab4534d05api_key9a0554259914a86fb9e7eb014e4e5d52permswrite'.encode()
md5 = hashlib.md5(source).hexdigest() # returns a str
print(md5) # a02506b31c1cd46c2e0b6380fb94eb3d
如果您需要字节类型输出,请使用digest()
而不是hexdigest()
。
发布于 2018-06-10 17:00:06
Try This
import hashlib
user = input("Enter text here ")
h = hashlib.md5(user.encode())
h2 = h.hexdigest()
print(h2)
https://stackoverflow.com/questions/5297448
复制相似问题