V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
linhanqiu
V2EX  ›  Python

关于服务端客户端验签以及加解密问题

  •  
  •   linhanqiu · 2018-03-28 13:37:00 +08:00 · 1257 次点击
    这是一个创建于 2193 天前的主题,其中的信息可能已经有所发展或是发生改变。

    最近在爬取“马蜂窝”的 app 攻略部分,爬取不同城市的时候发现每次请求的时候需要加上不同的 oauth_signature, 也就是服务端和客户端验证的签名。

    例如,得到的是“ oauth_signature=2Kj6MQi6oZ%2FkNPye4xYUGm%2BRD%2Bc%3D ”

    URL 解码之后得到的是“ 2Kj6MQi6oZ/kNPye4xYUGm+RD+c=”

    这个是使用的 HMAC-SHA1 方法,也就是 sha1,就是使用消息+类似密码的东西得到的

    大致公式总结如下,

    消息=未知

    密码=''.join( [ oauth_timestamp,oauth_token,oauth_nonce ] .sort())->base64 编码

    sha1 (消息+密码) = oauth_signature = “ oauth_signature ”

    结果总是算不对,现在想问问可不可以直接去得到消息是什么,以及每次的 oauth_nonce 随机数怎么得到

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2827 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:32 · PVG 22:32 · LAX 07:32 · JFK 10:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.