亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rc6engine.java

?? 內容:基于jdk1.4的加密算法的具體實現
?? JAVA
字號:
package org.bouncycastle.crypto.engines;import org.bouncycastle.crypto.BlockCipher;import org.bouncycastle.crypto.CipherParameters;import org.bouncycastle.crypto.params.KeyParameter;/** * An RC6 engine. */public class RC6Engine    implements BlockCipher{    private static final int wordSize = 32;    private static final int bytesPerWord = wordSize / 8;    /*     * the number of rounds to perform     */    private static final int _noRounds = 20;    /*     * the expanded key array of size 2*(rounds + 1)     */    private int _S[];    /*     * our "magic constants" for wordSize 32     *     * Pw = Odd((e-2) * 2^wordsize)     * Qw = Odd((o-2) * 2^wordsize)     *     * where e is the base of natural logarithms (2.718281828...)     * and o is the golden ratio (1.61803398...)     */    private static final int    P32 = 0xb7e15163;    private static final int    Q32 = 0x9e3779b9;    private static final int    LGW = 5;        // log2(32)    private boolean forEncryption;    /**     * Create an instance of the RC6 encryption algorithm     * and set some defaults     */    public RC6Engine()    {        _S            = null;    }    public String getAlgorithmName()    {        return "RC6";    }    public int getBlockSize()    {        return 4 * bytesPerWord;    }    /**     * initialise a RC5-32 cipher.     *     * @param forEncryption whether or not we are for encryption.     * @param params the parameters required to set up the cipher.     * @exception IllegalArgumentException if the params argument is     * inappropriate.     */    public void init(        boolean             forEncryption,        CipherParameters    params)    {        if (!(params instanceof KeyParameter))        {            throw new IllegalArgumentException("invalid parameter passed to RC6 init - " + params.getClass().getName());        }        KeyParameter       p = (KeyParameter)params;        this.forEncryption = forEncryption;        setKey(p.getKey());    }    public int processBlock(        byte[]  in,        int     inOff,        byte[]  out,        int     outOff)    {        return (forEncryption) ? encryptBlock(in, inOff, out, outOff)                                     : decryptBlock(in, inOff, out, outOff);    }    public void reset()    {    }    /**     * Re-key the cipher.     * <p>     * @param  inKey  the key to be used     */    private void setKey(        byte[]      key)    {        //        // KEY EXPANSION:        //        // There are 3 phases to the key expansion.        //        // Phase 1:        //   Copy the secret key K[0...b-1] into an array L[0..c-1] of        //   c = ceil(b/u), where u = wordSize/8 in little-endian order.        //   In other words, we fill up L using u consecutive key bytes        //   of K. Any unfilled byte positions in L are zeroed. In the        //   case that b = c = 0, set c = 1 and L[0] = 0.        //        // compute number of dwords        int c = (key.length + (bytesPerWord - 1)) / bytesPerWord;        if (c == 0)        {            c = 1;        }        int[]   L = new int[(key.length + bytesPerWord - 1) / bytesPerWord];        // load all key bytes into array of key dwords        for (int i = key.length - 1; i >= 0; i--)        {            L[i / bytesPerWord] = (L[i / bytesPerWord] << 8) + (key[i] & 0xff);        }        //        // Phase 2:        //   Key schedule is placed in a array of 2+2*ROUNDS+2 = 44 dwords.        //   Initialize S to a particular fixed pseudo-random bit pattern        //   using an arithmetic progression modulo 2^wordsize determined        //   by the magic numbers, Pw & Qw.        //        _S            = new int[2+2*_noRounds+2];        _S[0] = P32;        for (int i=1; i < _S.length; i++)        {            _S[i] = (_S[i-1] + Q32);        }        //        // Phase 3:        //   Mix in the user's secret key in 3 passes over the arrays S & L.        //   The max of the arrays sizes is used as the loop control        //        int iter;        if (L.length > _S.length)        {            iter = 3 * L.length;        }        else        {            iter = 3 * _S.length;        }        int A = 0;        int B = 0;        int i = 0, j = 0;        for (int k = 0; k < iter; k++)        {            A = _S[i] = rotateLeft(_S[i] + A + B, 3);            B =  L[j] = rotateLeft(L[j] + A + B, A+B);            i = (i+1) % _S.length;            j = (j+1) %  L.length;        }    }    private int encryptBlock(        byte[]  in,        int     inOff,        byte[]  out,        int     outOff)    {        // load A,B,C and D registers from in.        int A = bytesToWord(in, inOff);        int B = bytesToWord(in, inOff + bytesPerWord);        int C = bytesToWord(in, inOff + bytesPerWord*2);        int D = bytesToWord(in, inOff + bytesPerWord*3);                // Do pseudo-round #0: pre-whitening of B and D        B += _S[0];        D += _S[1];        // perform round #1,#2 ... #ROUNDS of encryption         for (int i = 1; i <= _noRounds; i++)        {            int t = 0,u = 0;                        t = B*(2*B+1);            t = rotateLeft(t,5);                        u = D*(2*D+1);            u = rotateLeft(u,5);                        A ^= t;            A = rotateLeft(A,u);            A += _S[2*i];                        C ^= u;            C = rotateLeft(C,t);            C += _S[2*i+1];                        int temp = A;            A = B;            B = C;            C = D;            D = temp;                    }        // do pseudo-round #(ROUNDS+1) : post-whitening of A and C        A += _S[2*_noRounds+2];        C += _S[2*_noRounds+3];                    // store A, B, C and D registers to out                wordToBytes(A, out, outOff);        wordToBytes(B, out, outOff + bytesPerWord);        wordToBytes(C, out, outOff + bytesPerWord*2);        wordToBytes(D, out, outOff + bytesPerWord*3);                return 4 * bytesPerWord;    }    private int decryptBlock(        byte[]  in,        int     inOff,        byte[]  out,        int     outOff)    {        // load A,B,C and D registers from out.        int A = bytesToWord(in, inOff);        int B = bytesToWord(in, inOff + bytesPerWord);        int C = bytesToWord(in, inOff + bytesPerWord*2);        int D = bytesToWord(in, inOff + bytesPerWord*3);        // Undo pseudo-round #(ROUNDS+1) : post whitening of A and C         C -= _S[2*_noRounds+3];        A -= _S[2*_noRounds+2];                // Undo round #ROUNDS, .., #2,#1 of encryption         for (int i = _noRounds; i >= 1; i--)        {            int t=0,u = 0;                        int temp = D;            D = C;            C = B;            B = A;            A = temp;                        t = B*(2*B+1);            t = rotateLeft(t, LGW);                        u = D*(2*D+1);            u = rotateLeft(u, LGW);                        C -= _S[2*i+1];            C = rotateRight(C,t);            C ^= u;                        A -= _S[2*i];            A = rotateRight(A,u);            A ^= t;                    }        // Undo pseudo-round #0: pre-whitening of B and D        D -= _S[1];        B -= _S[0];                wordToBytes(A, out, outOff);        wordToBytes(B, out, outOff + bytesPerWord);        wordToBytes(C, out, outOff + bytesPerWord*2);        wordToBytes(D, out, outOff + bytesPerWord*3);                return 4 * bytesPerWord;    }        //////////////////////////////////////////////////////////////    //    // PRIVATE Helper Methods    //    //////////////////////////////////////////////////////////////    /**     * Perform a left "spin" of the word. The rotation of the given     * word <em>x</em> is rotated left by <em>y</em> bits.     * Only the <em>lg(wordSize)</em> low-order bits of <em>y</em>     * are used to determine the rotation amount. Here it is      * assumed that the wordsize used is a power of 2.     * <p>     * @param  x  word to rotate     * @param  y    number of bits to rotate % wordSize     */    private int rotateLeft(int x, int y)    {        return ((x << (y & (wordSize-1))) | (x >>> (wordSize - (y & (wordSize-1)))));    }    /**     * Perform a right "spin" of the word. The rotation of the given     * word <em>x</em> is rotated left by <em>y</em> bits.     * Only the <em>lg(wordSize)</em> low-order bits of <em>y</em>     * are used to determine the rotation amount. Here it is      * assumed that the wordsize used is a power of 2.     * <p>     * @param  x  word to rotate     * @param  y    number of bits to rotate % wordSize     */    private int rotateRight(int x, int y)    {        return ((x >>> (y & (wordSize-1))) | (x << (wordSize - (y & (wordSize-1)))));    }    private int bytesToWord(        byte[]  src,        int     srcOff)    {        int    word = 0;        for (int i = bytesPerWord - 1; i >= 0; i--)        {            word = (word << 8) + (src[i + srcOff] & 0xff);        }        return word;    }    private void wordToBytes(        int    word,        byte[]  dst,        int     dstOff)    {        for (int i = 0; i < bytesPerWord; i++)        {            dst[i + dstOff] = (byte)word;            word >>>= 8;        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
在线播放视频一区| 91免费看`日韩一区二区| 亚洲一区二区精品视频| 国产日韩高清在线| 久久综合av免费| 久久精品夜色噜噜亚洲a∨| 日韩美女一区二区三区四区| 日韩视频国产视频| 欧美一级电影网站| 26uuu国产电影一区二区| 亚洲精品在线观| 久久久精品国产免费观看同学| 亚洲精品在线网站| 国产精品久久免费看| 国产精品毛片大码女人| 亚洲精品国产成人久久av盗摄 | 91在线国产福利| 色天天综合色天天久久| 欧美日韩小视频| 久久亚洲精品小早川怜子| 中文字幕免费观看一区| 一区二区三区欧美在线观看| 首页欧美精品中文字幕| 精品一区二区三区免费播放| 国产成人在线色| 色天天综合色天天久久| 欧美一二三在线| 日本一区二区三区免费乱视频| 最新欧美精品一区二区三区| 午夜精品久久久久久久久久久 | 国产精品久久久久久福利一牛影视| 亚洲欧美日韩中文播放 | 在线亚洲欧美专区二区| 91精品国模一区二区三区| 久久久欧美精品sm网站| 一区二区三区国产| 国产一区二区视频在线| 色哟哟在线观看一区二区三区| 欧美一区二区二区| 亚洲免费在线观看| 国内不卡的二区三区中文字幕| 91久久国产综合久久| 久久青草欧美一区二区三区| 亚洲福利一二三区| 波多野结衣在线aⅴ中文字幕不卡| 欧美日韩一区二区三区免费看| 久久久不卡影院| 免费日韩伦理电影| 欧美性生交片4| 国产欧美日韩麻豆91| 捆绑调教美女网站视频一区| 97久久超碰国产精品电影| 精品国产一区二区精华| 亚洲综合图片区| 粉嫩aⅴ一区二区三区四区 | 91麻豆精品秘密| 久久久久九九视频| 久久国产三级精品| 欧美日韩午夜在线视频| 一区二区在线观看免费视频播放 | 亚洲毛片av在线| 国产成人高清在线| 欧美大白屁股肥臀xxxxxx| 亚洲综合网站在线观看| 91亚洲精品久久久蜜桃| 国产精品午夜电影| 国产最新精品免费| 精品国内片67194| 麻豆国产一区二区| 欧美一区二区三区在线观看| 日韩国产精品久久久久久亚洲| 欧美在线综合视频| 一区二区三区日韩| 欧美猛男gaygay网站| 一区二区三区日本| 欧美精品在线观看播放| 日韩在线a电影| 91麻豆精品国产综合久久久久久| 亚洲午夜在线电影| 91精品国产综合久久精品性色| 午夜精品久久久久久久久| 在线成人午夜影院| 捆绑变态av一区二区三区| 日韩美女一区二区三区四区| 激情图片小说一区| 中文字幕欧美激情| 日本久久电影网| 午夜电影一区二区| 日韩精品一区二区三区视频在线观看| 美女视频一区在线观看| 欧美成人高清电影在线| 国产高清一区日本| 日韩毛片精品高清免费| 欧美日本在线观看| 韩国一区二区三区| 最好看的中文字幕久久| 欧美日韩一二区| 精品亚洲porn| 国产精品蜜臀在线观看| 欧美四级电影网| 国产乱子伦一区二区三区国色天香| 国产欧美日韩精品在线| 91精品91久久久中77777| 亚洲不卡一区二区三区| 久久久综合网站| 日本道色综合久久| 久久精品国产99久久6| 久久九九久久九九| 欧美亚洲日本国产| 国产麻豆成人精品| 午夜国产精品影院在线观看| 中文字幕欧美激情| 日韩欧美高清一区| 在线视频欧美区| 福利一区在线观看| 免费观看一级欧美片| 国产精品女上位| 日韩久久精品一区| 欧美性感一区二区三区| 国产成人综合视频| 免费的成人av| 亚洲一区日韩精品中文字幕| 国产亚洲人成网站| 7777精品伊人久久久大香线蕉的| 成人手机电影网| 久久66热偷产精品| 五月天中文字幕一区二区| 国产日韩欧美精品综合| 日韩午夜激情av| 欧美性猛交xxxx乱大交退制版| 国产精品一区在线观看乱码 | 精品国产一区二区三区av性色 | 久久久久久久久久久电影| 欧美日韩国产大片| 91美女视频网站| 国产.欧美.日韩| 日本成人在线网站| 日韩影院在线观看| 亚洲gay无套男同| 亚洲自拍偷拍网站| 亚洲欧美日韩小说| 亚洲婷婷国产精品电影人久久| 亚洲国产精品v| 国产日韩在线不卡| 国产欧美精品一区二区三区四区| 日韩免费性生活视频播放| 欧美精品黑人性xxxx| 欧美三级三级三级爽爽爽| 日本韩国欧美三级| 91浏览器打开| 在线观看区一区二| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 91年精品国产| 欧美在线一区二区三区| 欧美日韩中文字幕一区二区| 欧美亚洲一区二区三区四区| 欧美日韩亚州综合| 欧美一级久久久| 久久精品视频在线看| 中文字幕欧美三区| 亚洲色图第一区| 亚洲国产欧美在线| 日本三级亚洲精品| 国产在线不卡一区| 成人一二三区视频| 色婷婷国产精品久久包臀| 欧美日韩精品欧美日韩精品一| 3751色影院一区二区三区| 日韩精品一区二区三区在线观看 | 日韩午夜激情免费电影| 精品捆绑美女sm三区| 欧美激情自拍偷拍| 亚洲欧美另类久久久精品2019| 亚洲免费伊人电影| 青青草97国产精品免费观看 | 成人福利电影精品一区二区在线观看| 97se亚洲国产综合在线| 欧洲精品一区二区三区在线观看| 欧美日韩精品综合在线| 久久一区二区三区四区| 国产精品视频你懂的| 亚洲成人av电影在线| 国产乱码精品1区2区3区| 91在线高清观看| 日韩西西人体444www| 国产精品国产三级国产aⅴ原创| 亚洲国产精品一区二区www| 精品中文字幕一区二区小辣椒| av在线不卡电影| 91精品国产综合久久久久久 | 国产精品午夜免费| 婷婷夜色潮精品综合在线| 国产福利精品一区二区| 欧美在线一区二区三区| 国产人久久人人人人爽| 午夜欧美电影在线观看| 成人午夜短视频| 日韩视频永久免费| 一区二区视频在线看| 国产又黄又大久久|