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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tea.java

?? WebMail is a server application that allows ISPs to provide a WWW interface for each user to his mai
?? JAVA
字號(hào):
/* CVS ID: $Id: TEA.java,v 1.2 2000/04/06 08:02:02 wastl Exp $ */
package net.wastl.webmail.misc;

import java.math.*;

/**
* Tiny Encryption Algorithm.
* <P>
* (The following description is from the web page for the C and Assembler source
* code at <A HREF="http://vader.brad.ac.uk/tea/tea.shtml"> University of Bradford
* Yorkshire, England - The Cryptography & Computer Communications Security
* Group</A>) The description is used with the permission of the authors,
* Dr S J Shepherd and D A G Gillies.
* <P>
* The Tiny Encryption Algorithm is one of the fastest and most efficient
* cryptographic algorithms in existence. It was developed by David
* Wheeler and Roger Needham at the Computer Laboratory of Cambridge
* University. It is a Feistel cipher which uses operations from mixed
* (orthogonal) algebraic groups - XORs and additions in this case. It
* encrypts 64 data bits at a time using a 128-bit key. It seems highly
* resistant to differential cryptanalysis, and achieves complete
* diffusion (where a one bit difference in the plaintext will cause
* approximately 32 bit differences in the ciphertext) after only six
* rounds. Performance on a modern desktop computer or workstation is
* very impressive. 
* <P>
* TEA takes 64 bits of data in v[0] and v[1], and 128 bits of key in
* k[0] - k[3]. The result is returned in w[0] and w[1]. Returning the
* result separately makes implementation of cipher modes other than
* Electronic Code Book a little bit easier.
* <P>
* TEA can be operated in any of the modes of DES.
* <P>
* n is the number of iterations. 32 is ample, 16 is sufficient, as few
* as eight should be OK for most applications, especially ones where
* the data age quickly (real-time video, for example). The algorithm
* achieves good dispersion after six iterations. The iteration count
* can be made variable if required.
* <P>
* Note this algorithm is optimised for 32-bit CPUs with fast shift
* capabilities. It can very easily be ported to assembly language on
* most CPUs.
* <P>
* delta is chosen to be the Golden ratio ((5/4)1/2 - 1/2 ~ 0.618034)
* multiplied by 232. On entry to decipher(), sum is set to be delta *
* n. Which way round you call the functions is arbitrary: DK(EK(P)) =
* EK(DK(P)) where EK and DK are encryption and decryption under key K
* respectively. 
* <P>
* Translator's notes:
* <UL>
* <LI> Although the <I>this algorithm is optimised for
* 32-bit CPUs with fast shift capabilities</I> Java manages to throw
* it all away by not providing unsigned values resulting in the excessive
* use of AND's to prevent sign extension on promotion of a byte 
* to an integer.
* </LI>
* <P>
* <LI>
* The following description is taken from the
* Mach5 Software cryptography archives at
* <A HREF="http://www.mach5.com/crypto/">www.mach5.com/crypto</A>.
* <p><font face="Arial" size="4">Tiny Encryption Algorithm (TEA)</font><br>
* <font size="3" face="Arial">TEA is a cryptographic algorithm designed to minimize memory
* footprint, and maximize speed. However, the cryptographers from <a
*
* href="http://www.counterpane.com">Counterpane Systems</a> have <a
*
* href="http://www.cs.berkeley.edu/~daw/keysched-crypto96.ps">discovered three related-key
* attacks </a>on TEA, the best of which requires only 223 chosen plaintexts and one related
* key query. The problems arise from the overly simple key schedule. Each TEA key can be
* found to have three other equivalent keys, as described in <a
*
* href="http://www.cs.berkeley.edu/~daw/keysched-icics97.ps">a paper</a> by <a
*
* href="http://www.cs.berkeley.edu/~daw/">David Wagner</a>, John Kelsey, and <a
*
* href="http://www.counterpane.com/schneier.html">Bruce Schneier</a>. This precludes the
* possibility of using TEA as a hash function. Roger Needham and David Wheeler have proposed
* <a href="http://www.cl.cam.ac.uk/ftp/users/djw3/xtea.ps">extensions to TEA</a> that
* counters the above attacks.</font></p>
* </LI>
* </UL>
*
* <P> Example of use:
* <PRE>
* byte key[] = new BigInteger("39e858f86df9b909a8c87cb8d9ad599", 16).toByteArray();
* TEA t = new TEA(key);
* <BR>
* String src = "hello world!";
* System.out.println("input = " + src);
* byte plainSource[] = src.getBytes();
* int enc[] = t.encode(plainSource, plainSource.length);
* System.out.println(t.padding() + " bytes added as padding.");
* byte dec[] = t.decode(enc);
* System.out.println("output = " + new String(dec));
* </PRE>
*
* @author Translated by Michael Lecuyer (mjl@theorem.com) from the C Language.
* @version 1.0 Sep 8, 1998
* @since JDK1.1
*/

public class TEA
{
   private int _key[];  // The 128 bit key.
   private byte _keyBytes[];  // original key as found
   private int _padding;      // amount of padding added in byte --> integer conversion.

   /**
   * Encodes and decodes "Hello world!" for your personal pleasure.
   */
   public static void main(String args[])
   {
      // A simple test of TEA.

      byte key[] = new BigInteger("39e858f86df9b909a8c87cb8d9ad599", 16).toByteArray();
      TEA t = new TEA(key);

      String src = "hello world!";
      System.out.println("input = " + src);
      byte plainSource[] = src.getBytes();
      int enc[] = t.encode(plainSource, plainSource.length);
      System.out.println(t.padding() + " bytes added as padding.");
      byte dec[] = t.decode(enc);
      System.out.println("output = " + new String(dec));
   }

   /**
   * Accepts key for enciphering/deciphering.
   *
   * @throws ArrayIndexOutOfBoundsException if the key isn't the correct length.
   *
   * @param key 128 bit (16 byte) key.
   */
   public TEA(byte key[])
   {
      int klen = key.length;
      _key = new int[4];
      
      // Incorrect key length throws exception.
      if (klen != 16)
         throw new ArrayIndexOutOfBoundsException(this.getClass().getName() + ": Key is not 16 bytes");

      int j, i;
      for (i = 0, j = 0; j < klen; j += 4, i++)
         _key[i] = (key[j] << 24 ) | (((key[j+1])&0xff) << 16) | (((key[j+2])&0xff) << 8) | ((key[j+3])&0xff);

      _keyBytes = key;  // save for toString.
   }

   /**
   * Representation of TEA class
   */
   public String toString()
   {
      String tea = this.getClass().getName();
      tea +=  ": Tiny Encryption Algorithm (TEA)  key: " + dumpBytes(_keyBytes);
      return tea;
   }

   /**
   * Encipher two <code>int</code>s.
   * Replaces the original contents of the parameters with the results.
   * The integers are usually created from 8 bytes.
   * The usual way to collect bytes to the int array is:
   * <PRE>
   * byte ba[] = { .... };
   * int v[] = new int[2];
   * v[0] = (ba[j] << 24 ) | (((ba[j+1])&0xff) << 16) | (((ba[j+2])&0xff) << 8) | ((ba[j+3])&0xff);
   * v[1] = (ba[j+4] << 24 ) | (((ba[j+5])&0xff) << 16) | (((ba[j+6])&0xff) << 8) | ((ba[j+7])&0xff);
   * v = encipher(v);
   * </PRE>
   *
   * @param v two <code>int</code> array as input. 
   *
   * @return array of two <code>int</code>s, enciphered.
   */
   public int [] encipher(int v[])
   {
      int y=v[0];
      int z=v[1];
      int sum=0;
      int delta=0x9E3779B9;
      int a=_key[0];
      int b=_key[1];
      int c=_key[2];
      int d=_key[3];
      int n=32;

      while(n-->0)
      {
         sum += delta;
         y += (z << 4)+a ^ z+sum ^ (z >> 5)+b;
         z += (y << 4)+c ^ y+sum ^ (y >> 5)+d;
      }

      v[0] = y;
      v[1] = z;

      return v;
   }

   /**
   * Decipher two <code>int</code>s.
   * Replaces the original contents of the parameters with the results.
   * The integers are usually decocted to 8 bytes.
   * The decoction of the <code>int</code>s to bytes can be done
   * this way.
   * <PRE>
   * int x[] = decipher(ins);
   * outb[j]   = (byte)(x[0] >>> 24);
   * outb[j+1] = (byte)(x[0] >>> 16);
   * outb[j+2] = (byte)(x[0] >>> 8);
   * outb[j+3] = (byte)(x[0]);
   * outb[j+4] = (byte)(x[1] >>> 24);
   * outb[j+5] = (byte)(x[1] >>> 16);
   * outb[j+6] = (byte)(x[1] >>> 8);
   * outb[j+7] = (byte)(x[1]);
   * </PRE>
   *
   * @param v <code>int</code> array of 2
   *
   * @return deciphered <code>int</code> array of 2
   */
   public int [] decipher(int v[])
   {
      int y=v[0];
      int z=v[1];
      int sum=0xC6EF3720;
      int delta=0x9E3779B9;
      int a=_key[0];
      int b=_key[1];
      int c=_key[2];
      int d=_key[3];
      int n=32;

      // sum = delta<<5, in general sum = delta * n 

      while(n-->0)
      {
         z -= (y << 4)+c ^ y+sum ^ (y >> 5) + d;
         y -= (z << 4)+a ^ z+sum ^ (z >> 5) + b;
         sum -= delta;
      }

      v[0] = y;
      v[1] = z;

      return v;
   }

   /**
   * Encipher two <code>bytes</code>s.
   *
   * @param v <code>byte</code> array of 2
   *
   * @return enciphered <code>byte</code> array of 2
   */
   public byte [] encipher(byte v[])
   {
      byte y=v[0];
      byte z=v[1];
      int sum=0;
      int delta=0x9E3779B9;
      int a=_key[0];
      int b=_key[1];
      int c=_key[2];
      int d=_key[3];
      int n=32;

      while(n-->0)
      {
         sum += delta;
         y += (z << 4)+a ^ z+sum ^ (z >> 5)+b;
         z += (y << 4)+c ^ y+sum ^ (y >> 5)+d;
      }

      v[0] = y;
      v[1] = z;

      return v;
   }

   /**
   * Decipher two <code>bytes</code>s.
   *
   * @param v <code>byte</code> array of 2
   *
   * @return decipherd <code>byte</code> array of 2
   */
   public byte [] decipher(byte v[])
   {
      byte y=v[0];
      byte z=v[1];
      int sum=0xC6EF3720;
      int delta=0x9E3779B9;
      int a=_key[0];
      int b=_key[1];
      int c=_key[2];
      int d=_key[3];
      int n=32;

      // sum = delta<<5, in general sum = delta * n 

      while(n-->0)
      {
         z -= (y << 4)+c ^ y+sum ^ (y >> 5)+d;
         y -= (z << 4)+a ^ z+sum ^ (z >> 5)+b;
         sum -= delta;
      }

      v[0] = y;
      v[1] = z;

      return v;
   }

   /**
   * Byte wrapper for encoding.
   * Converts bytes to ints.
   * Padding will be added if required.
   *
   * @param b incoming <code>byte</code> array
   *
   * @param byte count
   *
   * @return integer conversion array, possibly with padding.
   *
   * @see #padding
   */
   int [] encode(byte b[], int count)
   {
      int j ,i;
      int bLen = count;
      byte bp[] = b;

      _padding = bLen % 8;
      if (_padding != 0)   // Add some padding, if necessary.
      {
         _padding = 8 - (bLen % 8);
         bp = new byte[bLen + _padding];
         System.arraycopy(b, 0, bp, 0, bLen);
         bLen = bp.length;
      }

      int intCount = bLen / 4;
      int r[] = new int[2];
      int out[] = new int[intCount];

      for (i = 0, j = 0; j < bLen; j += 8, i += 2)
      {
         // Java's unforgivable lack of unsigneds causes more bit
         // twiddling than this language really needs.
         r[0] = (bp[j] << 24 ) | (((bp[j+1])&0xff) << 16) | (((bp[j+2])&0xff) << 8) | ((bp[j+3])&0xff);
         r[1] = (bp[j+4] << 24 ) | (((bp[j+5])&0xff) << 16) | (((bp[j+6])&0xff) << 8) | ((bp[j+7])&0xff);
         encipher(r);
         out[i] = r[0];
         out[i+1] = r[1];
      }

      return out;
   }

   /**
   * Report how much padding was done in the last encode.
   *
   * @return bytes of padding added
   *
   * @see #encode
   */
   public int padding()
   {
      return _padding;
   }

   /**
   * Convert a byte array to ints and then decode.
   * There may be some padding at the end of the byte array from
   * the previous encode operation.
   *
   * @param b bytes to decode
   * @param count number of bytes in the array to decode
   *
   * @return <code>byte</code> array of decoded bytes.
   */
   public byte [] decode(byte b[], int count)
   {
      int i, j;

      int intCount = count / 4;
      int ini[] = new int[intCount];
      for (i = 0, j = 0; i < intCount; i += 2, j += 8)
      {
         ini[i] = (b[j] << 24 ) | (((b[j+1])&0xff) << 16) | (((b[j+2])&0xff) << 8) | ((b[j+3])&0xff);
         ini[i+1] = (b[j+4] << 24 ) | (((b[j+5])&0xff) << 16) | (((b[j+6])&0xff) << 8) | ((b[j+7])&0xff);
      }
      return decode(ini);
   }

   /**
   * Decode an integer array.
   * There may be some padding at the end of the byte array from
   * the previous encode operation.
   *
   * @param b bytes to decode
   * @param count number of bytes in the array to decode
   *
   * @return <code>byte</code> array of decoded bytes.
   */
   public byte [] decode(int b[])
   {
      // create the large number and start stripping ints out, two at a time.
      int intCount = b.length;

      byte outb[] = new byte[intCount * 4];
      int tmp[] = new int[2];

      // decipher all the ints.
      int i, j;
      for (j = 0, i = 0; i < intCount; i += 2, j += 8)
      {
         tmp[0] = b[i];
         tmp[1] = b[i+1];
         decipher(tmp);
         outb[j]   = (byte)(tmp[0] >>> 24);
         outb[j+1] = (byte)(tmp[0] >>> 16);
         outb[j+2] = (byte)(tmp[0] >>> 8);
         outb[j+3] = (byte)(tmp[0]);
         outb[j+4] = (byte)(tmp[1] >>> 24);
         outb[j+5] = (byte)(tmp[1] >>> 16);
         outb[j+6] = (byte)(tmp[1] >>> 8);
         outb[j+7] = (byte)(tmp[1]);
      }

      return outb;
   }


   // Display some bytes in HEX.
   //
   private String dumpBytes(byte b[])
   {
      StringBuffer r = new StringBuffer();
      final String hex = "0123456789ABCDEF";

      for (int i = 0; i < b.length; i++)
      {
         int c = ((b[i]) >>> 4) & 0xf;
         r.append(hex.charAt(c));
         c = ((int)b[i] & 0xf);
         r.append(hex.charAt(c));
      }

      return r.toString();
   }

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧洲视频一区二区| 99久久精品免费观看| 91久久精品网| 亚瑟在线精品视频| 久久久久久一二三区| 欧美亚洲国产一区二区三区va | 国产乱子伦视频一区二区三区| 欧美激情一区二区三区全黄| 欧美美女bb生活片| 99国内精品久久| 国产精品123| 青青草精品视频| 亚洲成精国产精品女| 成人欧美一区二区三区黑人麻豆| 日韩三区在线观看| 欧美日免费三级在线| 91尤物视频在线观看| 国产91精品一区二区麻豆亚洲| 麻豆精品视频在线观看免费| 亚洲伊人色欲综合网| 樱桃国产成人精品视频| 久久精品国产成人一区二区三区| 中文字幕免费不卡| 国产精品看片你懂得| 中文字幕一区二区三| 亚洲欧美另类久久久精品 | 欧美国产欧美亚州国产日韩mv天天看完整| 欧美一区二区三区在线电影| 欧美视频一区二区三区在线观看| 色天使色偷偷av一区二区| 99久久综合狠狠综合久久| www.久久久久久久久| av不卡免费在线观看| 色综合久久中文字幕综合网| 色香蕉久久蜜桃| 成人a免费在线看| 麻豆精品一区二区三区| 久久精品国产亚洲a| 国产成人免费视| 91亚洲国产成人精品一区二区三 | 蜜臀av一区二区在线观看| 国产在线一区二区综合免费视频| 国产精品456露脸| 91国偷自产一区二区三区观看| 欧美日韩一级二级| 久久久久青草大香线综合精品| 亚洲品质自拍视频| 精品一区二区三区免费视频| 欧美一卡在线观看| 国产精品全国免费观看高清| 亚洲资源中文字幕| 久久99精品国产.久久久久久| 国产精品456露脸| 91麻豆精品国产无毒不卡在线观看| 精品国产区一区| 亚洲制服丝袜av| 国产成人免费视频精品含羞草妖精| 色婷婷综合久久久中文一区二区 | 成人av小说网| 日韩欧美一区电影| 亚洲va国产va欧美va观看| 国产成人免费视频网站高清观看视频| 欧美美女一区二区| 亚洲日本在线天堂| 成a人片国产精品| 久久久久青草大香线综合精品| 性欧美疯狂xxxxbbbb| 欧美综合久久久| 综合网在线视频| 日本成人中文字幕在线视频| 国产一区二区美女| 一个色在线综合| 成人动漫一区二区三区| 国产区在线观看成人精品| 蜜桃av一区二区| 日韩一区二区三| 精品一区二区三区免费视频| 欧美不卡一区二区三区| 欧美aⅴ一区二区三区视频| 91.com在线观看| 奇米精品一区二区三区在线观看一| 在线观看日韩国产| 亚洲成a天堂v人片| 91精品久久久久久久99蜜桃| 天堂午夜影视日韩欧美一区二区| 91精品办公室少妇高潮对白| 亚洲在线观看免费| 精品美女一区二区三区| 国产精品88av| 一二三区精品视频| 日韩欧美视频一区| 成人开心网精品视频| 亚洲精选在线视频| 日韩一区二区中文字幕| 国产成人一区二区精品非洲| 亚洲人成精品久久久久| 欧美一卡在线观看| 成人h精品动漫一区二区三区| 欧美高清在线精品一区| 在线观看91视频| 激情图片小说一区| 亚洲国产成人tv| 国产亚洲一本大道中文在线| 在线亚洲免费视频| 美女视频网站黄色亚洲| 国产精品美女一区二区| 日韩欧美亚洲另类制服综合在线| 成人激情小说乱人伦| 日本成人超碰在线观看| 亚洲视频每日更新| 亚洲国产综合91精品麻豆| 91精品国产色综合久久| 美女网站在线免费欧美精品| 中文字幕日韩一区| 91精品国产入口| 欧美日韩国产综合视频在线观看 | 欧美日韩免费一区二区三区视频| 粉嫩一区二区三区性色av| 极品美女销魂一区二区三区 | 日韩视频免费观看高清在线视频| 97精品久久久久中文字幕| 国产传媒欧美日韩成人| 韩国三级中文字幕hd久久精品| 亚洲h动漫在线| 亚洲伊人色欲综合网| 一区二区国产视频| 亚洲综合在线电影| 亚洲激情一二三区| 五月天网站亚洲| 天天操天天色综合| 免费在线观看日韩欧美| 视频一区二区国产| 蜜芽一区二区三区| 视频一区二区三区入口| 久久精品久久综合| 国产高清不卡一区| 成人免费视频视频在线观看免费 | 在线免费观看日本欧美| 色哟哟一区二区| 欧美人狂配大交3d怪物一区 | 欧美经典一区二区三区| 国产精品第一页第二页第三页| 亚洲色大成网站www久久九九| 一区二区三区四区不卡在线| 午夜成人在线视频| 国产一区二区三区四| 99亚偷拍自图区亚洲| 欧美日韩亚洲高清一区二区| 日韩一区二区在线看| 中文字幕免费不卡| 中文久久乱码一区二区| 国产精品丝袜久久久久久app| 亚洲精品国产无天堂网2021| 亚洲国产一区二区在线播放| 国产精品自拍在线| 欧美日韩国产天堂| 欧美国产日韩亚洲一区| 亚洲一区在线看| 国产成人精品影视| 欧美一区二区三区四区五区| 国产女人水真多18毛片18精品视频| 亚洲一区二区三区免费视频| 国产乱码一区二区三区| 69堂成人精品免费视频| 国产精品久久综合| 国产一区福利在线| 欧美日本韩国一区二区三区视频| 欧美国产欧美亚州国产日韩mv天天看完整 | 成人高清伦理免费影院在线观看| 欧美精品在线视频| 亚洲欧美激情在线| 91污在线观看| 国产精品女同一区二区三区| 韩国av一区二区三区四区| 日韩一区二区免费视频| 亚洲成人激情综合网| 在线观看不卡视频| 亚洲男同性视频| 成人激情免费网站| 国产精品久久久久aaaa樱花 | 国产日产欧美一区二区视频| 男女性色大片免费观看一区二区| 欧美无人高清视频在线观看| 亚洲欧美一区二区久久| 欧美视频第二页| 青青草原综合久久大伊人精品| 欧美日韩成人在线| 久久精品国内一区二区三区| 精品播放一区二区| 国产.精品.日韩.另类.中文.在线.播放| 久久蜜桃av一区精品变态类天堂| 黑人巨大精品欧美黑白配亚洲| 久久久久久久综合日本| av一二三不卡影片| 亚洲成人先锋电影| 色老汉一区二区三区| 一区二区三区四区av| 日韩一区二区三区免费观看| 国产综合色精品一区二区三区| 国产精品乱码人人做人人爱|