久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='uAe1v'></tfoot>

<i id='uAe1v'><tr id='uAe1v'><dt id='uAe1v'><q id='uAe1v'><span id='uAe1v'><b id='uAe1v'><form id='uAe1v'><ins id='uAe1v'></ins><ul id='uAe1v'></ul><sub id='uAe1v'></sub></form><legend id='uAe1v'></legend><bdo id='uAe1v'><pre id='uAe1v'><center id='uAe1v'></center></pre></bdo></b><th id='uAe1v'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uAe1v'><tfoot id='uAe1v'></tfoot><dl id='uAe1v'><fieldset id='uAe1v'></fieldset></dl></div>
    <bdo id='uAe1v'></bdo><ul id='uAe1v'></ul>
  • <small id='uAe1v'></small><noframes id='uAe1v'>

        <legend id='uAe1v'><style id='uAe1v'><dir id='uAe1v'><q id='uAe1v'></q></dir></style></legend>

        PHP中P_SHA1算法的實現

        Implementation of P_SHA1 algorithm in PHP(PHP中P_SHA1算法的實現)

                <tfoot id='S7teO'></tfoot>
                  <tbody id='S7teO'></tbody>

              • <small id='S7teO'></small><noframes id='S7teO'>

                • <bdo id='S7teO'></bdo><ul id='S7teO'></ul>
                • <i id='S7teO'><tr id='S7teO'><dt id='S7teO'><q id='S7teO'><span id='S7teO'><b id='S7teO'><form id='S7teO'><ins id='S7teO'></ins><ul id='S7teO'></ul><sub id='S7teO'></sub></form><legend id='S7teO'></legend><bdo id='S7teO'><pre id='S7teO'><center id='S7teO'></center></pre></bdo></b><th id='S7teO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='S7teO'><tfoot id='S7teO'></tfoot><dl id='S7teO'><fieldset id='S7teO'></fieldset></dl></div>
                  <legend id='S7teO'><style id='S7teO'><dir id='S7teO'><q id='S7teO'></q></dir></style></legend>
                  本文介紹了PHP中P_SHA1算法的實現的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我們正在嘗試實現一個函數 P_SHA1 表示 PHP.用 Python 編寫的函數的模式.但是,不幸的是,有些東西不能正常工作.下面是JAVA中的實現函數:http://ws.apache.org/wss4j/xref/org/apache/ws/security/conversation/dkalgo/P_SHA1.html

                  we are trying to implement a function P_SHA1 means PHP. The pattern of the function written in Python. But, unfortunately, something is not working properly. Here is the implementation function in JAVA: http://ws.apache.org/wss4j/xref/org/apache/ws/security/conversation/dkalgo/P_SHA1.html

                  我們的代碼:

                  <?php
                    $newSeed    = $label . $seed; // concat as strings
                    // $p_sha1
                    $psha1 = p_hash('sha1', $secret, $newSeed, $length);
                    $string = arrayToBytes($psha1);
                    /**
                    * P_SHA1 crypto alg calculation
                    *
                    * @return array of bytes - key
                    **/
                    function p_hash($algo, $secret, $seed, $length) {
                      $bytes = array_fill(0, $length, 0); 
                      $tmp = null;
                      $A = $seed;
                      $index = 0;
                  
                      while (1) {
                        // hmac sha1: secret + seed
                        $A = hash_hmac($algo, $secret, $A, true);
                  
                        // hmac sha1: secret + 1st hash + seed
                        $output = hash_hmac($algo, $secret, ($A . $seed), true);
                  
                        foreach (bytesToArray($output) as $c) {
                            if ($index >= $length) {
                                return $bytes;
                            }
                  
                            $bytes[$index] = $c;
                            $index++;
                        }
                      }
                      return $bytes;
                  }
                  
                  function bytesToArray($bytes) { return unpack('C*', $bytes); }
                  function arrayToBytes($array) { return call_user_func_array("pack", array_merge(array("C*"), $array)); }
                  ?>
                  

                  也許有人知道我在哪里可以找到現成的解決方案?或者任何人都可以幫助編寫腳本以使其正常工作?

                  Maybe someone knows where I can find a ready-made solution? Or anyone can help make a script to work properly?

                  推薦答案

                  這是基于 回復通過簽名 FS" SOAP 消息請求.我已經成功地使用它來簽署 SOAP 請求并獲得我想要的響應.

                  This is based on the C# method included in a reply to "signing SOAP message request via ADFS". I have successfully used it to sign SOAP requests and get the response I want.

                  function psha1($clientSecret, $serverSecret, $sizeBits = 256)
                  {
                      $sizeBytes = $sizeBits / 8;
                  
                      $hmacKey = $clientSecret;
                      $hashSize = 160; // HMAC_SHA1 length is always 160
                      $bufferSize = $hashSize / 8 + strlen($serverSecret);
                      $i = 0;
                  
                      $b1 = $serverSecret;
                      $b2 = "";
                      $temp = null;
                      $psha = array();
                  
                      while ($i < $sizeBytes) {
                          $b1 = hash_hmac('SHA1', $b1, $hmacKey, true);
                          $b2 = $b1 . $serverSecret;
                          $temp = hash_hmac('SHA1', $b2, $hmacKey, true);
                  
                          for ($j = 0; $j < strlen($temp); $j++) {
                              if ($i < $sizeBytes) {
                                  $psha[$i] = $temp[$j];
                                  $i++;
                              } else {
                                  break;
                              }
                          }
                      }
                  
                      return implode("", $psha);
                  }
                  

                  需要注意的重要一點是,客戶端機密和服務器機密在傳遞給此函數之前應該進行 base64 解碼.

                  One thing of importance to note is that the client secret and server secret should be base64 decoded before being passed to this function.

                  這篇關于PHP中P_SHA1算法的實現的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  enable SOAP on PHP(在 PHP 上啟用 SOAP)
                  Get received XML from PHP SOAP Server(從 PHP SOAP 服務器獲取接收到的 XML)
                  not a valid AllXsd value(不是有效的 AllXsd 值)
                  PHP SoapClient: SoapFault exception Could not connect to host(PHP SoapClient:SoapFault 異常無法連接到主機)
                  Sending a byte array from PHP to WCF(將字節數組從 PHP 發送到 WCF)
                  SoapClient error fallback in PHP(PHP 中的 SoapClient 錯誤回退)
                      <tbody id='kTLIt'></tbody>

                      <bdo id='kTLIt'></bdo><ul id='kTLIt'></ul>
                      <i id='kTLIt'><tr id='kTLIt'><dt id='kTLIt'><q id='kTLIt'><span id='kTLIt'><b id='kTLIt'><form id='kTLIt'><ins id='kTLIt'></ins><ul id='kTLIt'></ul><sub id='kTLIt'></sub></form><legend id='kTLIt'></legend><bdo id='kTLIt'><pre id='kTLIt'><center id='kTLIt'></center></pre></bdo></b><th id='kTLIt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kTLIt'><tfoot id='kTLIt'></tfoot><dl id='kTLIt'><fieldset id='kTLIt'></fieldset></dl></div>
                    • <tfoot id='kTLIt'></tfoot>

                        <small id='kTLIt'></small><noframes id='kTLIt'>

                      1. <legend id='kTLIt'><style id='kTLIt'><dir id='kTLIt'><q id='kTLIt'></q></dir></style></legend>

                          • 主站蜘蛛池模板: 欧美精品久久 | 久久亚洲国产精品日日av夜夜 | 免费午夜剧场 | 国产精品久久久久久久久久 | 亚欧午夜 | 色婷婷九月 | 欧美一级黄色免费看 | 免费高清av| 一级中国毛片 | 欧美日韩高清一区 | 中文字幕亚洲精品 | 亚洲成人日韩 | 在线成人一区 | 97国产在线观看 | 男人阁久久 | 欧美一级二级视频 | 精品国产一区探花在线观看 | 高清国产一区二区 | 国产精品污www一区二区三区 | 国产视频一区二区 | 国产精品99久久久久久久久久久久 | 91精品国产乱码麻豆白嫩 | 国产色网站 | 毛片a级| 国产精品日韩 | 久久看片| 精品成人免费一区二区在线播放 | 综合九九 | 亚洲国产小视频 | 我爱操 | 国产欧美在线 | 91 久久| 国户精品久久久久久久久久久不卡 | 久久国产精品免费一区二区三区 | 日本一区二区三区四区 | av片网| 欧美日韩久久精品 | 91精品国产91久久久久久密臀 | 成人免费在线观看视频 | 日本成人久久 | 日本久久www成人免 成人久久久久 |