holinhot
V2EX  ›  问与答

问下 php sha256 问题

  •  
  •   holinhot · Feb 23, 2016 · 2014 views
    This topic created in 3801 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   ·   946 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 512acd8b · 622ms · UTC 20:41 · PVG 04:41 · LAX 13:41 · JFK 16:41
    ♥ Do have faith in what you're doing.