亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        Jenkins專有用戶數(shù)據(jù)庫加密算法簡(jiǎn)析

        字號(hào):


            名單
            HudsonPrivateSecurityRealm.java詳細(xì)路徑是:jenkins/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
            通過分析該源碼得知:
            1、密文的格式為:salt: encPass,其中以#jbcrypt表示salt作為數(shù)據(jù)頭
            2、明文通過jbcrypt算法得到密文 encPass
            關(guān)于jbcrypt:
            jbcrypt是bcrypt加密工具的java實(shí)現(xiàn)。
            它的API非常簡(jiǎn)單,DEMO如下,在HudsonPrivateSecurityRealm.java中可以看到加密和校驗(yàn)時(shí)使用了如下API:
            // Hash a password for the first time
            String hashed = BCrypt.hashpw(password, BCrypt.gensalt());
            // gensalt's log_rounds parameter determines the complexity the work factor is 2**log_rounds, and the default is 10
            String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));
            // Check that an unencrypted password matches one that has previously been hashed
            if (BCrypt.checkpw(candidate, hashed))
            System.out.println("It matches");
            else
            System.out.println("It does not match");
            經(jīng)驗(yàn)證,用jbcrypt對(duì)同一個(gè)明文加密后因?yàn)閟alt一般不同,加密后的密文一般不同
            關(guān)于bcrypt:
            1、bcrypt是不可逆的加密算法,無法通過解密密文得到明文。
            2、bcrypt和其他對(duì)稱或非對(duì)稱加密方式不同的是,不是直接解密得到明文,也不是二次加密比較密文,而是把明文和存儲(chǔ)的密文一塊運(yùn)算得到另一個(gè)密文,如果這兩個(gè)密文相同則驗(yàn)證成功。
            綜上,Jenkins專有用戶數(shù)據(jù)庫使用了jbcrypt加密,jbcrypt加密是不可逆的,而且對(duì)于同一個(gè)明文的加密結(jié)果一般不同。