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

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

?? ideaengine.java

?? 內容:基于jdk1.4的加密算法的具體實現
?? JAVA
字號:
package org.bouncycastle.crypto.engines;import org.bouncycastle.crypto.BlockCipher;import org.bouncycastle.crypto.CipherParameters;import org.bouncycastle.crypto.DataLengthException;import org.bouncycastle.crypto.params.KeyParameter;/** * A class that provides a basic International Data Encryption Algorithm (IDEA) engine. * <p> * This implementation is based on the "HOWTO: INTERNATIONAL DATA ENCRYPTION ALGORITHM" * implementation summary by Fauzan Mirza (F.U.Mirza@sheffield.ac.uk). (baring 1 typo at the * end of the mulinv function!). * <p> * It can be found at ftp://ftp.funet.fi/pub/crypt/cryptography/symmetric/idea/ * <p> * Note: This algorithm is patented in the USA, Japan, and Europe including * at least Austria, France, Germany, Italy, Netherlands, Spain, Sweden, Switzerland * and the United Kingdom. Non-commercial use is free, however any commercial * products are liable for royalties. Please see * <a href="http://www.mediacrypt.com">www.mediacrypt.com</a> for * further details. This announcement has been included at the request of * the patent holders. */public class IDEAEngine    implements BlockCipher{    protected static final int  BLOCK_SIZE = 8;    private int[]               workingKey = null;    /**     * standard constructor.     */    public IDEAEngine()    {    }    /**     * initialise an IDEA 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)        {            workingKey = generateWorkingKey(forEncryption,                                  ((KeyParameter)params).getKey());            return;        }        throw new IllegalArgumentException("invalid parameter passed to IDEA init - " + params.getClass().getName());    }    public String getAlgorithmName()    {        return "IDEA";    }    public int getBlockSize()    {        return BLOCK_SIZE;    }    public int processBlock(        byte[] in,        int inOff,        byte[] out,        int outOff)    {        if (workingKey == null)        {            throw new IllegalStateException("IDEA engine not initialised");        }        if ((inOff + BLOCK_SIZE) > in.length)        {            throw new DataLengthException("input buffer too short");        }        if ((outOff + BLOCK_SIZE) > out.length)        {            throw new DataLengthException("output buffer too short");        }        ideaFunc(workingKey, in, inOff, out, outOff);        return BLOCK_SIZE;    }    public void reset()    {    }    private static final int    MASK = 0xffff;    private static final int    BASE = 0x10001;    private int bytesToWord(        byte[]  in,        int     inOff)    {        return ((in[inOff] << 8) & 0xff00) + (in[inOff + 1] & 0xff);    }    private void wordToBytes(        int     word,        byte[]  out,        int     outOff)    {        out[outOff] = (byte)(word >>> 8);        out[outOff + 1] = (byte)word;    }    /**     * return x = x * y where the multiplication is done modulo     * 65537 (0x10001) (as defined in the IDEA specification) and     * a zero input is taken to be 65536 (0x10000).     *     * @param x the x value     * @param y the y value     * @return x = x * y     */    private int mul(        int x,        int y)    {        if (x == 0)        {            x = (BASE - y);        }        else if (y == 0)        {            x = (BASE - x);        }        else        {            int     p = x * y;            y = p & MASK;            x = p >>> 16;            x = y - x + ((y < x) ? 1 : 0);        }        return x & MASK;    }    private void ideaFunc(        int[]   workingKey,        byte[]  in,        int     inOff,        byte[]  out,        int     outOff)    {        int     x0, x1, x2, x3, t0, t1;        int     keyOff = 0;        x0 = bytesToWord(in, inOff);        x1 = bytesToWord(in, inOff + 2);        x2 = bytesToWord(in, inOff + 4);        x3 = bytesToWord(in, inOff + 6);        for (int round = 0; round < 8; round++)        {            x0 = mul(x0, workingKey[keyOff++]);            x1 += workingKey[keyOff++];            x1 &= MASK;            x2 += workingKey[keyOff++];            x2 &= MASK;            x3 = mul(x3, workingKey[keyOff++]);            t0 = x1;            t1 = x2;            x2 ^= x0;            x1 ^= x3;            x2 = mul(x2, workingKey[keyOff++]);            x1 += x2;            x1 &= MASK;            x1 = mul(x1, workingKey[keyOff++]);            x2 += x1;            x2 &= MASK;            x0 ^= x1;            x3 ^= x2;            x1 ^= t1;            x2 ^= t0;        }        wordToBytes(mul(x0, workingKey[keyOff++]), out, outOff);        wordToBytes(x2 + workingKey[keyOff++], out, outOff + 2);  /* NB: Order */        wordToBytes(x1 + workingKey[keyOff++], out, outOff + 4);        wordToBytes(mul(x3, workingKey[keyOff]), out, outOff + 6);    }    /**     * The following function is used to expand the user key to the encryption     * subkey. The first 16 bytes are the user key, and the rest of the subkey     * is calculated by rotating the previous 16 bytes by 25 bits to the left,     * and so on until the subkey is completed.     */    private int[] expandKey(        byte[]  uKey)    {        int[]   key = new int[52];        if (uKey.length < 16)        {            byte[]  tmp = new byte[16];            System.arraycopy(uKey, 0, tmp, tmp.length - uKey.length, uKey.length);            uKey = tmp;        }        for (int i = 0; i < 8; i++)        {            key[i] = bytesToWord(uKey, i * 2);        }        for (int i = 8; i < 52; i++)        {            if ((i & 7) < 6)            {                key[i] = ((key[i - 7] & 127) << 9 | key[i - 6] >> 7) & MASK;            }            else if ((i & 7) == 6)            {                key[i] = ((key[i - 7] & 127) << 9 | key[i - 14] >> 7) & MASK;            }            else            {                key[i] = ((key[i - 15] & 127) << 9 | key[i - 14] >> 7) & MASK;            }        }        return key;    }    /**     * This function computes multiplicative inverse using Euclid's Greatest     * Common Divisor algorithm. Zero and one are self inverse.     * <p>     * i.e. x * mulInv(x) == 1 (modulo BASE)     */    private int mulInv(        int x)    {        int t0, t1, q, y;                if (x < 2)        {            return x;        }        t0 = 1;        t1 = BASE / x;        y  = BASE % x;        while (y != 1)        {            q = x / y;            x = x % y;            t0 = (t0 + (t1 * q)) & MASK;            if (x == 1)            {                return t0;            }            q = y / x;            y = y % x;            t1 = (t1 + (t0 * q)) & MASK;        }        return (1 - t1) & MASK;    }    /**     * Return the additive inverse of x.     * <p>     * i.e. x + addInv(x) == 0     */    int addInv(        int x)    {        return (0 - x) & MASK;    }        /**     * The function to invert the encryption subkey to the decryption subkey.     * It also involves the multiplicative inverse and the additive inverse functions.     */    private int[] invertKey(        int[] inKey)    {        int     t1, t2, t3, t4;        int     p = 52;                 /* We work backwards */        int[]   key = new int[52];        int     inOff = 0;            t1 = mulInv(inKey[inOff++]);        t2 = addInv(inKey[inOff++]);        t3 = addInv(inKey[inOff++]);        t4 = mulInv(inKey[inOff++]);        key[--p] = t4;        key[--p] = t3;        key[--p] = t2;        key[--p] = t1;            for (int round = 1; round < 8; round++)        {            t1 = inKey[inOff++];            t2 = inKey[inOff++];            key[--p] = t2;            key[--p] = t1;                t1 = mulInv(inKey[inOff++]);            t2 = addInv(inKey[inOff++]);            t3 = addInv(inKey[inOff++]);            t4 = mulInv(inKey[inOff++]);            key[--p] = t4;            key[--p] = t2; /* NB: Order */            key[--p] = t3;            key[--p] = t1;        }        t1 = inKey[inOff++];        t2 = inKey[inOff++];        key[--p] = t2;        key[--p] = t1;            t1 = mulInv(inKey[inOff++]);        t2 = addInv(inKey[inOff++]);        t3 = addInv(inKey[inOff++]);        t4 = mulInv(inKey[inOff]);        key[--p] = t4;        key[--p] = t3;        key[--p] = t2;        key[--p] = t1;        return key;    }        private int[] generateWorkingKey(        boolean forEncryption,        byte[]  userKey)    {        if (forEncryption)        {            return expandKey(userKey);        }        else        {            return invertKey(expandKey(userKey));        }    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产伦精品一区二区三区视频青涩 | 91无套直看片红桃| 久久精品视频一区| 国产传媒欧美日韩成人| 久久精品水蜜桃av综合天堂| 成人中文字幕在线| 日韩一区在线免费观看| 欧洲av在线精品| 亚洲福中文字幕伊人影院| 5月丁香婷婷综合| 久久成人久久爱| 国产精品美女久久久久aⅴ| 色综合久久88色综合天天 | 精品视频在线视频| 日韩av一二三| 久久免费的精品国产v∧| 99re这里只有精品6| 亚洲成人免费观看| 日韩三级视频在线看| 国产丶欧美丶日本不卡视频| 中文字幕一区二| 91精品中文字幕一区二区三区| 久久99精品国产| 亚洲天堂福利av| 日韩欧美高清在线| eeuss鲁片一区二区三区| 亚洲成av人影院在线观看网| 日韩三级在线免费观看| 97精品久久久久中文字幕| 日韩成人午夜电影| 欧美—级在线免费片| 欧美色老头old∨ideo| 国产精品一级黄| 亚洲成人中文在线| 国产女人水真多18毛片18精品视频 | 亚洲一区二区三区精品在线| 欧美一区二区三区四区视频| 国产99精品国产| 五月综合激情网| 国产欧美精品一区aⅴ影院| 欧美在线不卡视频| 国产精品一区二区久久精品爱涩| 亚洲欧美国产三级| 精品久久国产老人久久综合| 色综合色综合色综合色综合色综合 | 欧美tickling网站挠脚心| 成人av在线网| 精品系列免费在线观看| 亚洲猫色日本管| 2023国产精品视频| 欧美绝品在线观看成人午夜影视| 国产91精品在线观看| 奇米色一区二区| 亚洲自拍偷拍网站| 国产精品久久午夜| 久久久国产一区二区三区四区小说 | 一区二区三区精品视频在线| 国产色91在线| 精品国产精品网麻豆系列| 91老司机福利 在线| 懂色av一区二区在线播放| 日本系列欧美系列| 亚洲国产精品视频| 亚洲人成精品久久久久| 国产精品伦理在线| 精品国产乱码久久久久久老虎| 欧美嫩在线观看| 欧美午夜一区二区| 在线视频你懂得一区| www.欧美日韩国产在线| 盗摄精品av一区二区三区| 国产一区二区在线免费观看| 麻豆国产一区二区| 青青草视频一区| 日韩1区2区日韩1区2区| 日韩福利电影在线| 日韩黄色在线观看| 日韩成人dvd| 久久成人综合网| 国产精品资源网站| 国产成人免费在线视频| 国产精品资源网| 国产999精品久久| 不卡的电影网站| 97精品视频在线观看自产线路二| a亚洲天堂av| 在线亚洲免费视频| 欧洲精品一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 91精品欧美福利在线观看| 欧美丝袜第三区| 欧美日韩一区二区三区四区五区| 日本国产一区二区| 欧美探花视频资源| 欧美精品一二三| 在线综合视频播放| 欧美xingq一区二区| 久久久久国色av免费看影院| 亚洲国产精品成人综合色在线婷婷| 久久精品一区二区| **欧美大码日韩| 亚洲成人免费视频| 国产综合色在线| 成人h动漫精品一区二区| 91毛片在线观看| 欧美高清你懂得| 精品国产99国产精品| 国产精品久久久久影院色老大 | 亚洲品质自拍视频| 五月天亚洲精品| 久久99国产精品麻豆| 国产精品综合网| 色狠狠桃花综合| 精品毛片乱码1区2区3区| 国产精品乱码人人做人人爱 | 婷婷久久综合九色综合伊人色| 日韩精品欧美精品| 国产成人在线视频免费播放| 91传媒视频在线播放| 91精品国产91综合久久蜜臀| 久久久综合精品| 亚洲二区在线观看| 国产成人一级电影| 欧美精品色一区二区三区| 国产女人水真多18毛片18精品视频| 一级女性全黄久久生活片免费| 久久爱另类一区二区小说| 色婷婷久久久亚洲一区二区三区| 日韩欧美不卡一区| 亚洲精品免费在线播放| 国产一区二区剧情av在线| 91国偷自产一区二区开放时间| 久久综合网色—综合色88| 亚洲一线二线三线视频| 高清不卡一区二区在线| 91精品国产免费| 一区二区三区中文在线| 国产超碰在线一区| 日韩欧美在线123| 亚洲一区二区欧美激情| 国产69精品久久久久毛片| 欧美电影免费观看高清完整版在 | 亚洲一区二区在线免费看| 国产精品一区二区在线播放| 欧美一区二区久久| 亚洲自拍偷拍图区| 91亚洲永久精品| 国产拍欧美日韩视频二区| 久久国产麻豆精品| 欧美日韩不卡一区二区| 亚洲黄色av一区| 99久精品国产| 国产精品网站导航| 国产98色在线|日韩| 精品1区2区在线观看| 青娱乐精品在线视频| 欧美日韩五月天| 亚洲最大的成人av| 91亚洲精品久久久蜜桃| 国产调教视频一区| 国产精品一区三区| 久久亚洲精品国产精品紫薇| 六月丁香综合在线视频| 欧美一区二区三区视频免费播放 | 亚洲一区二区三区精品在线| 91日韩精品一区| 1024国产精品| 91偷拍与自偷拍精品| 亚洲三级免费电影| www.激情成人| 又紧又大又爽精品一区二区| 日本韩国欧美一区| 亚洲成人一区在线| 欧美一区二区三区视频免费 | 欧美日本在线看| 亚洲一卡二卡三卡四卡无卡久久| 色噜噜狠狠一区二区三区果冻| 亚洲一区二区五区| 欧美日韩国产成人在线91| 日韩高清一级片| 精品99一区二区三区| 东方欧美亚洲色图在线| 中文字幕高清一区| 色综合咪咪久久| 性久久久久久久久久久久| 制服丝袜一区二区三区| 久久精品噜噜噜成人av农村| 久久奇米777| 99免费精品在线观看| 亚洲一区在线视频观看| 91精品国产手机| 丰满亚洲少妇av| 亚洲一本大道在线| 欧美一级二级三级乱码| 国产精品一区二区免费不卡| 亚洲欧美日韩精品久久久久| 欧美日韩在线免费视频| 精品一区二区三区香蕉蜜桃| 中文字幕一区三区| 欧美丰满嫩嫩电影|