• python3 os.urandom


    # os.urandom(n)
    # Return a string of n random bytes suitable for cryptographic use.
    # This function returns random bytes from an OS-specific randomness source.
    import os
    import hashlib
    
    for i in range(1, 11):
        bytes_20 = os.urandom(20)
        print("%s: %s" % (i, bytes_20))
        hex_32 = hashlib.md5(bytes_20).hexdigest()
        print("%s: %s" % (i, hex_32))
    执行结果:
    1: b'x84{<8x84x17xbb^uxa9xa0xd2xcfx8ex0czxa8xbe~xcd'
    1: e0cb861e7851a1a7f766e89e235aa2ca
    2: b'`xfe!yxf3xedxbex06tx18x80xe8xadxadax95xb0fxd4C'
    2: cce8bef3a22aecc082c91054ec7c6bf5
    3: b'xd2x1cx96x90xd1dWxa0xfbYxdd/;xee2x06xbaRx1es'
    3: a7902517133c44535c8686fba28770e4
    4: b'?Yxbbx00rOxf0xa1x82#xff+{bx85x8eDN xb1'
    4: cdc8468ffa5642afeb1b94bb6bed6bd7
    5: b'&U_8hxfaDxf8xf5)xb3YPxe6xedxdb
    #G}'
    5: f61fe7fdaaa9dac6c15022997db804eb
    6: b'xc0xabxaaFxcaxe7yx93zx10xx7fYxe7jWQ}xae3'
    6: 3cbdd329f5a4ce371b777ed55cdf889a
    7: b'x18xffx8cx96x89xd6x01xxdax12xb5xc4xd2Y/ixf8Nx85xb0'
    7: d24b45ca762be51d07f9b8cb236239d3
    8: b'xbex10RHxd8x9d*dxd2xdaxd9Wx1bCxa4xcdx9fqx167'
    8: 417bc71a045858fca7bb754dc238d5eb
    9: b'Fvxe9x07
    x95xe4xc9Wxdbxbb=xe3m5xd8x8dxca@x16'
    9: 44f83197dd35d1678cf4e356ca03e3ba
    10: b'[xca4Qtxd46xdfxc4xbd>xe2x9dx89xa0<x9c{?xe2'
    10: a8826d75b0054f3c9021b648e477a30e
    
    
    
     
    
    
  • 相关阅读:
    List分组和排序
    IOS 可靠性测试 iosMonkey
    Mac 10.10 下安装jdk 1.7 以上
    Ubuntu 无法拖拽复制
    Ubuntu 环境安装整理
    vmware 中 ubuntu linux 安装vmware tools
    Vmware linux 安装 Vmware Tools 提示只读
    Ubuntu_文件夹名字转化成英文
    Ubuntu_开启root 登陆
    Tomcat 用户配置
  • 原文地址:https://www.cnblogs.com/lilyxiaoyy/p/10942756.html
Copyright © 2020-2023  润新知