V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
holinhot
V2EX  ›  问与答

问下 php sha256 问题

  •  
  •   holinhot · 2016-02-23 22:40:14 +08:00 · 1574 次点击
    这是一个创建于 2990 天前的主题,其中的信息可能已经有所发展或是发生改变。

    id=$(echo -n "mydata" | openssl dgst -sha256 -hmac "mykey" -binary | openssl enc -base64)

    这个在 php 里怎么处理

    holinhot
        1
    holinhot  
    OP
       2016-02-23 22:41:45 +08:00
    这是 shell
    holinhot
        2
    holinhot  
    OP
       2016-02-23 23:00:32 +08:00
    我搞定了 谢谢大家


    $a=hash_hmac('sha256', $hs, $PRIVATE_KEY, true);

    $aa=base64_encode($a);
    echo urlencode($aa);
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1010 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:36 · PVG 07:36 · LAX 16:36 · JFK 19:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.