misszm

以前以为错过也很美, 想在很后悔

04 2019 档案

python ftp 上传文件
摘要:# -*- coding: utf-8 -*- # 本地bytes 数据上报服务器同时创建文件from ftplib import FTP import time, _io from constant import ftp_host, ftp_port, ftp_pw, ftp_user, ftp_ 阅读全文

posted @ 2019-04-21 18:01 宋喜阳 阅读(645) 评论(0) 推荐(0)

python psycopg2 连接pg 建立连接池
摘要:# -*- coding: utf-8 -*-from psycopg2.pool import ThreadedConnectionPool,SimpleConnectionPool,PersistentConnectionPool from constant import pg_name, pg 阅读全文

posted @ 2019-04-20 23:09 宋喜阳 阅读(3314) 评论(0) 推荐(0)

python 字典 拼接SQL语句
摘要:def gen_sql(table_name, data): """ :param table_name: 表名称 :param data: 字典对象 key为字段(要与数据库字段一样), value为插入值 :return: 拼接好的sql语句 """ fields = list() values 阅读全文

posted @ 2019-04-17 21:03 宋喜阳 阅读(3259) 评论(0) 推荐(0)

python websocket(tornado) 客户端连接
摘要:# -*- coding: utf-8 -*-import jsonimport websocketimport _thread as thread # try:# import thread# except ImportError:# import _thread as thread def on 阅读全文

posted @ 2019-04-11 14:31 宋喜阳 阅读(7922) 评论(0) 推荐(0)

python AES加密 ECB PKCS5
摘要:class AesEbc16: # 按块的大小, 一块一块的加密, 明文和密文长度一样 def __init__(self): self.key = b"123qweqqqwerqwer" # 加密和解密用同一个秘钥, 长度为 每块的长度 self.mode = AES.MODE_ECB # ECB 阅读全文

posted @ 2019-04-02 22:25 宋喜阳 阅读(1517) 评论(0) 推荐(0)

python 字符串 转 bit, bitarray 异或加密
摘要:Python中异或加密要将str 转为 bitarray, 提示: int类型和纯数字的字符串也可以异或处理, 可能更方便 from bitarray import bitarray def str2bitarray(msg): # msg 为str msg_2 = "" # 转为1010拼接成字符 阅读全文

posted @ 2019-04-02 13:19 宋喜阳 阅读(6195) 评论(0) 推荐(0)

python RSA 加密
摘要:rsa 非对称加密, 公钥加密, 私钥解密, 有公钥无法推导出私钥, 私钥保密 import rsa n = 1024 # n 越大生成公钥, 秘钥及加密解密所需时间就越长 key = rsa.newkeys(n)#生成随机秘钥 privateKey = key[1]#私钥 publicKey = 阅读全文

posted @ 2019-04-01 20:53 宋喜阳 阅读(303) 评论(0) 推荐(0)

导航