⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 des.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
/* DES.java --    Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.This file is a part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or (atyour option) any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301USALinking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version.  */package gnu.javax.crypto.cipher;import gnu.java.security.Registry;import gnu.java.security.Properties;import gnu.java.security.util.Util;import java.security.InvalidKeyException;import java.util.Arrays;import java.util.Collections;import java.util.Iterator;/** * <p>The Data Encryption Standard. DES is a 64-bit block cipher with a 56-bit * key, developed by IBM in the 1970's for the standardization process begun by * the National Bureau of Standards (now NIST).</p> * * <p>New applications should not use DES except for compatibility.</p> * * <p>This version is based upon the description and sample implementation in * [1].</p> * * <p>References:</p> * <ol> *    <li>Bruce Schneier, <i>Applied Cryptography: Protocols, Algorithms, and *    Source Code in C, Second Edition</i>. (1996 John Wiley and Sons) ISBN *    0-471-11709-9. Pages 265--301, 623--632.</li> * </ol> */public class DES extends BaseCipher{  // Constants and variables  // -------------------------------------------------------------------------  /** DES operates on 64 bit blocks. */  public static final int BLOCK_SIZE = 8;  /** DES uses 56 bits of a 64 bit parity-adjusted key. */  public static final int KEY_SIZE = 8;  // S-Boxes 1 through 8.  private static final int[] SP1 = new int[] { 0x01010400, 0x00000000,                                              0x00010000, 0x01010404,                                              0x01010004, 0x00010404,                                              0x00000004, 0x00010000,                                              0x00000400, 0x01010400,                                              0x01010404, 0x00000400,                                              0x01000404, 0x01010004,                                              0x01000000, 0x00000004,                                              0x00000404, 0x01000400,                                              0x01000400, 0x00010400,                                              0x00010400, 0x01010000,                                              0x01010000, 0x01000404,                                              0x00010004, 0x01000004,                                              0x01000004, 0x00010004,                                              0x00000000, 0x00000404,                                              0x00010404, 0x01000000,                                              0x00010000, 0x01010404,                                              0x00000004, 0x01010000,                                              0x01010400, 0x01000000,                                              0x01000000, 0x00000400,                                              0x01010004, 0x00010000,                                              0x00010400, 0x01000004,                                              0x00000400, 0x00000004,                                              0x01000404, 0x00010404,                                              0x01010404, 0x00010004,                                              0x01010000, 0x01000404,                                              0x01000004, 0x00000404,                                              0x00010404, 0x01010400,                                              0x00000404, 0x01000400,                                              0x01000400, 0x00000000,                                              0x00010004, 0x00010400,                                              0x00000000, 0x01010004 };  private static final int[] SP2 = new int[] { 0x80108020, 0x80008000,                                              0x00008000, 0x00108020,                                              0x00100000, 0x00000020,                                              0x80100020, 0x80008020,                                              0x80000020, 0x80108020,                                              0x80108000, 0x80000000,                                              0x80008000, 0x00100000,                                              0x00000020, 0x80100020,                                              0x00108000, 0x00100020,                                              0x80008020, 0x00000000,                                              0x80000000, 0x00008000,                                              0x00108020, 0x80100000,                                              0x00100020, 0x80000020,                                              0x00000000, 0x00108000,                                              0x00008020, 0x80108000,                                              0x80100000, 0x00008020,                                              0x00000000, 0x00108020,                                              0x80100020, 0x00100000,                                              0x80008020, 0x80100000,                                              0x80108000, 0x00008000,                                              0x80100000, 0x80008000,                                              0x00000020, 0x80108020,                                              0x00108020, 0x00000020,                                              0x00008000, 0x80000000,                                              0x00008020, 0x80108000,                                              0x00100000, 0x80000020,                                              0x00100020, 0x80008020,                                              0x80000020, 0x00100020,                                              0x00108000, 0x00000000,                                              0x80008000, 0x00008020,                                              0x80000000, 0x80100020,                                              0x80108020, 0x00108000 };  private static final int[] SP3 = new int[] { 0x00000208, 0x08020200,                                              0x00000000, 0x08020008,                                              0x08000200, 0x00000000,                                              0x00020208, 0x08000200,                                              0x00020008, 0x08000008,                                              0x08000008, 0x00020000,                                              0x08020208, 0x00020008,                                              0x08020000, 0x00000208,                                              0x08000000, 0x00000008,                                              0x08020200, 0x00000200,                                              0x00020200, 0x08020000,                                              0x08020008, 0x00020208,                                              0x08000208, 0x00020200,                                              0x00020000, 0x08000208,                                              0x00000008, 0x08020208,                                              0x00000200, 0x08000000,                                              0x08020200, 0x08000000,                                              0x00020008, 0x00000208,                                              0x00020000, 0x08020200,                                              0x08000200, 0x00000000,                                              0x00000200, 0x00020008,                                              0x08020208, 0x08000200,                                              0x08000008, 0x00000200,                                              0x00000000, 0x08020008,                                              0x08000208, 0x00020000,                                              0x08000000, 0x08020208,                                              0x00000008, 0x00020208,                                              0x00020200, 0x08000008,                                              0x08020000, 0x08000208,                                              0x00000208, 0x08020000,                                              0x00020208, 0x00000008,                                              0x08020008, 0x00020200 };  private static final int[] SP4 = new int[] { 0x00802001, 0x00002081,                                              0x00002081, 0x00000080,                                              0x00802080, 0x00800081,                                              0x00800001, 0x00002001,                                              0x00000000, 0x00802000,                                              0x00802000, 0x00802081,                                              0x00000081, 0x00000000,                                              0x00800080, 0x00800001,                                              0x00000001, 0x00002000,                                              0x00800000, 0x00802001,                                              0x00000080, 0x00800000,                                              0x00002001, 0x00002080,                                              0x00800081, 0x00000001,                                              0x00002080, 0x00800080,                                              0x00002000, 0x00802080,                                              0x00802081, 0x00000081,                                              0x00800080, 0x00800001,                                              0x00802000, 0x00802081,                                              0x00000081, 0x00000000,                                              0x00000000, 0x00802000,                                              0x00002080, 0x00800080,                                              0x00800081, 0x00000001,                                              0x00802001, 0x00002081,                                              0x00002081, 0x00000080,                                              0x00802081, 0x00000081,                                              0x00000001, 0x00002000,                                              0x00800001, 0x00002001,                                              0x00802080, 0x00800081,                                              0x00002001, 0x00002080,                                              0x00800000, 0x00802001,                                              0x00000080, 0x00800000,                                              0x00002000, 0x00802080 };  private static final int[] SP5 = new int[] { 0x00000100, 0x02080100,                                              0x02080000, 0x42000100,                                              0x00080000, 0x00000100,                                              0x40000000, 0x02080000,                                              0x40080100, 0x00080000,                                              0x02000100, 0x40080100,                                              0x42000100, 0x42080000,                                              0x00080100, 0x40000000,                                              0x02000000, 0x40080000,                                              0x40080000, 0x00000000,                                              0x40000100, 0x42080100,                                              0x42080100, 0x02000100,                                              0x42080000, 0x40000100,                                              0x00000000, 0x42000000,                                              0x02080100, 0x02000000,                                              0x42000000, 0x00080100,                                              0x00080000, 0x42000100,                                              0x00000100, 0x02000000,                                              0x40000000, 0x02080000,                                              0x42000100, 0x40080100,                                              0x02000100, 0x40000000,                                              0x42080000, 0x02080100,                                              0x40080100, 0x00000100,                                              0x02000000, 0x42080000,                                              0x42080100, 0x00080100,                                              0x42000000, 0x42080100,                                              0x02080000, 0x00000000,                                              0x40080000, 0x42000000,                                              0x00080100, 0x02000100,                                              0x40000100, 0x00080000,                                              0x00000000, 0x40080000,                                              0x02080100, 0x40000100 };  private static final int[] SP6 = new int[] { 0x20000010, 0x20400000,                                              0x00004000, 0x20404010,                                              0x20400000, 0x00000010,                                              0x20404010, 0x00400000,                                              0x20004000, 0x00404010,                                              0x00400000, 0x20000010,                                              0x00400010, 0x20004000,                                              0x20000000, 0x00004010,                                              0x00000000, 0x00400010,                                              0x20004010, 0x00004000,                                              0x00404000, 0x20004010,                                              0x00000010, 0x20400010,                                              0x20400010, 0x00000000,                                              0x00404010, 0x20404000,                                              0x00004010, 0x00404000,                                              0x20404000, 0x20000000,                                              0x20004000, 0x00000010,                                              0x20400010, 0x00404000,                                              0x20404010, 0x00400000,                                              0x00004010, 0x20000010,                                              0x00400000, 0x20004000,                                              0x20000000, 0x00004010,                                              0x20000010, 0x20404010,                                              0x00404000, 0x20400000,                                              0x00404010, 0x20404000,                                              0x00000000, 0x20400010,                                              0x00000010, 0x00004000,                                              0x20400000, 0x00404010,                                              0x00004000, 0x00400010,                                              0x20004010, 0x00000000,                                              0x20404000, 0x20000000,                                              0x00400010, 0x20004010 };  private static final int[] SP7 = new int[] { 0x00200000, 0x04200002,                                              0x04000802, 0x00000000,                                              0x00000800, 0x04000802,                                              0x00200802, 0x04200800,                                              0x04200802, 0x00200000,                                              0x00000000, 0x04000002,                                              0x00000002, 0x04000000,                                              0x04200002, 0x00000802,                                              0x04000800, 0x00200802,                                              0x00200002, 0x04000800,                                              0x04000002, 0x04200000,                                              0x04200800, 0x00200002,                                              0x04200000, 0x00000800,                                              0x00000802, 0x04200802,                                              0x00200800, 0x00000002,                                              0x04000000, 0x00200800,                                              0x04000000, 0x00200800,                                              0x00200000, 0x04000802,                                              0x04000802, 0x04200002,                                              0x04200002, 0x00000002,                                              0x00200002, 0x04000000,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -