摘要:# -*- coding: utf-8 -*- # 本地bytes 数据上报服务器同时创建文件from ftplib import FTP import time, _io from constant import ftp_host, ftp_port, ftp_pw, ftp_user, ftp_
阅读全文
摘要:# -*- coding: utf-8 -*-from psycopg2.pool import ThreadedConnectionPool,SimpleConnectionPool,PersistentConnectionPool from constant import pg_name, pg
阅读全文
摘要:def gen_sql(table_name, data): """ :param table_name: 表名称 :param data: 字典对象 key为字段(要与数据库字段一样), value为插入值 :return: 拼接好的sql语句 """ fields = list() values
阅读全文
摘要:# -*- coding: utf-8 -*-import jsonimport websocketimport _thread as thread # try:# import thread# except ImportError:# import _thread as thread def on
阅读全文
摘要:class AesEbc16: # 按块的大小, 一块一块的加密, 明文和密文长度一样 def __init__(self): self.key = b"123qweqqqwerqwer" # 加密和解密用同一个秘钥, 长度为 每块的长度 self.mode = AES.MODE_ECB # ECB
阅读全文
摘要:Python中异或加密要将str 转为 bitarray, 提示: int类型和纯数字的字符串也可以异或处理, 可能更方便 from bitarray import bitarray def str2bitarray(msg): # msg 为str msg_2 = "" # 转为1010拼接成字符
阅读全文
摘要:rsa 非对称加密, 公钥加密, 私钥解密, 有公钥无法推导出私钥, 私钥保密 import rsa n = 1024 # n 越大生成公钥, 秘钥及加密解密所需时间就越长 key = rsa.newkeys(n)#生成随机秘钥 privateKey = key[1]#私钥 publicKey =
阅读全文