RabbitÁ÷ÃÜÂëµÄJavaʵÏÖ
1. RabbitÁ÷ÃÜÂ루Rabbit Stream Cipher£©¼ò½é
RabbitÁ÷ÃÜÂëÊÇÓÉCryptico¹«Ë¾£¨http://www.cryptico.com£©Éè¼ÆµÄ£¬ÃÜÔ¿³¤¶È128룬
×î´ó¼ÓÃÜÏûÏ¢³¤¶ÈΪ264 Bytes£¬¼´16 TB£¬ÈôÏûÏ¢³¬¹ý¸Ã³¤¶È£¬ÔòÐèÒª¸ü»»ÃÜÔ¿¶ÔʣϵÄÏûÏ¢½øÐд¦Àí¡£ËüÊÇĿǰ°²È«ÐԽϸߣ¬¼Ó/½âÃÜËٶȱȽϸßЧµÄÁ÷ÃÜÂëÖ®Ò»£¬ÔÚ¸÷ÖÖ´¦ÀíÆ÷ƽ̨É϶¼Óв»·²µÄ±íÏÖ¡£
Ïêϸ×ÊÁÏ£º
1.http://www.cryptico.com/Files/filer/rabbit_fse.pdf
2.http://www.ietf.org/rfc/rfc4503.txt
±¾ÎÄʵÏÖÁ˸ÃËã·¨µÄjavaÓïÑÔʵÏÖ£¬½ö¹©²Î¿¼¡£
2. ʵÏÖÔ´Âë
/**
* The Java Implementation of Rabbit Stream Cipher
* @author cnbragon
* @email cnbragon_dot_163_dot_com
* @date 2009/09/25
* @note Not implemented IV scheme
* @Reference:
* 1.http://www.cryptico.com/Files/filer/rabbit_fse.pdf
* 2.http://www.ietf.org/rfc/rfc4503.txt
*/
class Rabbit
{
private int[] x = new int[8];
private int[] c = new int[8];
private int carry;
public void Rabbit()
{
for(int i = 0; i < 8; i++)
{
x[i] = c[i] = 0;
}
carry = 0;
}
private int g_func(int x)
{
int a = x & 0xffff;
int b = x >>> 16;
int h =( ( ( ( a * a ) >>> 17 ) + ( a * b ) ) >>> 15 ) + b * b;
int l = x * x;
return h ^ l;
}
/**
* @declaration ±È½ÏÁ½¸öÓзûºÅÕûÊýµÄÊ®Áù½øÖƵĴóС£¬¼´×÷ΪÎÞ·ûºÅÕûÊý½øÐбȽÏ
* @param x
* @param y
* @return Èô(unsigned x) < (unsigned y)£¬Ôò·µ»Ø1£¬·ñÔò·µ»Ø0
*/
private int compare(int x, int y)
{
long a = x;
long b = y;
a &= 0x00000000ffffffffl;
b &= 0x00000000ffffffffl;
return (a < b) ? 1 : 0;
}
private int rotL(int x, int y)
Ïà¹ØÎĵµ£º
JAVAµÄÈÝÆ÷---List,Map,Set
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð© CollectionÔÊÐíÏà ......
ÎÒÏÖÔÚÒѾ´óËÄÁË£¬Ñ§µÄÊÇÈí¼þרҵ£¬ÎÒ±ØÐë³ÐÈÏÎÒÃÇѧУµÄÈí¼þרҵºÜ²»ºÃ£¬ËùÒԴ󲿷ÖÒª¿¿×Ô¼º¡£
ÒÔǰ´ÓÀ´Ã»Ð´¹ý²©¿Í£¬Õâ´ÎÔÚÕâÀ↑²©¾ÍÊÇÏëͨ¹ýcsdn½áʶ¸ü¶àµÄѧϰJAVAµÄÅóÓÑ£¬ÎÒÉîÖª×Ô¼ºµÄJAVA¹¦µ×Éõdz£¬ËùÒÔÖ»ÓÐ×Î×β»¾ëµÄϰ£¬ºÍ²»ÑáÆä·³µÄ·¢ÎʲÅÄÜʹ×Ô¼ºÇ¿´ó¡£
×î½üÎÒÒ²´ÓÍøÉ ......
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import j ......
ÏÖÔںܶàÈ˶¼ÎÊ C++ºÍJava ÄĸöºÃ. Æäʵ¼¼ÊõÉϸ÷Óи÷µÄºÃ´¦Óë²»×ã,ÎÒÏë´ó¼ÒËù˵µÄºÃ²»ºÃÖ¸µÃÊÇǰ;ºÃ²»ºÃ,׬µÄ¶à²»¶à.
Ҫ˵׬Ǯ×î¶àµÄ¿Ï¶¨ÊÇC++ÁË.ÒòΪһÃż¼ÊõÊÇ·ñֵǮȫ¿´»áËüµÄÈËÓжàÉÙ¶ø²»ÔÚÓÚÕâ¸ö¼¼Êõ±¾ÉíµÄºÃ»µ. C++Éæ¼°Ó²¼þµ×²ãµÄ¶«Î÷±È½Ï¶à,ѧÆðÀ´ºÜ¸´ÔÓ,»áµÄÈËÉÙ,ËùÒÔֵǮ.
&nb ......