🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #11759

���ְ�æ�����ã���

#11759
From: �����
Date: Mon, 23 Aug 2004 03:35
93 lines
4336 bytes
����java���������δ���ת��Ϊphp���룬˭���԰���һ�°���лл����
public class Crypt
{
       byte[] _key;
       
       public void setKey(byte[] key)
       {
              _key = new byte[key.length];
              System.arraycopy(key,0, _key,0,key.length);
       }

       public long decrypt(byte[] raw)
       {
              if (_key==null)
              {
                     return 0;
              }
              
              int temp = 0;
              int j = 0;
              for (int i=0; i<raw.length; i++)
              {
                     int temp2 = raw<i> &0xff;
                     raw<i> = (byte)(temp2 ^ (_key[j++] &0xff) ^ temp);
                     temp = temp2;
                     if (j > 7)
                     {
                            j=0;
                     }
              }
              
              long old = _key[0] &0xff;
              old |= _key[1] << 8 &0xff00;
              old |= _key[2] << 0x10 &0xff0000;
              old |= _key[3] << 0x18 &0xff000000;
              
              old += raw.length;
              
              _key[0] = (byte)(old &0xff);
              _key[1] = (byte)(old >> 0x08 &0xff);
              _key[2] = (byte)(old >> 0x10 &0xff);
              _key[3] = (byte)(old >> 0x18 &0xff);
              
              return old;
       }
       
       public long encrypt(byte[] raw)
       {
              if (_key==null)
              {
                     return 0;
              }
              
              int temp = 0;
              int j = 0;
              for (int i=0; i<raw.length; i++)
              {
                     int temp2 = raw<i> &0xff;
                     raw<i> = (byte)(temp2 ^ (_key[j++] &0xff) ^ temp);
                     temp = raw<i>;
                     if (j > 7)
                     {
                            j=0;
                     }
              }
              
              long old = _key[0] &0xff;
              old |= _key[1] << 8 &0xff00;
              old |= _key[2] << 0x10 &0xff0000;
              old |= _key[3] << 0x18 &0xff000000;
              
              old += raw.length;
              
              _key[0] = (byte)(old &0xff);
              _key[1] = (byte)(old >> 0x08 &0xff);
              _key[2] = (byte)(old >> 0x10 &0xff);
              _key[3] = (byte)(old >> 0x18 &0xff);
              
              return old;
       }
}


ϣ�����ת��һ�£���л����

--
��������������������������������������������������������������
��       ��(��/��)���ֻ������������̵꡻�ɣ����������㣡  ��
��    ���� ������ http://ebshop.vip.cn          ����    ��
��  ���������š�  http://yfdoor.vip.cn             ���   ��
����    �� F T P��  ftp://yfdoor.jingye.net     ����      ��
��������������������������������������������������������������
�� ��Դ:�������ʵBBS http://bbs.tju.edu.cn [FROM: 202.113.13.188]
Technical Details
Message-ID: <4DjD5R$9iT@bbs.tju.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.gamma.ru!Gamma.RU!newsfeed.simtel.ru!Simtel.RU!news.bylinux.net!netnews.sdu.edu.cn!news2.happynet.org!TJUBBS

Show Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,2252056254ce0c78,start
X-Google-Attributes: gidf6cb0,public
X-Google-Language: ENGLISH,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.gamma.ru!Gamma.RU!newsfeed.simtel.ru!Simtel.RU!news.bylinux.net!netnews.sdu.edu.cn!news2.happynet.org!TJUBBS
From: angeldong.bbs@bbs.tju.edu.cn.no.spam (�����)
Newsgroups: cn.bbs.comp.lang.java
Subject: ���ְ�æ�����ã���
Date: 23 Aug 2004 03:35:39 GMT
Organization: �����ʵBBSվ
Message-ID: <4DjD5R$9iT@bbs.tju.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: Java/M.1093232139.A
Lines: 93