用Python脚本生成Android SALT扰码的方法

yipeiwu_com7年前Python基础

复制代码 代码如下:

#!/usr/bin/python  
# Filename: gen_salt.py  
import random  

salt =[]  
for i in range(0, 30):  
  salt.append( random.randint(-128, 127) )  

print salt

执行 $ python gen_salt.py 后结果形式如下

[4, 30, 42, -124, -120, -75, 77, 38, -112, 35, 4, -19, -9, -83, 122, -115, -34, 44, -95, -31, -102, -94, -85, -20, -73, 126, -16, 28, 20, -54]

相关文章

Python RuntimeError: thread.__init__() not called解决方法

在写一个多线程类的时候调用报错 RuntimeError: thread.__init__() not called 复制代码 代码如下: class NotifyTread(thre...

在Python的gevent框架下执行异步的Solr查询的教程

 我经常需要用Python与solr进行异步请求工作。这里有段代码阻塞在Solr http请求上, 直到第一个完成才会执行第二个请求,代码如下:   impor...

详谈Python高阶函数与函数装饰器(推荐)

详谈Python高阶函数与函数装饰器(推荐)

一、上节回顾 Python2与Python3字符编码问题,不管你是初学者还是已经对Python的项目了如指掌了,都会犯一些编码上面的错误。我在这里简单归纳Python3和Python2各...

Python 除法小技巧

复制代码 代码如下:from __future__ import division print 7/3 输出结果: 2.3333333333...

对dataframe进行列相加,行相加的实例

实例如下所示: >>> import pandas as pd >>> df = pd.DataFrame({"x":['a','b','c','...