Bạn có thể tạo chuỗi 128-bit ngẫu nhiên bằng hàm getrandbits của module random, chấp nhận số bit làm đối số.
Ví dụ
import random
hash = random.getrandbits(128)
print(hex(hash))
Kết quả
Kết quả ví dụ (dạng hex):
0xa3fa6d97f4807e145b37451fc344e58c