簡體   English   中英

Cakephp 2.x security.salt如何工作?

[英]How does Cakephp 2.x security.salt works?

我正在嘗試移動我的Cakephp 2項目,並且我想保留相同的數據庫。 我已經使用哈希'sha1'和Cakephp security.salt來加密用戶密碼:

public static function hash($password, $method = 'sha1', $salt = true) {
    return Security::hash($password, $method, $salt);
}

我(很久以前)在myproject/app/config/core.php此密碼(使用不同的密碼):

    Configure::write('Security.salt', 'T4R393b0qyJioxfs2guVoUubWwvniR2G0Fgartge');

現在我不知道如何在另一個框架上使用此Security.salt代碼。 所以,請:

  • 有人知道我是否可以在Angular 2/4項目中使用這種加密嗎?

  • 還有其他解決方案嗎?

謝謝!

我找到了! 感謝大家。

我必須連接鹽和密碼。 之后,我做哈希'sha1'。

例如: hash(Security.salt . $password)

myproject/cake/libs/security.php以“ ndm”的形式找到它:

function hash($string, $type = null, $salt = false) {
    $_this =& Security::getInstance();

    if ($salt) {
        if (is_string($salt)) {
            $string = $salt . $string;
        } else {
            $string = Configure::read('Security.salt') . $string;
        }
    }

    ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM