V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
tanteng
V2EX  ›  PHP

授权用的 APPSecret 一般是什么算法生成的呢?

  •  
  •   tanteng · May 21, 2015 · 8823 views
    This topic created in 3994 days ago, the information mentioned may be changed or developed.

    如图,在做服务器给第三方授权的时候,申请接口授权的一方往往要获得APPKEY和APPSecret,它们一般都是根据什么算法生成的?可以的话有代码示例更好了,谢谢!
    4 replies    2015-05-22 11:45:12 +08:00
    oa414
        1
    oa414  
       May 21, 2015
    之前自己做的是随机生成一串16进制数。
    ```ruby
    app_secret = SecureRandom.hex(32)
    ```
    wy315700
        2
    wy315700  
       May 22, 2015
    /dev/urandom
    powergx
        3
    powergx  
       May 22, 2015 via iPhone
    uuid
    julyclyde
        4
    julyclyde  
       May 22, 2015
    考虑到“可吊销性”这个需求,ID和secret不应该有任何算法上的联系
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1406 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 17:10 · PVG 01:10 · LAX 10:10 · JFK 13:10
    ♥ Do have faith in what you're doing.