holinhot
V2EX  ›  问与答

问下 php sha256 问题

  •  
  •   holinhot · Feb 23, 2016 · 1901 views
    This topic created in 3734 days ago, the information mentioned may be changed or developed.

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

    这个在 php 里怎么处理

    holinhot
        1
    holinhot  
    OP
       Feb 23, 2016
    这是 shell
    holinhot
        2
    holinhot  
    OP
       Feb 23, 2016
    我搞定了 谢谢大家


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

    $aa=base64_encode($a);
    echo urlencode($aa);
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1047 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 23:00 · PVG 07:00 · LAX 16:00 · JFK 19:00
    ♥ Do have faith in what you're doing.