Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

32λ²»¿ÉÄæ¼ÓÃÜËã·¨JavaʵÏÖ

¼ÓÃܺóÊÇÒ»¸ö32λ´óд×Öĸ×éºÏÐÎʽ£¬²¢ÇÒ±¾¼ÓÃÜ·½·¨²»¿ÉÄ棡
public String kljm(String dm,String kl)
{
String mw, cmm;
int k, i, tmp, a, hf, lf, bytes = 16;
int mm[], l,rand_seed;
rand_seed = 12345;
int len=kl.length();
if(len>=12) len=12;
mw =kl.substring(0,len) + dm.trim();
l = mw.length();
if (bytes > 100) bytes = 100;
if (l < bytes)
{
for (l = l;l<=bytes;l++)
{
rand_seed = (31527 * rand_seed + 3) % 32768;
a = rand_seed % 256;
if (a < 32 || a > 127) a = (int)(´a´);
mw = mw + (char)(a);
}
}
mm=new int[100];
for (l = 0;l<100;l++)
mm[l]=0;
for (l = 0;l<bytes;l++)
{
a = (int)mw.charAt(l);
for (i = 1;i<= 8;i++)
{
if (a >= 128)
{
a -= 128;
for (k = 0;k<bytes;k++)
{
rand_seed = (31527 * rand_seed + 3) % 32768;
mm[k] += rand_seed % 256;
}
}
else
{
for (k = 1;k<=bytes;k++)
rand_seed = (31527 * rand_seed + 3) % 32768;
}
a *= 2;
}
}
for (k = bytes-1;k>=0;k--)
{
if (k >= 1) mm[k - 1] += mm[k] / 256;
mm[k] = mm[k] % 256;
}
cmm = "";
for (k = 0;k<bytes;k++)
{
hf = mm[k] / 16;
if (hf < 10)
{
cmm = cmm + (char)(hf + (short)(´0´));
}
else
{
cmm = cmm + (char)(hf + (short)(´A´) - 10);
}
lf = mm[k] % 16;
if (lf < 10)
{
cmm = cmm + (char)(lf + (short)(´0´));
}
else
{
cmm = cmm + (char)(lf + (short)(´A´) - 10);
}
}
return cmm;
}


Ïà¹ØÎĵµ£º

ÈÏʶJavaÐéÄâ»úµÄÄÚ²¿Ìåϵ½á¹¹

JavaÐéÄâ»úµÄÄÚ²¿Ìåϵ½á¹¹Ò²ÐíºÜÉÙÓÐÈËÈ¥¹ØÐÄ£¬ÒòΪ¶ÔÓÚJava³ÌÐòÔ±À´Ëµ£¬Ò»°ãÖ»ÐèÒª¸úAPI´ò½»µÀ¾Í¿ÉÒÔÁË¡£ÕâЩÌåϵ½á¹¹Ö»ÊÇJavaÐéÄâ»úÄÚ²¿µÄ½á¹¹¶øÒÑ¡£µ«ÊÇÈç¹ûÀí½âÁËÆäÄÚ²¿½á¹¹£¬¶ÔÓÚÎÒÃÇ¿ª·¢ÏîÄ¿£¬ÒÔ¼°ÅųýϵͳÖеÄÏà¹Ø¹ÊÕÏÊÇÓÉ°ïÖúµÄ¡£
ÏÈ¿´¿´×ÜÌå½á¹¹Í¼£¬ÈçÏ£º
¸÷²¿·ÖµÄÖ÷Òª¹¦ÄÜ·Ö±ðÊÇ£º
1. Àà×°ÔØ×Óϵͳ:¸ºÔðJavaÀ ......

Effective Java ѧϰ±Ê¼Ç£¨3£©

ÔÚʵÏÖsingletonģʽʱ£¬ÎÒÃÇÓÐÒÔϼ¸ÖÖ·½·¨¡£ 1. public static final ×ֶμÓÉÏprivate µÄ¹¹Ô캯Êý¡£ public class Singleton{
            public static final Singleton INSTANCE = new Singleton();
       &# ......

ÉîÈëÀí½âjava¶à̬ÐÔ

Ìù×ÓÖв¿·ÖÔ´´úÂëÕª×ÔcsdnµÄһƪÌû×Ó£¬ ²Î¿¼ÁËËûÃǵÄÀí½â£¬ËµËµ×Ô¼ºµÄһЩ¼û½â£º
//Ô´´úÂ룺
class A {
         public String show(D obj){
                return ("A and D");
  ......

SHA 1ÕªÒªËã·¨Ô´Âë(java°æ)

public class SHA1 {
    private final int[] abcde = {
            0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0
        };
    // ÕªÒªÊý¾Ý´æ´¢Êý×é
  &nb ......

DES¼ÓÃÜËã·¨Ô´Âë(java°æ)

public class DES {
    // ÉùÃ÷³£Á¿×Ö½ÚÊý×é
    private static final int[] IP = {
            58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54,
         ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ