V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  334862132  ›  全部回复第 3 页 / 共 3 页
回复总数  49
1  2  3  
2018-12-21 14:34:05 +08:00
回复了 334862132 创建的主题 Python web.py 有没有装饰器让类只能访问 post 接口
@fucker 谢谢了 我发现我钻牛角尖了 不想让 read_file 函数被访问直接设置成私有方法就好了 不接收 GET 请求直接给 get 接口删了就好了
2018-12-21 09:30:27 +08:00
回复了 334862132 创建的主题 Python web.py 有没有装饰器让类只能访问 post 接口
复制效果不太好 直接给个地址吧....
https://blog.csdn.net/PgZHJ/article/details/80447840
2018-11-26 14:13:07 +08:00
回复了 334862132 创建的主题 Python django2.0 出现了灵异事件,求大神指点
@dxandlight 主要是没用 redis 缓存 查询数据库所用的时间也差不多还是 2 秒左右 感觉很诡异
2018-11-25 17:34:07 +08:00
回复了 334862132 创建的主题 Python django2.0 出现了灵异事件,求大神指点
@jingyulong 数据库数据更新了 但是线上查询的数据不更新,像一直卡死了一样,随便上传一行空白文件 线上在下拉一下就能解决
2018-11-25 12:41:29 +08:00
回复了 334862132 创建的主题 Python django2.0 出现了灵异事件,求大神指点
@111111111111 根本没有错误提示,不报错,就是数据不正常,正常查询出来俩个,线上查询出来一个 正常查询出来三个,线上也还是一个,就像数据卡死在那一直也不更新了一样
2018-11-09 09:57:57 +08:00
回复了 334862132 创建的主题 Python 从用户手机通讯录抓取的信息存入数据库之前需不需要
点错了,sorry.......
2018-09-30 09:40:40 +08:00
回复了 334862132 创建的主题 Python 求教 Python 的 RSA 加密问题有 PHP 源码
@FanWall 谢谢大神 解出来了 !!!!!
2018-09-29 18:25:11 +08:00
回复了 334862132 创建的主题 Python 求教 Python 的 RSA 加密问题有 PHP 源码
@FanWall 求一份 Python3 的无填充代码 网上找的代码一运行就报错
NotImplementedError: Use module Crypto.Cipher.PKCS1_OAEP instead
我用的这段代码 ,引用位置和引用文件都已经改过了
author__ = 'owen'
__date__ = '2017-11-22'

import base64
from Crypto.PublicKey import RSA

ENCRYPT_SALT = b'12345678901234567890123456789012345679801234' # 44 char
RSA_KEY_PATH = './'

class MyRSACrypto:

@classmethod
def cryptor( cls, plain_text ):

# print("\n================ crypto ========================\n")

if( not isinstance( plain_text, bytes ) ):
plain_text = plain_text.encode()

salt = ENCRYPT_SALT
base_dir = RSA_KEY_PATH

with open(base_dir + 'master-public.pem') as fp:
public_key = fp.read()

if(not public_key):
return None

rsa_cryptor = RSA.importKey( public_key )

plain_text = ( plain_text + salt )

# 无填充方式公钥加密
cipher_text = rsa_cryptor.encrypt( plain_text, 0 )

pad_cnt = 64 - len(cipher_text[0])

cipher_text_rsa = pad_cnt * b'\0' + cipher_text[0]

cipher_text_b64 = base64.b64encode( cipher_text_rsa )

return cipher_text_b64.decode()[:-2]


@classmethod
def decryptor( cls, cipher_text_b64 ):

# print("\n================ decrypto ========================\n")
if( not isinstance( cipher_text_b64, bytes ) ):
cipher_text_b64 = cipher_text_b64.encode()

base_dir = RSA_KEY_PATH

with open( base_dir + 'master-private.pem' ) as fp:
private_key = fp.read()

if(not private_key):
return None

rsa_decryptor = RSA.importKey( private_key )

cipher_text = base64.b64decode( cipher_text_b64 + b"==" )

# 无填充方式私钥解密
plain_text = rsa_decryptor.decrypt( cipher_text )

return plain_text.decode()[:20]


if __name__ == '__main__':

text = '31' * 10

cipher_text = MyRSACrypto.cryptor( text )
print(cipher_text)

plain_text = MyRSACrypto.decryptor( cipher_text )
print( plain_text )
2018-09-29 10:21:20 +08:00
回复了 334862132 创建的主题 Python 求教 Python 的 RSA 加密问题有 PHP 源码
这个是我的初始加密方式 我用\0 在加密对象左侧填充到 245 长度加密出来的结果第三方也解密不了 加密到 256 位的话 RSA 长度不行 至于 RSA 切割加密感觉更不行了, 长度估计都跟对面给出来的长度不一样,RSA 公钥加密最恶心的是每次加密出来的结果都不一样, 除了私钥根本没法验证 更恶心的是我还没有私钥
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2831 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 15:01 · PVG 23:01 · LAX 08:01 · JFK 11:01
Developed with CodeLauncher
♥ Do have faith in what you're doing.