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

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

?? serpent_algorithm.java

?? Serpent算法及vb實現 畢業設計是做的 希望對大家有幫助
?? JAVA
字號:
// $Id: $//// $Log: $// Revision 1.1.1  1998/04/10  raif// + added code to generate Intermediate Values KAT.// + cosmetics.//// Revision 1.1  1998/04/07  Serpent authors// + revised slightly (endianness, and key schedule for variable lengths)//// Revision 1.0  1998/04/06  raif// + original version.//// $Endlog$/* * Copyright (c) 1997, 1998 Systemics Ltd on behalf of * the Cryptix Development Team. All rights reserved. */package Serpent;import java.io.PrintWriter;import java.security.InvalidKeyException;//.........................................................................../** * Serpent is a 128-bit 32-round block cipher with variable key lengths, * including 128-, 192- and 256-bit * keys conjectured to be at least as secure as three-key triple-DES.<p> * * Serpent was designed by Ross Anderson, Eli Biham and Lars Knudsen as a * candidate algorithm for the NIST AES Quest.<p> * * References:<ol> *  <li>Serpent: A New Block Cipher Proposal. This paper was published in the *  proceedings of the "Fast Software Encryption Workshop No. 5" held in *  Paris in March 1998. LNCS, Springer Verlag.<p> *  <li>Reference implementation of the standard Serpent cipher written in C *  by <a href="http://www.cl.cam.ac.uk/~fms/">Frank Stajano</a>.</ol><p> * * <b>Copyright</b> &copy; 1997, 1998 * <a href="http://www.systemics.com/">Systemics Ltd</a> on behalf of the * <a href="http://www.systemics.com/docs/cryptix/">Cryptix Development Team</a>. * <br>All rights reserved.<p> * * <b>$Revision: $</b> * @author  Raif S. Naffah * @author  Serpent authors (Ross Anderson, Eli Biham and Lars Knudsen) */public final class Serpent_Algorithm // implicit no-argument constructor{// Debugging methods and variables//...........................................................................    static final String NAME = "Serpent_Algorithm";    static final boolean IN = true, OUT = false;    static final boolean DEBUG = Serpent_Properties.GLOBAL_DEBUG;    static final int debuglevel = DEBUG ? Serpent_Properties.getLevel(NAME) : 0;    static final PrintWriter err = DEBUG ? Serpent_Properties.getOutput() : null;    static final boolean TRACE = Serpent_Properties.isTraceable(NAME);    static void debug (String s) { err.println(">>> "+NAME+": "+s); }    static void trace (boolean in, String s) {        if (TRACE) err.println((in?"==> ":"<== ")+NAME+"."+s);    }    static void trace (String s) { if (TRACE) err.println("<=> "+NAME+"."+s); }// Constants and variables//...........................................................................    /**     * This variable acts as a selector to allow the user to choose between     * a bit-slice implementation (Serpent_BitSlice) and a standard one     * (Serpent_Standard). When set to true the bit-slice implementation     * code is used, otherwise it's the standard implementation code.<p>     *     * IMPORTANT: When you change the value of this variable, make sure     * you re-compile all the classes in the Serpent package.     */    static final boolean USE_BIT_SLICE_IMPLEMENTATION = true;    static final int BLOCK_SIZE = 16; // bytes in a Serpent data-block    private static final char[] HEX_DIGITS = {        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'    };// Basic API methods//...........................................................................    /**     * Expand a user-supplied key material into a session key.     *     * @param key  The user-key bytes (multiples of 4) to use.     * @exception  InvalidKeyException  If the key is invalid.     */    public static synchronized Object makeKey (byte[] key)    throws InvalidKeyException {        if (key == null)            throw new InvalidKeyException("Empty key");/*        if (!(key.length == 16 || key.length == 24 || key.length == 32))             throw new InvalidKeyException("Incorrect key length");	// Although it checks for size of 16, 24 or 32, it really	// supports all multiples of 4 up to 32 in the code of makeKey.*/        if ((key.length % 4) != 0 || (key.length / 4) > 8)             throw new InvalidKeyException("Incorrect key length");        return USE_BIT_SLICE_IMPLEMENTATION ?            Serpent_BitSlice.makeKey(key) :            Serpent_Standard.makeKey(key);    }    /**     * Encrypt exactly one block of plaintext.     *     * @param  in         The plaintext.     * @param  inOffset   Index of in from which to start considering data.     * @param  sessionKey The session key to use for encryption.     * @return The ciphertext generated from a plaintext using the session key.     */    public static byte[]    blockEncrypt (byte[] in, int inOffset, Object sessionKey) {        return USE_BIT_SLICE_IMPLEMENTATION ?            Serpent_BitSlice.blockEncrypt(in, inOffset, sessionKey) :            Serpent_Standard.blockEncrypt(in, inOffset, sessionKey);    }    /**     * Decrypt exactly one block of ciphertext.     *     * @param  in         The ciphertext.     * @param  inOffset   Index of in from which to start considering data.     * @param  sessionKey The session key to use for decryption.     * @return The plaintext generated from a ciphertext using the session key.     */    public static byte[]    blockDecrypt (byte[] in, int inOffset, Object sessionKey) {        return USE_BIT_SLICE_IMPLEMENTATION ?            Serpent_BitSlice.blockDecrypt(in, inOffset, sessionKey) :            Serpent_Standard.blockDecrypt(in, inOffset, sessionKey);    }    /** A basic symmetric encryption/decryption test. */     public static boolean self_test() {if (DEBUG) trace(IN, "self_test()");        boolean ok = false;        try {            byte[] kb = new byte[BLOCK_SIZE*2]; // all zeroes// kb=fromString("0000000000000000000000000000000000000000000000000000000000000000");            byte[] pt = fromEvenLengthString("00000003000000020000000100000000");            int i;            Object key = makeKey(kb);            byte[] ct =  blockEncrypt(pt, 0, key);            byte[] cpt = blockDecrypt(ct, 0, key);            ok = areEqual(pt, cpt);            if (!ok) {if (DEBUG && debuglevel > 7) {    debug("  plain: "+toReversedString(pt));    debug(" cipher: "+toReversedString(ct));    debug(" plain2: "+toReversedString(cpt));}                throw new RuntimeException("Symmetric operation failed");            }            ok = self_test(BLOCK_SIZE);        } catch (Exception x) {if (DEBUG && debuglevel > 0) {    debug("Exception encountered during self-test: " + x.getMessage());    x.printStackTrace();}        }if (DEBUG && debuglevel > 0) debug("Self-test OK? " + ok);if (DEBUG) trace(OUT, "self_test()");        return ok;    }// Serpent own methods//...........................................................................        /** @return The length in bytes of the Algorithm input block. */    public static int blockSize() { return BLOCK_SIZE; }    /** A basic symmetric encryption/decryption test for a given key size. */    private static boolean self_test (int keysize) {if (DEBUG) trace(IN, "self_test("+keysize+")");        boolean ok = false;        try {            byte[] kb = new byte[keysize];            byte[] pt = new byte[BLOCK_SIZE];            int i;            for (i = 0; i < keysize; i++)                kb[i] = (byte) i;            for (i = 0; i < BLOCK_SIZE; i++)                pt[i] = (byte) i;if (DEBUG && debuglevel > 6) {System.out.println("==========");System.out.println();System.out.println("KEYSIZE="+(8*keysize));System.out.println("KEY="+toString(kb));System.out.println();}            Object key = makeKey(kb);if (DEBUG && debuglevel > 6) {System.out.println("Intermediate Ciphertext Values (Encryption)");System.out.println();System.out.println("PT="+toString(pt));}            byte[] ct =  blockEncrypt(pt, 0, key);if (DEBUG && debuglevel > 6) {System.out.println("Intermediate Plaintext Values (Decryption)");System.out.println();System.out.println("CT="+toString(ct));}            byte[] cpt = blockDecrypt(ct, 0, key);            ok = areEqual(pt, cpt);            if (!ok)                throw new RuntimeException("Symmetric operation failed");        } catch (Exception x) {if (DEBUG && debuglevel > 0) {    debug("Exception encountered during self-test: " + x.getMessage());    x.printStackTrace();}        }if (DEBUG && debuglevel > 0) debug("Self-test OK? " + ok);if (DEBUG) trace(OUT, "self_test()");        return ok;    }// utility static methods (from cryptix.util.core ArrayUtil and Hex classes)//...........................................................................        /**     * Compares two byte arrays for equality.     *     * @return true if the arrays have identical contents     */    private static boolean areEqual (byte[] a, byte[] b) {        int aLength = a.length;        if (aLength != b.length)            return false;        for (int i = 0; i < aLength; i++)            if (a[i] != b[i])                return false;        return true;    }    /**     * Returns a number from 0 to 15 corresponding to the hex     * digit <i>ch</i>.     */    public static int fromDigit (char ch) {        if (ch >= '0' && ch <= '9')            return ch - '0';        if (ch >= 'A' && ch <= 'F')            return ch - 'A' + 10;        if (ch >= 'a' && ch <= 'f')            return ch - 'a' + 10;        throw new IllegalArgumentException("Invalid hex digit '"+ch+"'");    }    /**     * Returns a string of hexadecimal digits from a byte array. Each     * byte is converted to 2 hex symbols.     */    private static String toString (byte[] ba) {        int length = ba.length;        char[] buf = new char[length * 2];        for (int i = 0, j = 0, k; i < length; ) {            k = ba[i++];            buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];            buf[j++] = HEX_DIGITS[ k        & 0x0F];        }        return new String(buf);    }// other utility static methods//...........................................................................    /**     * Returns an hexadecimal number (respresented as a string of hexadecimal      * digits from a byte array). Each byte is converted to 2 hex symbols.     * The order is however, as of printing a number from a little-endian     * internal representation (i.e., reverse order).     */    public static String toReversedString (byte[] ba) {        int length = ba.length;        char[] buf = new char[length * 2];        for (int i = length-1, j = 0, k; i >=0; ) {            k = ba[i--];            buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];            buf[j++] = HEX_DIGITS[ k        & 0x0F];        }        return new String(buf);    }           /**     * Returns a byte array from an hexadecimal number.     */    public static byte[] fromEvenLengthString (String hex) {        int len = hex.length();        byte[] buf = new byte[((len + 1) / 2)];        int j = 0;        if ((len % 2) == 1) throw new IllegalArgumentException(            "string must have an even number of digits");        while (len > 0) {            buf[j++] = (byte) (fromDigit(hex.charAt(--len)) |                              (fromDigit(hex.charAt(--len)) << 4));        }        return buf;    }// main(): use to generate the Intermediate Values KAT//...........................................................................    public static void main (String[] args) {if (DEBUG && debuglevel > 6) {System.out.println("Algorithm Name: "+Serpent_Properties.FULL_NAME);System.out.println("Electronic Codebook (ECB) Mode");System.out.println();}        self_test(16);        self_test(24);        self_test(32);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美怡红院视频| 色激情天天射综合网| 国产99久久久国产精品潘金| 99精品国产99久久久久久白柏| 欧美亚洲愉拍一区二区| 久久精品国产色蜜蜜麻豆| 亚洲激情图片qvod| 经典三级视频一区| 欧美系列亚洲系列| 久久久久99精品一区| 久久久久久综合| 婷婷丁香激情综合| 日本韩国欧美三级| 亚洲国产精品激情在线观看| 毛片一区二区三区| 91精品久久久久久蜜臀| 亚洲精品一二三| 波多野结衣视频一区| 久久久www免费人成精品| 日韩精彩视频在线观看| 欧美又粗又大又爽| 国产精品不卡视频| 成人精品免费视频| 国产亚洲成av人在线观看导航 | 亚洲精品免费看| 国产激情精品久久久第一区二区 | 99精品偷自拍| 日本网站在线观看一区二区三区| 不卡电影免费在线播放一区| 久久九九久精品国产免费直播| 免费观看91视频大全| 欧美精品在线一区二区三区| 亚洲成人资源网| 欧美视频一区二区三区四区| 一区二区三区国产精品| 欧美在线制服丝袜| 亚洲香肠在线观看| 欧美四级电影在线观看| 图片区小说区区亚洲影院| 欧美日韩精品一区二区三区四区| 亚洲国产日日夜夜| 欧美日韩久久一区二区| 午夜精品久久久久久久| 制服丝袜亚洲播放| 久久国产精品99精品国产| 日韩女优视频免费观看| 国产精品主播直播| 精品成人私密视频| 午夜免费欧美电影| 91精品国产全国免费观看| 五月天一区二区三区| 6080午夜不卡| 国产伦精品一区二区三区免费迷| 久久精品无码一区二区三区| www.欧美日韩| 图片区小说区国产精品视频| 精品国产亚洲在线| 97se亚洲国产综合自在线| 亚洲在线观看免费| 欧美精品一区二区久久婷婷| 成人一级黄色片| 亚洲va国产天堂va久久en| 精品国产a毛片| 91老师国产黑色丝袜在线| 亚洲444eee在线观看| 久久美女艺术照精彩视频福利播放 | 捆绑调教一区二区三区| 欧美揉bbbbb揉bbbbb| 麻豆中文一区二区| 国产精品视频第一区| 欧美无人高清视频在线观看| 美女任你摸久久| 18成人在线观看| 日韩欧美激情四射| 91亚洲国产成人精品一区二区三| 奇米亚洲午夜久久精品| 国产精品久久久久久久午夜片 | 国产综合久久久久久鬼色| 日本一区二区三区久久久久久久久不 | 国产欧美日韩视频在线观看| 欧美在线免费视屏| 国产91精品欧美| 免费在线观看精品| 亚洲免费观看高清| 久久精品一区二区三区四区| 欧美精品一区男女天堂| 国产精品初高中害羞小美女文| 精品视频资源站| 国产一区二区三区日韩| 日日摸夜夜添夜夜添亚洲女人| 欧美激情中文字幕| 欧美草草影院在线视频| 欧美日韩国产片| 91国产福利在线| 成人国产在线观看| 国产自产2019最新不卡| 蜜桃av一区二区在线观看| 亚洲激情六月丁香| 国产精品电影一区二区三区| 精品国产一区二区亚洲人成毛片 | 国产偷国产偷亚洲高清人白洁| 欧洲另类一二三四区| 不卡一区二区在线| 国产精品一二二区| 国内精品视频一区二区三区八戒 | 中文字幕在线观看不卡| 日韩视频中午一区| 欧美性生活久久| 91无套直看片红桃| 成人小视频免费在线观看| 黄色日韩网站视频| 九九**精品视频免费播放| 免费欧美高清视频| 日本在线观看不卡视频| 日韩激情一二三区| 日本亚洲欧美天堂免费| 午夜精品久久久久久| 亚洲高清免费在线| 亚洲小说欧美激情另类| 亚洲第一在线综合网站| 亚洲va在线va天堂| 日韩不卡一区二区三区| 美女任你摸久久| 免费在线观看一区| 久久精品国产99国产精品| 精品一区二区免费在线观看| 九九在线精品视频| 国产精选一区二区三区| 大白屁股一区二区视频| 成人app网站| 欧美在线观看一二区| 欧美日韩电影在线| 日韩精品一区二区在线观看| 久久品道一品道久久精品| 国产婷婷色一区二区三区在线| 国产精品视频线看| 亚洲专区一二三| 蜜桃视频一区二区| 国产成人久久精品77777最新版本| 成人美女视频在线观看18| 色成人在线视频| 91精品国产综合久久精品麻豆 | 一本一道久久a久久精品综合蜜臀| av综合在线播放| 欧美视频在线观看一区| 精品理论电影在线| 日韩美女久久久| 蜜臀91精品一区二区三区| 国产99久久久国产精品潘金网站| 色婷婷精品大在线视频| 日韩欧美123| 亚洲天堂福利av| 蜜桃av噜噜一区| 99re在线视频这里只有精品| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 欧美一级黄色片| 中文字幕亚洲一区二区va在线| 日韩有码一区二区三区| 成人免费的视频| 日韩欧美国产三级| 一区二区三区四区在线| 激情久久五月天| 蜜乳av一区二区| 久久精品国产久精国产爱| 国产一区二区三区在线观看精品| 91丝袜国产在线播放| 日韩欧美一区二区在线视频| 亚洲欧洲日本在线| 久久er99热精品一区二区| 色综合色狠狠综合色| 久久久久久久久岛国免费| 午夜精品一区二区三区三上悠亚| 成人精品免费网站| 日韩欧美国产一区二区在线播放| 亚洲人妖av一区二区| 国产精品99久久久久久有的能看| 欧美日韩国产综合久久| 日韩一区中文字幕| 国产另类ts人妖一区二区| 欧美一区二区三区影视| 亚洲在线视频网站| 91视频.com| 亚洲国产精品成人综合色在线婷婷| 日本一区中文字幕| 欧美日韩一卡二卡三卡 | 国产精品久久久久影院亚瑟 | 日韩精品资源二区在线| 亚洲成a人片在线不卡一二三区| 99国产精品国产精品久久| 欧美韩国日本不卡| 国产九色sp调教91| 国产亚洲制服色| 伊人一区二区三区| 本田岬高潮一区二区三区| 久久精品在线观看| 精品亚洲免费视频| 久久精品免费在线观看| 国产精品一卡二卡在线观看| 久久精品免费在线观看| 国产91在线|亚洲|