<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 散列和加密 ### 組態 首次安裝October時,應該已經為您生成了一個隨機密鑰。您可以通過檢查配置文件的`key`選項來確認`config/app.php`。如果密鑰保持不變,則應將其設置為32個字符的隨機字符串。如果未正確設置此值,則所有加密值將不安全。 ### [](https://octobercms.com/docs/services/hashing-encryption#hashing)散列 該`Hash`外觀提供用于存儲用戶密碼的安全Bcrypt哈希。Bcrypt是散列密碼的絕佳選擇,因為它的“工作因子”是可調的,這意味著隨著硬件能力的提高,生成散列所花費的時間可以增加。 您可以通過調用外觀`make`上的方法來對密碼進行哈希處理`Hash`: ~~~ $user = new User; $user->password = Hash::make('mypassword'); $user->save(); ~~~ 或者,模型可以實現[Hashable特征](https://octobercms.com/docs/database/traits#hashable)以自動對屬性進行哈希處理。 #### 針對哈希驗證密碼 該`check`方法允許您驗證給定的純文本字符串是否與給定的哈希相對應。 ~~~ if (Hash::check('plain-text', $hashedPassword)) { // The passwords match... } ~~~ #### 檢查是否需要重新輸入密碼 該`needsRehash`函數允許您確定自哈希密碼以來哈希器使用的工作因子是否已更改: ~~~ if (Hash::needsRehash($hashed)) { $hashed = Hash::make('plain-text'); } ~~~ ### [](https://octobercms.com/docs/services/hashing-encryption#encryption)加密 您可以使用`Crypt`外觀對值進行加密。所有加密的值都使用OpenSSL和`AES-256-CBC`密碼進行加密。此外,所有加密值都用消息認證碼(MAC)簽名,以檢測對加密字符串的任何修改。 例如,我們可以使用該`encrypt`方法對機密進行加密并將其存儲在[數據庫模型中](https://octobercms.com/docs/database/model): ~~~ $user = new User; $user->secret = Crypt::encrypt('shhh no telling'); $user->save(); ~~~ #### 解密值 當然,您可以使用外觀`decrypt`上的方法解密值`Crypt`。如果無法正確解密該值(例如,當MAC無效時),`Illuminate\Contracts\Encryption\DecryptException`將引發異常: ~~~ use Illuminate\Contracts\Encryption\DecryptException; try { $decrypted = Crypt::decrypt($encryptedValue); } catch (DecryptException $ex) { // } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看