V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
iOS 开发实用技术导航
NSHipster 中文版
http://nshipster.cn/
cocos2d 开源 2D 游戏引擎
http://www.cocos2d-iphone.org/
CocoaPods
http://cocoapods.org/
Google Analytics for Mobile 统计解决方案
http://code.google.com/mobile/analytics/
WWDC
https://developer.apple.com/wwdc/
Design Guides and Resources
https://developer.apple.com/design/
Transcripts of WWDC sessions
http://asciiwwdc.com
Cocoa with Love
http://cocoawithlove.com/
Cocoa Dev Central
http://cocoadevcentral.com/
NSHipster
http://nshipster.com/
Style Guides
Google Objective-C Style Guide
NYTimes Objective-C Style Guide
Useful Tools and Services
Charles Web Debugging Proxy
Smore
thekll
V2EX  ›  iDev

ios app http 请求中的签名摘要值一般是如何计算的?

  •  
  •   thekll · 2016-02-24 16:51:26 +08:00 · 2089 次点击
    这是一个创建于 2996 天前的主题,其中的信息可能已经有所发展或是发生改变。
    比如, http request 以 multipart/form-date 形式向服务 POST 若干对键值数据,其中包括所有键值的签名摘要( 128 位),摘要与键值顺序无关。

    google 提到可以通过类似“ MD5(data,secret1,secret2) ”的代码产生签名摘要,我的疑问:
    1 、这个 data 数据是如何从多个键值转换过来的,怎么做到顺序无关呢?
    2 、 secret1 , secret2 到底是什么,如果是密码,客户端和服务端怎么协商得到这些密码?难道要在代码里硬编码?
    4 条回复    2016-02-24 23:52:00 +08:00
    fashioncj
        1
    fashioncj  
       2016-02-24 23:00:39 +08:00
    其实算法都是硬的。。数据应该是 map 然后按照字母顺序然后 hash , ios 不太懂, android 一般把这个写到 so 里面基本就安全了。。当然大厂例外。
    thekll
        2
    thekll  
    OP
       2016-02-24 23:37:50 +08:00
    @fashioncj
    是将键值对放入 map ,然后按照 key ( or value )的顺序生成字符串,然后再对此字符串计算 MD5 ?
    thekll
        3
    thekll  
    OP
       2016-02-24 23:45:20 +08:00
    还有,需要 hash 的字符串中一般包含 key 名称吗?
    fashioncj
        4
    fashioncj  
       2016-02-24 23:52:00 +08:00
    @thekll 看需求。。其实是需要的。。毕竟大家都会猜到你用了 md5.。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   6208 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 06:12 · PVG 14:12 · LAX 23:12 · JFK 02:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.