如何使用 Python 生成随机的 128 位字符串?
pythonprogramming更新于 2023/10/30 21:58:00
您可以使用 random 模块的 getrandbits 函数生成这些随机的 128 位字符串,该函数接受位数作为参数。
示例
import random hash = random.getrandbits(128) print(hex(hash))
输出
这将给出输出 −
0xa3fa6d97f4807e145b37451fc344e58c