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

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

?? teave式加密.java

?? 使用一次文本加密方法做到數字化文本文件加密
?? JAVA
字號:
import java.math.*; /** * Tiny Encryption Algorithm. * 
* (The following description is from the web page for the C and Assembler source * code at University of Bradford * Yorkshire, England - The Cryptography & Computer Communications Security * Group) The description is used with the permission of the authors, * Dr S J Shepherd and D A G Gillies. * 

* 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. * 

* 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. * 

* TEA can be operated in any of the modes of DES. * 

* 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. * 

* 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. * 

* 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. * 

* Translator's notes: * 

* 
Although the this algorithm is optimised for * 32-bit CPUs with fast shift capabilities 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. * * 
* 

* The following description is taken from the * Mach5 Software cryptography archives at * www.mach5.com/crypto. * 
Tiny Encryption Algorithm (TEA)
* TEA is a cryptographic algorithm designed to minimize memory * footprint, and maximize speed. However, the cryptographers from Counterpane Systems have discovered three related-key * attacks 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 paper by David Wagner, John Kelsey, and Bruce Schneier. This precludes the * possibility of using TEA as a hash function. Roger Needham and David Wheeler have proposed * extensions to TEA that * counters the above attacks.

* * 
* * 
Example of use: * 

* 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));
* 
* * @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 TEAint. byte key[] = new BigInteger("39e858f86df9b909a8c87cb8d9ad599", 16).toByteArray(); TEAint t = new TEAint(key); String src = "hello world!"; System.out.println("input = [" + src + "]"); // Pad the plaintext with spaces. src = t.padPlaintext(src); byte plainSource[] = src.getBytes(); int enc[] = t.encode(plainSource, plainSource.length); for (int j = 0; j < enc.length; j++) System.out.println(j + " " + Integer.toHexString(enc[j])); // Report on padding, it should be zero since we originally padded the string with spaces. System.out.println(t.padding() + " bytes added as padding."); // Display what the encoding would be in a hex string. String hexStr = t.binToHex(enc); System.out.println("Encoding as Hex string: " + hexStr); 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: " + klen); 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. } public TEA(int key[]) { _key = key; } /** * Representation of TEA class */ public String toString() { String tea = this.getClass().getName(); tea += ": Tiny Encryption Algorithm (TEA) key: " + getHex(_keyBytes); return tea; } /** * Encipher two ints. * 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: * 
	* 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);
	* 
* * @param v two int array as input. * * @return array of two ints, 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 ints. * Replaces the original contents of the parameters with the results. * The integers are usually decocted to 8 bytes. * The decoction of the ints to bytes can be done * this way. * 
	* 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]);
	* 
* * @param v int array of 2 * * @return deciphered int 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; } /** * Byte wrapper for encoding. * Converts bytes to ints. * Padding will be added if required. * * @param b incoming byte 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 */ 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 byte 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 byte 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; } /** * Convert an array of ints into a hex string. * * @param enc Array of integers. * @return String hexadecimal representation of the integer array. * @throws ArrayIndexOutOfBoundsException if the array doesn't contain pairs of integers. */ public String binToHex(int enc[]) throws ArrayIndexOutOfBoundsException { // The number of ints should always be a multiple of two as required by TEA (64 bits). if ((enc.length % 2) == 1) throw new ArrayIndexOutOfBoundsException("Odd number of ints found: " + enc.length); StringBuffer sb = new StringBuffer(); byte outb[] = new byte[8]; int tmp[] = new int[2]; int counter = enc.length / 2; for (int i = 0; i < enc.length; i += 2) { outb[0] = (byte)(enc[i] >>> 24); outb[1] = (byte)(enc[i] >>> 16); outb[2] = (byte)(enc[i] >>> 8); outb[3] = (byte)(enc[i]); outb[4] = (byte)(enc[i+1] >>> 24); outb[5] = (byte)(enc[i+1] >>> 16); outb[6] = (byte)(enc[i+1] >>> 8); outb[7] = (byte)(enc[i+1]); sb.append(getHex(outb)); } return sb.toString(); } /** * Display bytes in HEX. * @param b bytes to display. * @return string representation of the bytes. */ public String getHex(byte b[]) { StringBuffer r = new StringBuffer(); final char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };; for (int i = 0; i < b.length; i++) { int c = ((b[i]) >>> 4) & 0xf; r.append(hex[c]); c = ((int)b[i] & 0xf); r.append(hex[c]); } return r.toString(); } /** * Pad a string out to the proper length with the given character. * * @param str Plain text string. * @param pc Padding character. */ public String padPlaintext(String str, char pc) { StringBuffer sb = new StringBuffer(str); int padding = sb.length() % 9; for (int i = 0; i < padding; i++) sb.append(pc); return sb.toString(); } /** * Pad a string out to the proper length with spaces. * * @param str Plain text string. */ public String padPlaintext(String str) { return padPlaintext(str, ' '); } } 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亚洲欧美色| 久久久99精品免费观看| 成人黄色小视频在线观看| 日韩av中文在线观看| 日韩在线观看一区二区| 日韩精品福利网| 青青青伊人色综合久久| 免费成人小视频| 精一区二区三区| 国产一区视频网站| 国产成人免费高清| 成人午夜伦理影院| 日本国产一区二区| 欧美高清你懂得| 精品久久久久久久久久久院品网| 精品噜噜噜噜久久久久久久久试看 | 亚洲欧美视频一区| 亚洲免费大片在线观看| 香蕉av福利精品导航| 奇米影视一区二区三区| 国产成人在线视频播放| 一本色道久久加勒比精品| 欧美日韩国产一级二级| 日韩久久久久久| 国产色产综合产在线视频| 亚洲视频一区二区免费在线观看| 亚洲另类在线制服丝袜| 奇米影视7777精品一区二区| 国产成人在线视频播放| 91精品福利视频| 欧美va在线播放| 日韩一区在线播放| 日韩电影在线看| 成人精品高清在线| 欧美一区二区人人喊爽| 国产精品免费av| 欧美aⅴ一区二区三区视频| 丁香亚洲综合激情啪啪综合| 欧美怡红院视频| 久久久精品国产99久久精品芒果 | 欧美videossexotv100| 18欧美乱大交hd1984| 麻豆精品视频在线观看视频| 不卡视频一二三四| 欧美一级午夜免费电影| 亚洲视频1区2区| 韩国av一区二区| 欧美精品亚洲一区二区在线播放| 国产精品第四页| 精品一区二区日韩| 欧美午夜精品久久久| 国产精品久久久久影院| 久久99精品国产麻豆婷婷| 欧美在线三级电影| 国产精品久久久久久久久果冻传媒| 日本美女视频一区二区| 91福利视频网站| |精品福利一区二区三区| 国产一区二区三区不卡在线观看| 欧美网站大全在线观看| 亚洲精品你懂的| 99国产一区二区三精品乱码| 久久精品一区蜜桃臀影院| 强制捆绑调教一区二区| 在线亚洲高清视频| 亚洲欧美综合网| 懂色av一区二区三区蜜臀| 精品国产乱码久久久久久闺蜜| 亚洲国产wwwccc36天堂| 欧美性感一区二区三区| 亚洲精品精品亚洲| 色婷婷精品大在线视频| 亚洲码国产岛国毛片在线| 粗大黑人巨茎大战欧美成人| 久久久久97国产精华液好用吗| 久久国产综合精品| 精品国产一区二区国模嫣然| 免费成人在线观看| 欧美成人猛片aaaaaaa| 加勒比av一区二区| 久久免费国产精品| 国产成人一区二区精品非洲| 久久久久国产成人精品亚洲午夜 | 亚洲欧美另类小说| 91麻豆国产精品久久| 一区二区三区中文免费| 欧美三级电影一区| 男男gaygay亚洲| 亚洲精品在线一区二区| 国产精品自拍av| 日韩一区在线播放| 欧美色欧美亚洲另类二区| 五月天久久比比资源色| 日韩一区二区三区四区| 日本成人在线视频网站| 精品少妇一区二区三区免费观看 | 美日韩一区二区三区| 久久午夜老司机| 成人av网址在线观看| 亚洲一卡二卡三卡四卡无卡久久| 91精品国产综合久久久蜜臀图片| 久久精品二区亚洲w码| 国产精品国产自产拍在线| 在线亚洲一区观看| 六月丁香综合在线视频| 国产精品免费丝袜| 欧美午夜精品免费| 国产精品一区二区你懂的| 亚洲一二三区不卡| 国产日产欧美一区| 在线影院国内精品| 国产91精品一区二区麻豆网站| 亚洲人精品一区| 91精品国产综合久久久久久久久久| 国产成人精品在线看| 亚洲一区二三区| 国产欧美日本一区二区三区| 欧美三区在线视频| 成人动漫一区二区在线| 日本中文字幕一区二区有限公司| 日韩一区欧美小说| 26uuu精品一区二区三区四区在线| 95精品视频在线| 国产一区二区三区av电影 | 日韩欧美www| 色综合色综合色综合色综合色综合| 秋霞成人午夜伦在线观看| 亚洲乱码国产乱码精品精的特点 | 国产精品美女久久久久久久久久久| 欧美日韩激情一区二区三区| 99麻豆久久久国产精品免费 | 日韩va亚洲va欧美va久久| 亚洲图片你懂的| 国产日韩精品一区二区浪潮av| 欧美一级艳片视频免费观看| 欧美性色欧美a在线播放| 成人激情免费电影网址| 国产乱码精品一区二区三| 日本中文一区二区三区| 午夜不卡在线视频| 一区二区三区日韩欧美| 国产精品色一区二区三区| 久久午夜羞羞影院免费观看| 日韩精品一区国产麻豆| 欧美绝品在线观看成人午夜影视| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国产成人高清在线| 国产另类ts人妖一区二区| 激情综合色播五月| 激情综合色播激情啊| 国产精品自拍毛片| 国产酒店精品激情| 国产成人在线视频网址| 国产成人av一区二区| 床上的激情91.| 99麻豆久久久国产精品免费 | 午夜精品久久久久久久蜜桃app| 亚洲激情在线激情| 亚洲一区二区三区视频在线| 亚洲成人免费av| 日韩av一区二区三区| 捆绑变态av一区二区三区| 国产一区二区三区黄视频| 懂色av一区二区在线播放| 成人av电影免费观看| 91福利在线播放| 欧美一区二区三区系列电影| 欧美精品一区二区在线观看| 久久视频一区二区| 国产精品视频一二三区| 亚洲美女偷拍久久| 日韩av高清在线观看| 国产一区二区美女| 色先锋aa成人| 欧美乱妇15p| 日本一区二区综合亚洲| 亚洲色图视频网站| 亚洲6080在线| 国内精品视频一区二区三区八戒| 高清不卡在线观看av| 在线精品视频免费观看| 日韩精品一区在线| 国产精品的网站| 日韩精品91亚洲二区在线观看| 国模一区二区三区白浆| 色综合久久久久久久| 欧美一级片免费看| 中文字幕中文字幕一区| 日韩国产欧美在线观看| 懂色av一区二区三区蜜臀 | 麻豆精品一区二区三区| 成人激情免费视频| 日韩视频免费直播| 一区二区在线观看不卡| 国产一区二区三区观看| 欧美日韩一区二区三区不卡| 久久精品亚洲精品国产欧美kt∨| 亚洲一区二区偷拍精品| 丁香激情综合国产| 日韩精品中文字幕一区二区三区|