信息发布软件,b2b软件,广告发布软件

 找回密码
 立即注册
搜索
查看: 2576|回复: 13
打印 上一主题 下一主题

[『JSP图文教程』] 用JSP如何实现自己的MD5给自己的东东加层密文

[复制链接]

1868

主题

1878

帖子

1万

积分

积分
10928
跳转到指定楼层
宣传软件楼主
发表于 2017-7-3 21:46:15 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

软件教程首图:

软件教程分类:JSP 图文教程 

软件图文教程视频教程分类:软件图文教程 

软件教程难易程度:软件初级教程 

软件教程发布日期:2017-07-03

软件教程关键字:用JSP如何实现自己的MD5给自己的东东加层密文

① 本信息收集于网络,如有不对的地方欢迎联系我纠正!
② 本信息免费收录,不存在价格的问题!
③ 如果您的网站也想这样出现在这里,请您加好友情链接,我当天会审核通过!

④友情链接关键字:软件定制网站 网址:http://www.postbbs.com

软件教程详细描述
本帖最后由 群发软件 于 2017-7-3 22:01 编辑

/**

建立一个名为MD5Digest的java文件,内容如下

/**
* 类名:      MD5Digest<br>
* 说明:   用来进行密码加密的md5公用参数<br>
* 编写日期:  2011/03/05<br>
* 修改者:    <br>
* 修改信息:  <br>
*/

在各种应用系统的开发中,经常需要存储用户信息,很多地方都要存储用户密码,而将用户密码直接存储在服务器上显然是不安全的,本文简要介绍在JSP中如何实现MD5加密的方法,希望能抛砖引玉。
(一)消息摘要简介
一个消息摘要就是一个数据块的数字指纹。即对一个任意长度的一个数据块进行计算,产生一个唯一指印(对于SHA1是产生一个20字节的二进制数组)。消息摘要是一种与消息认证码结合使用以确保消息完整性的技术。主要使用单向散列函数算法,可用于检验消息的完整性,和通过散列密码直接以文本形式保存等,目前广泛使用的算法有MD4、MD5、SHA-1。
消息摘要有两个基本属性:
两个不同的报文难以生成相同的摘要
难以对指定的摘要生成一个报文,而可以由该报文反推算出该指定的摘要。
Java源码
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Digest { private MessageDigest __md5 = null; private StringBuffer __digestBuffer = null; public MD5Digest() throws NoSuchAlgorithmException { __md5 = MessageDigest.getInstance("MD5"); __digestBuffer = new StringBuffer(); } public String md5crypt(String s) { __digestBuffer.setLength(0); byte abyte0[] = __md5.digest(s.getBytes()); for(int i = 0; i < abyte0.length; i++) __digestBuffer.append(toHex(abyte0)); return __digestBuffer.toString(); } public String toHex(byte one){ String HEX="0123456789ABCDEF"; char[] result=new char[2]; result[0]=HEX.charAt((one & 0xf0) >> 4); result[1]=HEX.charAt(one & 0x0f); String mm=new String(result); return mm; } }
-------------------------------------------------------------------------------
/************************************************   MD5 算法的Java Bean   @author:Topcat Tuppin   Last Modified:10,Mar,2001   *************************************************/   package beartool;   import java.lang.reflect.*;   /*************************************************   md5 类实现了RSA Data Security, Inc.在提交给IETF   的RFC1321中的MD5 message-digest 算法。   *************************************************/   public class MD5 {   /* 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的,   这里把它们实现成为static final是表示了只读,切能在同一个进程空间内的多个   Instance间共享*/   static final int S11 = 7;   static final int S12 = 12;   static final int S13 = 17;   static final int S14 = 22;   static final int S21 = 5;   static final int S22 = 9;   static final int S23 = 14;   static final int S24 = 20;   static final int S31 = 4;   static final int S32 = 11;   static final int S33 = 16;   static final int S34 = 23;   static final int S41 = 6;   static final int S42 = 10;   static final int S43 = 15;   static final int S44 = 21;   static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };   /* 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中   被定义到MD5_CTX结构中    */   private long[] state = new long[4];// state (ABCD)   private long[] count = new long[2];// number of bits, modulo 2^64 (lsb first)   private byte[] buffer = new byte[64]; // input buffer    /* digestHexStr是MD5的唯一一个公共成员,是最新一次计算结果的     16进制ASCII表示.   */   public String digestHexStr;    /* digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值.   */   private byte[] digest = new byte[16];    /*   getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串   返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的.   */   public String getMD5ofStr(String inbuf) {   md5Init();   md5Update(inbuf.getBytes(), inbuf.length());   md5Final();   digestHexStr = "";   for (int i = 0; i < 16; i++) {   digestHexStr += byteHEX(digest);   }   return digestHexStr;   }   // 这是MD5这个类的标准构造函数,JavaBean要求有一个public的并且没有参数的构造函数   public MD5() {   md5Init();   return;   }   /* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */   private void md5Init() {   count[0] = 0L;   count[1] = 0L;   ///* Load magic initialization constants.   state[0] = 0x67452301L;   state[1] = 0xefcdab89L;   state[2] = 0x98badcfeL;   state[3] = 0x10325476L;   return;   }   /* F, G, H ,I 是4个基本的MD5函数,在原始的MD5的C实现中,由于它们是   简单的位运算,可能出于效率的考虑把它们实现成了宏,在java中,我们把它们     实现成了private方法,名字保持了原来C中的。 */   private long F(long x, long y, long z) {   return (x & y) | ((~x) & z);   }   private long G(long x, long y, long z) {   return (x & z) | (y & (~z));   }   private long H(long x, long y, long z) {   return x ^ y ^ z;   }   private long I(long x, long y, long z) {   return y ^ (x | (~z));   }    /*   FF,GG,HH和II将调用F,G,H,I进行近一步变换   FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.   Rotation is separate from addition to prevent recomputation.   */   private long FF(long a, long b, long c, long d, long x, long s,   long ac) {   a += F (b, c, d) + x + ac;   a = ((int) a << s) | ((int) a >>> (32 - s));   a += b;   return a;   }   private long GG(long a, long b, long c, long d, long x, long s,   long ac) {   a += G (b, c, d) + x + ac;   a = ((int) a << s) | ((int) a >>> (32 - s));   a += b;   return a;   }   private long HH(long a, long b, long c, long d, long x, long s,   long ac) {   a += H (b, c, d) + x + ac;   a = ((int) a << s) | ((int) a >>> (32 - s));   a += b;   return a;   }   private long II(long a, long b, long c, long d, long x, long s,   long ac) {   a += I (b, c, d) + x + ac;   a = ((int) a << s) | ((int) a >>> (32 - s));   a += b;   return a;   }   /*   md5Update是MD5的主计算过程,inbuf是要变换的字节串,inputlen是长度,这个   函数由getMD5ofStr调用,调用之前需要调用md5init,因此把它设计成private的   */   private void md5Update(byte[] inbuf, int inputLen) {   int i, index, partLen;   byte[] block = new byte[64];   index = (int)(count[0] >>> 3) & 0x3F;   // /* Update number of bits */   if ((count[0] += (inputLen << 3)) < (inputLen << 3))   count[1]++;   count[1] += (inputLen >>> 29);   partLen = 64 - index;   // Transform as many times as possible.   if (inputLen >= partLen) {   md5Memcpy(buffer, inbuf, index, 0, partLen);   md5Transform(buffer);   for (i = partLen; i + 63 < inputLen; i += 64) {   md5Memcpy(block, inbuf, 0, i, 64);   md5Transform (block);   }   index = 0;   } else   i = 0;   ///* Buffer remaining input */   md5Memcpy(buffer, inbuf, index, i, inputLen - i);   }    /*   md5Final整理和填写输出结果   */   private void md5Final () {   byte[] bits = new byte[8];   int index, padLen;   ///* Save number of bits */   Encode (bits, count, 8);   ///* Pad out to 56 mod 64.   index = (int)(count[0] >>> 3) & 0x3f;   padLen = (index < 56) ? (56 - index) : (120 - index);   md5Update (PADDING, padLen);   ///* Append length (before padding) */   md5Update(bits, 8);   ///* Store state in digest */   Encode (digest, state, 16);   }    /* md5Memcpy是一个内部使用的byte数组的块拷贝函数,从input的inpos开始把len长度的         字节拷贝到output的outpos位置开始   */   private void md5Memcpy (byte[] output, byte[] input,   int outpos, int inpos, int len)   {   int i;   for (i = 0; i < len; i++)   output[outpos + i] = input[inpos + i];   }    /*   md5Transform是MD5核心变换程序,有md5Update调用,block是分块的原始字节   */   private void md5Transform (byte block[]) {   long a = state[0], b = state[1], c = state[2], d = state[3];   long[] x = new long[16];   Decode (x, block, 64);   /* Round 1 */   a = FF (a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */   d = FF (d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */   c = FF (c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */   b = FF (b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */   a = FF (a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */   d = FF (d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */   c = FF (c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */   b = FF (b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */   a = FF (a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */   d = FF (d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */   c = FF (c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */   b = FF (b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */   a = FF (a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */   d = FF (d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */   c = FF (c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */   b = FF (b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */   /* Round 2 */   a = GG (a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */   d = GG (d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */   c = GG (c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */   b = GG (b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */   a = GG (a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */   d = GG (d, a, b, c, x[10], S22, 0x2441453L); /* 22 */   c = GG (c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */   b = GG (b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */   a = GG (a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */   d = GG (d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */   c = GG (c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */   b = GG (b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */   a = GG (a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */   d = GG (d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */   c = GG (c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */   b = GG (b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */   /* Round 3 */   a = HH (a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */   d = HH (d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */   c = HH (c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */   b = HH (b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */   a = HH (a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */   d = HH (d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */   c = HH (c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */   b = HH (b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */   a = HH (a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */   d = HH (d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */   c = HH (c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */   b = HH (b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */   a = HH (a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */   d = HH (d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */   c = HH (c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */   b = HH (b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */   /* Round 4 */   a = II (a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */   d = II (d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */   c = II (c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */   b = II (b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */   a = II (a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */   d = II (d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */   c = II (c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */   b = II (b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */   a = II (a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */   d = II (d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */   c = II (c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */   b = II (b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */   a = II (a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */   d = II (d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */   c = II (c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */   b = II (b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */   state[0] += a;   state[1] += b;   state[2] += c;   state[3] += d;   }    /*Encode把long数组按顺序拆成byte数组,因为java的long类型是64bit的,   只拆低32bit,以适应原始C实现的用途   */   private void Encode (byte[] output, long[] input, int len) {   int i, j;   for (i = 0, j = 0; j < len; i++, j += 4) {   output[j] = (byte)(input & 0xffL);   output[j + 1] = (byte)((input >>> 8) & 0xffL);   output[j + 2] = (byte)((input >>> 16) & 0xffL);   output[j + 3] = (byte)((input >>> 24) & 0xffL);   }   }   /*Decode把byte数组按顺序合成成long数组,因为java的long类型是64bit的,   只合成低32bit,高32bit清零,以适应原始C实现的用途   */   private void Decode (long[] output, byte[] input, int len) {   int i, j;    for (i = 0, j = 0; j < len; i++, j += 4)   output = b2iu(input[j]) |   (b2iu(input[j + 1]) << 8) |   (b2iu(input[j + 2]) << 16) |   (b2iu(input[j + 3]) << 24);   return;   }    /*   b2iu是我写的一个把byte按照不考虑正负号的原则的"升位"程序,因为java没有unsigned运算   */   public static long b2iu(byte b) {   return b < 0 ? b & 0x7F + 128 : b;   }    /*byteHEX(),用来把一个byte类型的数转换成十六进制的ASCII表示,    因为java中的byte的toString无法实现这一点,我们又没有C语言中的   sprintf(outbuf,"%02X",ib)   */   public static String byteHEX(byte ib) {   char[] Digit = { '0','1','2','3','4','5','6','7','8','9',   'A','B','C','D','E','F' };   char [] ob = new char[2];   ob[0] = Digit[(ib >>> 4) & 0X0F];   ob[1] = Digit[ib & 0X0F];   String s = new String(ob);   return s;   }   public static void main(String args[]) {    MD5 m = new MD5();   if (Array.getLength(args) == 0) {//如果没有参数,执行标准的Test Suite    System.out.println("MD5 Test suite:");   System.out.println("MD5(\"\"):"+m.getMD5ofStr(""));   System.out.println("MD5(\"a\"):"+m.getMD5ofStr("a"));   System.out.println("MD5(\"abc\"):"+m.getMD5ofStr("abc"));   System.out.println("MD5(\"message digest\"):"+m.getMD5ofStr("message digest"));   System.out.println("MD5(\"abcdefghijklmnopqrstuvwxyz\"):"+   m.getMD5ofStr("abcdefghijklmnopqrstuvwxyz"));   System.out.println("MD5(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"):"+   m.getMD5ofStr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));   }   else    System.out.println("MD5(" + args[0] + ")=" + m.getMD5ofStr(args[0]));     }   }
JSP中的使用方法
-------------------------------------------------------------------------------
<%@ page language='java' %> <jsp:useBean id='oMD5' scope='request' class='beartool.MD5'/> <%@ page import='java.util.*'%> <%@ page import='java.sql.*'%> <html> <body> <% String userid = request.getParameter("UserID");//获取用户输入UserID String password = request.getParameter("assword"); //获取用户输入的Password  String pwdmd5 = oMD5.getMD5ofStr(password);//计算MD5的值  PrintWriter rp = response.getWriter();  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  Connection con = DriverManager.getConnection("jdbcdbc:community", "", ""); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from users where userID ='"+userid+"' and pwdmd5= '" + pwdmd5+"'" ); if (rs.next())  { rp.print("Login OK");  } else { rp.print("Login Fail"); } stmt.close(); con.close();  %> </body> </html>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持脚本之家。

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Digest
{

    private MessageDigest __md5 = null;
    private StringBuffer __digestBuffer = null;

    public MD5Digest()
        throws NoSuchAlgorithmException
    {
        __md5 = MessageDigest.getInstance("MD5");
        __digestBuffer = new StringBuffer();
    }

    public String md5crypt(String s)
    {
        __digestBuffer.setLength(0);
        byte abyte0[] = __md5.digest(s.getBytes());
        for(int i = 0; i < abyte0.length; i++)
            __digestBuffer.append(toHex(abyte0));

        return __digestBuffer.toString();
    }
    public String toHex(byte one){
   String HEX="0123456789ABCDEF";
   char[] result=new char[2];
   result[0]=HEX.charAt((one & 0xf0) >> 4);
   result[1]=HEX.charAt(one & 0x0f);
   String mm=new String(result);
   return mm;
  }
}


二、再建立一个名为MD5的java文件,内容如下

/************************************************
MD5 算法的Java Bean
@author:Topcat Tuppin
Last Modified:10,Mar,2001
*************************************************/
package beartool;
import java.lang.reflect.*;
/*************************************************
md5 类实现了RSA Data Security, Inc.在提交给IETF
的RFC1321中的MD5 message-digest 算法。
*************************************************/

public class MD5 {
/* 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的,
这里把它们实现成为static final是表示了只读,切能在同一个进程空间内的多个
Instance间共享*/
        static final int S11 = 7;
        static final int S12 = 12;
        static final int S13 = 17;
        static final int S14 = 22;

        static final int S21 = 5;
        static final int S22 = 9;
        static final int S23 = 14;
        static final int S24 = 20;

        static final int S31 = 4;
        static final int S32 = 11;
        static final int S33 = 16;
        static final int S34 = 23;

        static final int S41 = 6;
        static final int S42 = 10;
        static final int S43 = 15;
        static final int S44 = 21;

        static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
        /* 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中
           被定义到MD5_CTX结构中
        
         */
        private long[] state = new long[4];  // state (ABCD)
        private long[] count = new long[2];  // number of bits, modulo 2^64 (lsb first)
        private byte[] buffer = new byte[64]; // input buffer
        
/* digestHexStr是MD5的唯一一个公共成员,是最新一次计算结果的
  16进制ASCII表示.
*/
        public String digestHexStr;
        
        /* digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值.
*/
        private byte[] digest = new byte[16];
        
/*
getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串
返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的.
*/
        public String getMD5ofStr(String inbuf) {
                md5Init();
                md5Update(inbuf.getBytes(), inbuf.length());
                md5Final();
                digestHexStr = "";
                for (int i = 0; i < 16; i++) {
                        digestHexStr += byteHEX(digest);
                }
                return digestHexStr;

        }
        // 这是MD5这个类的标准构造函数,JavaBean要求有一个public的并且没有参数的构造函数
        public MD5() {
                md5Init();

                return;
        }
      


        /* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */
        private void md5Init() {
                count[0] = 0L;
                count[1] = 0L;
                ///* Load magic initialization constants.

                state[0] = 0x67452301L;
                state[1] = 0xefcdab89L;
                state[2] = 0x98badcfeL;
                state[3] = 0x10325476L;

                return;
        }
        /* F, G, H ,I 是4个基本的MD5函数,在原始的MD5的C实现中,由于它们是
        简单的位运算,可能出于效率的考虑把它们实现成了宏,在java中,我们把它们
       实现成了private方法,名字保持了原来C中的。 */

        private long F(long x, long y, long z) {
                return (x & y) | ((~x) & z);

        }
        private long G(long x, long y, long z) {
                return (x & z) | (y & (~z));

        }
        private long H(long x, long y, long z) {
                return x ^ y ^ z;
        }

        private long I(long x, long y, long z) {
                return y ^ (x | (~z));
        }
        
       /*
          FF,GG,HH和II将调用F,G,H,I进行近一步变换
          FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
          Rotation is separate from addition to prevent recomputation.
       */

        private long FF(long a, long b, long c, long d, long x, long s,
                long ac) {
                a += F (b, c, d) + x + ac;
                a = ((int) a << s) | ((int) a >>> (32 - s));
                a += b;
                return a;
        }

        private long GG(long a, long b, long c, long d, long x, long s,
                long ac) {
                a += G (b, c, d) + x + ac;
                a = ((int) a << s) | ((int) a >>> (32 - s));
                a += b;
                return a;
        }
        private long HH(long a, long b, long c, long d, long x, long s,
                long ac) {
                a += H (b, c, d) + x + ac;
                a = ((int) a << s) | ((int) a >>> (32 - s));
                a += b;
                return a;
        }
        private long II(long a, long b, long c, long d, long x, long s,
                long ac) {
                a += I (b, c, d) + x + ac;
                a = ((int) a << s) | ((int) a >>> (32 - s));
                a += b;
                return a;
        }
        /*
         md5Update是MD5的主计算过程,inbuf是要变换的字节串,inputlen是长度,这个
         函数由getMD5ofStr调用,调用之前需要调用md5init,因此把它设计成private的
        */
        private void md5Update(byte[] inbuf, int inputLen) {

                int i, index, partLen;
                byte[] block = new byte[64];
                index = (int)(count[0] >>> 3) & 0x3F;
                // /* Update number of bits */
                if ((count[0] += (inputLen << 3)) < (inputLen << 3))
                        count[1]++;
                count[1] += (inputLen >>> 29);

                partLen = 64 - index;

                // Transform as many times as possible.
                if (inputLen >= partLen) {
                        md5Memcpy(buffer, inbuf, index, 0, partLen);
                        md5Transform(buffer);

                        for (i = partLen; i + 63 < inputLen; i += 64) {

                                md5Memcpy(block, inbuf, 0, i, 64);
                                md5Transform (block);
                        }
                        index = 0;

                } else

                        i = 0;

                ///* Buffer remaining input */
                md5Memcpy(buffer, inbuf, index, i, inputLen - i);

        }
        
        /*
          md5Final整理和填写输出结果
        */
        private void md5Final () {
                byte[] bits = new byte[8];
                int index, padLen;

                ///* Save number of bits */
                Encode (bits, count, 8);

                ///* Pad out to 56 mod 64.
                index = (int)(count[0] >>> 3) & 0x3f;
                padLen = (index < 56) ? (56 - index) : (120 - index);
                md5Update (PADDING, padLen);

                ///* Append length (before padding) */
                md5Update(bits, 8);

                ///* Store state in digest */
                Encode (digest, state, 16);

        }
         
        /* md5Memcpy是一个内部使用的byte数组的块拷贝函数,从input的inpos开始把len长度的
      字节拷贝到output的outpos位置开始
        */

        private void md5Memcpy (byte[] output, byte[] input,
                int outpos, int inpos, int len)
        {
                int i;

                for (i = 0; i < len; i++)
                        output[outpos + i] = input[inpos + i];
        }
        
        /*
           md5Transform是MD5核心变换程序,有md5Update调用,block是分块的原始字节
        */
        private void md5Transform (byte block[]) {
                long a = state[0], b = state[1], c = state[2], d = state[3];
                long[] x = new long[16];

                Decode (x, block, 64);

                /* Round 1 */
                a = FF (a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */
                d = FF (d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */
                c = FF (c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */
                b = FF (b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */
                a = FF (a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */
                d = FF (d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */
                c = FF (c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */
                b = FF (b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */
                a = FF (a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */
                d = FF (d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */
                c = FF (c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */
                b = FF (b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */
                a = FF (a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */
                d = FF (d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */
                c = FF (c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */
                b = FF (b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */

                /* Round 2 */
                a = GG (a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */
                d = GG (d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */
                c = GG (c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */
                b = GG (b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */
                a = GG (a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */
                d = GG (d, a, b, c, x[10], S22, 0x2441453L); /* 22 */
                c = GG (c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */
                b = GG (b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */
                a = GG (a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */
                d = GG (d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */
                c = GG (c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */
                b = GG (b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */
                a = GG (a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */
                d = GG (d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */
                c = GG (c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */
                b = GG (b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */

                /* Round 3 */
                a = HH (a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */
                d = HH (d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */
                c = HH (c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */
                b = HH (b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */
                a = HH (a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */
                d = HH (d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */
                c = HH (c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */
                b = HH (b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */
                a = HH (a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */
                d = HH (d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */
                c = HH (c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */
                b = HH (b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */
                a = HH (a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */
                d = HH (d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */
                c = HH (c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */
                b = HH (b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */

                /* Round 4 */
                a = II (a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */
                d = II (d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */
                c = II (c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */
                b = II (b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */
                a = II (a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */
                d = II (d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */
                c = II (c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */
                b = II (b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */
                a = II (a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */
                d = II (d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */
                c = II (c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */
                b = II (b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */
                a = II (a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */
                d = II (d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */
                c = II (c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */
                b = II (b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */

                state[0] += a;
                state[1] += b;
                state[2] += c;
                state[3] += d;

        }
        
        /*Encode把long数组按顺序拆成byte数组,因为java的long类型是64bit的,
          只拆低32bit,以适应原始C实现的用途
        */
        private void Encode (byte[] output, long[] input, int len) {
                int i, j;

                for (i = 0, j = 0; j < len; i++, j += 4) {
                        output[j] = (byte)(input & 0xffL);
                        output[j + 1] = (byte)((input >>> 8) & 0xffL);
                        output[j + 2] = (byte)((input >>> 16) & 0xffL);
                        output[j + 3] = (byte)((input >>> 24) & 0xffL);
                }
        }

        /*Decode把byte数组按顺序合成成long数组,因为java的long类型是64bit的,
          只合成低32bit,高32bit清零,以适应原始C实现的用途
        */
        private void Decode (long[] output, byte[] input, int len) {
                int i, j;


                for (i = 0, j = 0; j < len; i++, j += 4)
                        output = b2iu(input[j]) |
                                (b2iu(input[j + 1]) << 8) |
                                (b2iu(input[j + 2]) << 16) |
                                (b2iu(input[j + 3]) << 24);

                return;
        }
      
        /*
          b2iu是我写的一个把byte按照不考虑正负号的原则的"升位"程序,因为java没有unsigned运算
        */
        public static long b2iu(byte b) {
                return b < 0 ? b & 0x7F + 128 : b;
        }
        
/*byteHEX(),用来把一个byte类型的数转换成十六进制的ASCII表示,
 因为java中的byte的toString无法实现这一点,我们又没有C语言中的
sprintf(outbuf,"%02X",ib)
*/
        public static String byteHEX(byte ib) {
                char[] Digit = { '0','1','2','3','4','5','6','7','8','9',
                'A','B','C','D','E','F' };
                char [] ob = new char[2];
                ob[0] = Digit[(ib >>> 4) & 0X0F];
                ob[1] = Digit[ib & 0X0F];
                String s = new String(ob);
                return s;
        }

        public static void main(String args[]) {


                MD5 m = new MD5();
                if (Array.getLength(args) == 0) {   //如果没有参数,执行标准的Test Suite
               
                        System.out.println("MD5 Test suite:");
                System.out.println("MD5(\"\"):"+m.getMD5ofStr(""));
                System.out.println("MD5(\"a\"):"+m.getMD5ofStr("a"));
                System.out.println("MD5(\"abc\"):"+m.getMD5ofStr("abc"));
                System.out.println("MD5(\"message digest\"):"+m.getMD5ofStr("message digest"));
                System.out.println("MD5(\"abcdefghijklmnopqrstuvwxyz\"):"+
                        m.getMD5ofStr("abcdefghijklmnopqrstuvwxyz"));
                System.out.println("MD5(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"):"+
                      m.getMD5ofStr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
                }
                else
                      System.out.println("MD5(" + args[0] + ")=" + m.getMD5ofStr(args[0]));
               
         
        }

}


三、将这两个文件都进行编译,编译后保存在:\WEB-INF\classes\beartool

四、到JSP页面中测试,代码如下:

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%request.setCharacterEncoding("gb2312");%>
<jsp:useBean id='oMD5' scope='request' class='beartool.MD5'/>
    <%
     String password="abc123";
   String pwdmd5 = oMD5.getMD5ofStr(password);
  out.println(pwdmd5);
    %>

  * 类名:MD5Digest<br>
  * 说明:用来进行密码加密的md5公用参数<br>
  * 编写日期:2001/03/05<br>
  * 修改者:<br>
  * 修改信息:<br>
  * @authoredgarlo
  * @version1.0<br>
  */
  
  import java.security.MessageDigest;
  import java.security.NoSuchAlgorithmException;

  public class MD5Digest
  {

  private MessageDigest __md5 = null;
  private StringBuffer __digestBuffer = null;

  public MD5Digest()
  throws NoSuchAlgorithmException
  {
  __md5 = MessageDigest.getInstance("MD5");
  __digestBuffer = new StringBuffer();
  }

  public String md5crypt(String s)
  {
  __digestBuffer.setLength(0);
  byte abyte0[] = __md5.digest(s.getBytes());
  for(int i = 0; i < abyte0.length; i++)
  __digestBuffer.append(toHex(abyte0));

  return __digestBuffer.toString();
  }
  public String toHex(byte one){
  String HEX="0123456789ABCDEF";
  char[] result=new char[2];
  result[0]=HEX.charAt((one & 0xf0) >> 4);
  result[1]=HEX.charAt(one & 0x0f);
  String mm=new String(result);
  return mm;
  }
  }

  --------------------------------------------------------------------------------
  /************************************************
  MD5 算法的Java Bean
  @author:Topcat Tuppin
  Last Modified:10,Mar,2001
  *************************************************/
  package beartool;
  import java.lang.reflect.*;
  /*************************************************
  md5 类实现了RSA Data Security, Inc.在提交给IETF
  的RFC1321中的MD5 message-digest 算法。
  *************************************************/

  public class MD5 {
  /* 下面这些S11-S44实际上是一个4*4的矩阵,在原始的C实现中是用#define 实现的,
  这里把它们实现成为static final是表示了只读,切能在同一个进程空间内的多个
  Instance间共享*/
  static final int S11 = 7;
  static final int S12 = 12;
  static final int S13 = 17;
  static final int S14 = 22;

  static final int S21 = 5;
  static final int S22 = 9;
  static final int S23 = 14;
  static final int S24 = 20;

  static final int S31 = 4;
  static final int S32 = 11;
  static final int S33 = 16;
  static final int S34 = 23;

  static final int S41 = 6;
  static final int S42 = 10;
  static final int S43 = 15;
  static final int S44 = 21;

  static final byte[] PADDING = { -128, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  /* 下面的三个成员是MD5计算过程中用到的3个核心数据,在原始的C实现中
  被定义到MD5_CTX结构中
  
  */
  private long[] state = new long[4];// state (ABCD)
  private long[] count = new long[2];// number of bits, modulo 2^64 (lsb first)
  private byte[] buffer = new byte[64]; // input buffer
  
  /* digestHexStr是MD5的唯一一个公共成员,是最新一次计算结果的
    16进制ASCII表示.
  */
  public String digestHexStr;
  
  /* digest,是最新一次计算结果的2进制内部表示,表示128bit的MD5值.
  */
  private byte[] digest = new byte[16];
  
  /*
  getMD5ofStr是类MD5最主要的公共方法,入口参数是你想要进行MD5变换的字符串
  返回的是变换完的结果,这个结果是从公共成员digestHexStr取得的.
  */
  public String getMD5ofStr(String inbuf) {
  md5Init();
  md5Update(inbuf.getBytes(), inbuf.length());
  md5Final();
  digestHexStr = "";
  for (int i = 0; i < 16; i++) {
  digestHexStr += byteHEX(digest);
  }
  return digestHexStr;

  }
  // 这是MD5这个类的标准构造函数,JavaBean要求有一个public的并且没有参数的构造函数
  public MD5() {
  md5Init();

  return;
  }
  /* md5Init是一个初始化函数,初始化核心变量,装入标准的幻数 */
  private void md5Init() {
  count[0] = 0L;
  count[1] = 0L;
  ///* Load magic initialization constants.

  state[0] = 0x67452301L;
  state[1] = 0xefcdab89L;
  state[2] = 0x98badcfeL;
  state[3] = 0x10325476L;

  return;
  }
  /* F, G, H ,I 是4个基本的MD5函数,在原始的MD5的C实现中,由于它们是
  简单的位运算,可能出于效率的考虑把它们实现成了宏,在java中,我们把它们
    实现成了private方法,名字保持了原来C中的。 */

  private long F(long x, long y, long z) {
  return (x & y) | ((~x) & z);

  }
  private long G(long x, long y, long z) {
  return (x & z) | (y & (~z));

  }
  private long H(long x, long y, long z) {
  return x ^ y ^ z;
  }

  private long I(long x, long y, long z) {
  return y ^ (x | (~z));
  }
  
  /*
  FF,GG,HH和II将调用F,G,H,I进行近一步变换
  FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
  Rotation is separate from addition to prevent recomputation.
  */

  private long FF(long a, long b, long c, long d, long x, long s,
  long ac) {
  a += F (b, c, d) + x + ac;
  a = ((int) a << s) | ((int) a >>> (32 - s));
  a += b;
  return a;
  }

  private long GG(long a, long b, long c, long d, long x, long s,
  long ac) {
  a += G (b, c, d) + x + ac;
  a = ((int) a << s) | ((int) a >>> (32 - s));
  a += b;
  return a;
  }
  private long HH(long a, long b, long c, long d, long x, long s,
  long ac) {
  a += H (b, c, d) + x + ac;
  a = ((int) a << s) | ((int) a >>> (32 - s));
  a += b;
  return a;
  }
  private long II(long a, long b, long c, long d, long x, long s,
  long ac) {
  a += I (b, c, d) + x + ac;
  a = ((int) a << s) | ((int) a >>> (32 - s));
  a += b;
  return a;
  }
  /*
  md5Update是MD5的主计算过程,inbuf是要变换的字节串,inputlen是长度,这个
  函数由getMD5ofStr调用,调用之前需要调用md5init,因此把它设计成private的
  */
  private void md5Update(byte[] inbuf, int inputLen) {

  int i, index, partLen;
  byte[] block = new byte[64];
  index = (int)(count[0] >>> 3) & 0x3F;
  // /* Update number of bits */
  if ((count[0] += (inputLen << 3)) < (inputLen << 3))
  count[1]++;
  count[1] += (inputLen >>> 29);

  partLen = 64 - index;

  // Transform as many times as possible.
  if (inputLen >= partLen) {
  md5Memcpy(buffer, inbuf, index, 0, partLen);
  md5Transform(buffer);

  for (i = partLen; i + 63 < inputLen; i += 64) {

  md5Memcpy(block, inbuf, 0, i, 64);
  md5Transform (block);
  }
  index = 0;

  } else

  i = 0;

  ///* Buffer remaining input */
  md5Memcpy(buffer, inbuf, index, i, inputLen - i);

  }
  
  /*
  md5Final整理和填写输出结果
  */
  private void md5Final () {
  byte[] bits = new byte[8];
  int index, padLen;

  ///* Save number of bits */
  Encode (bits, count, 8);

  ///* Pad out to 56 mod 64.
  index = (int)(count[0] >>> 3) & 0x3f;
  padLen = (index < 56) ? (56 - index) : (120 - index);
  md5Update (PADDING, padLen);

  ///* Append length (before padding) */
  md5Update(bits, 8);

  ///* Store state in digest */
  Encode (digest, state, 16);

  }
  
  /* md5Memcpy是一个内部使用的byte数组的块拷贝函数,从input的inpos开始把len长度的
        字节拷贝到output的outpos位置开始
  */

  private void md5Memcpy (byte[] output, byte[] input,
  int outpos, int inpos, int len)
  {
  int i;

  for (i = 0; i < len; i++)
  output[outpos + i] = input[inpos + i];
  }
  
  /*
  md5Transform是MD5核心变换程序,有md5Update调用,block是分块的原始字节
  */
  private void md5Transform (byte block[]) {
  long a = state[0], b = state[1], c = state[2], d = state[3];
  long[] x = new long[16];

  Decode (x, block, 64);

  /* Round 1 */
  a = FF (a, b, c, d, x[0], S11, 0xd76aa478L); /* 1 */
  d = FF (d, a, b, c, x[1], S12, 0xe8c7b756L); /* 2 */
  c = FF (c, d, a, b, x[2], S13, 0x242070dbL); /* 3 */
  b = FF (b, c, d, a, x[3], S14, 0xc1bdceeeL); /* 4 */
  a = FF (a, b, c, d, x[4], S11, 0xf57c0fafL); /* 5 */
  d = FF (d, a, b, c, x[5], S12, 0x4787c62aL); /* 6 */
  c = FF (c, d, a, b, x[6], S13, 0xa8304613L); /* 7 */
  b = FF (b, c, d, a, x[7], S14, 0xfd469501L); /* 8 */
  a = FF (a, b, c, d, x[8], S11, 0x698098d8L); /* 9 */
  d = FF (d, a, b, c, x[9], S12, 0x8b44f7afL); /* 10 */
  c = FF (c, d, a, b, x[10], S13, 0xffff5bb1L); /* 11 */
  b = FF (b, c, d, a, x[11], S14, 0x895cd7beL); /* 12 */
  a = FF (a, b, c, d, x[12], S11, 0x6b901122L); /* 13 */
  d = FF (d, a, b, c, x[13], S12, 0xfd987193L); /* 14 */
  c = FF (c, d, a, b, x[14], S13, 0xa679438eL); /* 15 */
  b = FF (b, c, d, a, x[15], S14, 0x49b40821L); /* 16 */

  /* Round 2 */
  a = GG (a, b, c, d, x[1], S21, 0xf61e2562L); /* 17 */
  d = GG (d, a, b, c, x[6], S22, 0xc040b340L); /* 18 */
  c = GG (c, d, a, b, x[11], S23, 0x265e5a51L); /* 19 */
  b = GG (b, c, d, a, x[0], S24, 0xe9b6c7aaL); /* 20 */
  a = GG (a, b, c, d, x[5], S21, 0xd62f105dL); /* 21 */
  d = GG (d, a, b, c, x[10], S22, 0x2441453L); /* 22 */
  c = GG (c, d, a, b, x[15], S23, 0xd8a1e681L); /* 23 */
  b = GG (b, c, d, a, x[4], S24, 0xe7d3fbc8L); /* 24 */
  a = GG (a, b, c, d, x[9], S21, 0x21e1cde6L); /* 25 */
  d = GG (d, a, b, c, x[14], S22, 0xc33707d6L); /* 26 */
  c = GG (c, d, a, b, x[3], S23, 0xf4d50d87L); /* 27 */
  b = GG (b, c, d, a, x[8], S24, 0x455a14edL); /* 28 */
  a = GG (a, b, c, d, x[13], S21, 0xa9e3e905L); /* 29 */
  d = GG (d, a, b, c, x[2], S22, 0xfcefa3f8L); /* 30 */
  c = GG (c, d, a, b, x[7], S23, 0x676f02d9L); /* 31 */
  b = GG (b, c, d, a, x[12], S24, 0x8d2a4c8aL); /* 32 */

  /* Round 3 */
  a = HH (a, b, c, d, x[5], S31, 0xfffa3942L); /* 33 */
  d = HH (d, a, b, c, x[8], S32, 0x8771f681L); /* 34 */
  c = HH (c, d, a, b, x[11], S33, 0x6d9d6122L); /* 35 */
  b = HH (b, c, d, a, x[14], S34, 0xfde5380cL); /* 36 */
  a = HH (a, b, c, d, x[1], S31, 0xa4beea44L); /* 37 */
  d = HH (d, a, b, c, x[4], S32, 0x4bdecfa9L); /* 38 */
  c = HH (c, d, a, b, x[7], S33, 0xf6bb4b60L); /* 39 */
  b = HH (b, c, d, a, x[10], S34, 0xbebfbc70L); /* 40 */
  a = HH (a, b, c, d, x[13], S31, 0x289b7ec6L); /* 41 */
  d = HH (d, a, b, c, x[0], S32, 0xeaa127faL); /* 42 */
  c = HH (c, d, a, b, x[3], S33, 0xd4ef3085L); /* 43 */
  b = HH (b, c, d, a, x[6], S34, 0x4881d05L); /* 44 */
  a = HH (a, b, c, d, x[9], S31, 0xd9d4d039L); /* 45 */
  d = HH (d, a, b, c, x[12], S32, 0xe6db99e5L); /* 46 */
  c = HH (c, d, a, b, x[15], S33, 0x1fa27cf8L); /* 47 */
  b = HH (b, c, d, a, x[2], S34, 0xc4ac5665L); /* 48 */

  /* Round 4 */
  a = II (a, b, c, d, x[0], S41, 0xf4292244L); /* 49 */
  d = II (d, a, b, c, x[7], S42, 0x432aff97L); /* 50 */
  c = II (c, d, a, b, x[14], S43, 0xab9423a7L); /* 51 */
  b = II (b, c, d, a, x[5], S44, 0xfc93a039L); /* 52 */
  a = II (a, b, c, d, x[12], S41, 0x655b59c3L); /* 53 */
  d = II (d, a, b, c, x[3], S42, 0x8f0ccc92L); /* 54 */
  c = II (c, d, a, b, x[10], S43, 0xffeff47dL); /* 55 */
  b = II (b, c, d, a, x[1], S44, 0x85845dd1L); /* 56 */
  a = II (a, b, c, d, x[8], S41, 0x6fa87e4fL); /* 57 */
  d = II (d, a, b, c, x[15], S42, 0xfe2ce6e0L); /* 58 */
  c = II (c, d, a, b, x[6], S43, 0xa3014314L); /* 59 */
  b = II (b, c, d, a, x[13], S44, 0x4e0811a1L); /* 60 */
  a = II (a, b, c, d, x[4], S41, 0xf7537e82L); /* 61 */
  d = II (d, a, b, c, x[11], S42, 0xbd3af235L); /* 62 */
  c = II (c, d, a, b, x[2], S43, 0x2ad7d2bbL); /* 63 */
  b = II (b, c, d, a, x[9], S44, 0xeb86d391L); /* 64 */

  state[0] += a;
  state[1] += b;
  state[2] += c;
  state[3] += d;

  }
  
  /*Encode把long数组按顺序拆成byte数组,因为java的long类型是64bit的,
  只拆低32bit,以适应原始C实现的用途
  */
  private void Encode (byte[] output, long[] input, int len) {
  int i, j;

  for (i = 0, j = 0; j < len; i++, j += 4) {
  output[j] = (byte)(input & 0xffL);
  output[j + 1] = (byte)((input >>> 8) & 0xffL);
  output[j + 2] = (byte)((input >>> 16) & 0xffL);
  output[j + 3] = (byte)((input >>> 24) & 0xffL);
  }
  }

  /*Decode把byte数组按顺序合成成long数组,因为java的long类型是64bit的,
  只合成低32bit,高32bit清零,以适应原始C实现的用途
  */
  private void Decode (long[] output, byte[] input, int len) {
  int i, j;

  
  for (i = 0, j = 0; j < len; i++, j += 4)
  output = b2iu(input[j]) |
  (b2iu(input[j + 1]) << 8) |
  (b2iu(input[j + 2]) << 16) |
  (b2iu(input[j + 3]) << 24);

  return;
  }
  
  /*
  b2iu是我写的一个把byte按照不考虑正负号的原则的"升位"程序,因为java没有unsigned运算
  */
  public static long b2iu(byte b) {
  return b < 0 ? b & 0x7F + 128 : b;
  }
  
  /*byteHEX(),用来把一个byte类型的数转换成十六进制的ASCII表示,
   因为java中的byte的toString无法实现这一点,我们又没有C语言中的
  sprintf(outbuf,"%02X",ib)
  */
  public static String byteHEX(byte ib) {
  char[] Digit = { '0','1','2','3','4','5','6','7','8','9',
  'A','B','C','D','E','F' };
  char [] ob = new char[2];
  ob[0] = Digit[(ib >>> 4) & 0X0F];
  ob[1] = Digit[ib & 0X0F];
  String s = new String(ob);
  return s;
  }

  public static void main(String args[]) {

  
  MD5 m = new MD5();
  if (Array.getLength(args) == 0) {//如果没有参数,执行标准的Test Suite
  
  System.out.println("MD5 Test suite:");
  System.out.println("MD5(\"\"):"+m.getMD5ofStr(""));
  System.out.println("MD5(\"a\"):"+m.getMD5ofStr("a"));
  System.out.println("MD5(\"abc\"):"+m.getMD5ofStr("abc"));
  System.out.println("MD5(\"message digest\"):"+m.getMD5ofStr("message digest"));
  System.out.println("MD5(\"abcdefghijklmnopqrstuvwxyz\"):"+
  m.getMD5ofStr("abcdefghijklmnopqrstuvwxyz"));
  System.out.println("MD5(\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"):"+
  m.getMD5ofStr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"));
  }
  else
  System.out.println("MD5(" + args[0] + ")=" + m.getMD5ofStr(args[0]));
  
  
  }

  }

  JSP中的使用方法

  -------------------------------------------------------------------------------
  <%@ page language='java' %>
  <jsp:useBean id='oMD5' scope='request' class='beartool.MD5'/>

  <%@ page import='java.util.*'%>
  <%@ page import='java.sql.*'%>
  <html>
  <body>
  <%
  String userid = request.getParameter("UserID");//获取用户输入UserID
  String password = request.getParameter("assword"); //获取用户输入的Password
  
  String pwdmd5 = oMD5.getMD5ofStr(password);//计算MD5的值
  
  PrintWriter rp = response.getWriter();
  
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  
  Connection con = DriverManager.getConnection("jdbcdbc:community", "", "");

  Statement stmt = con.createStatement();

  ResultSet rs = stmt.executeQuery("select * from users where userID ='"+userid+"' and pwdmd5= '" + pwdmd5+"'" );

  if (rs.next())
  {
  rp.print("Login OK");
  
  }
  else
  {
  rp.print("Login Fail");
  }

  stmt.close();
  con.close();
  
  %>


unto很实用很暴力的JSP打造自己的收发邮件系统next阿里巴巴自动信息发布软件
回复

使用道具 举报

0

主题

632

帖子

628

积分

积分
628
信息发布软件沙发
发表于 2017-7-7 00:54:51 | 只看该作者
,样子不错,厂家给力

回复 支持 反对

使用道具 举报

0

主题

586

帖子

582

积分

积分
582
推广工具板凳
发表于 2017-7-13 03:49:33 | 只看该作者
意思,出差一直没顾上。微信平台开发找你们做绝对是正确的选择。服务是值得肯定的,售后也非常到位,技术支持很强大,重点是热心.不厌其烦。不像有些玩技术的那个清高啊,那个沟通难度啊真不是一般的高。

回复 支持 反对

使用道具 举报

0

主题

632

帖子

630

积分

积分
630
软件定制开发地板
发表于 2017-7-13 12:04:19 | 只看该作者
然中间有些波折,对设计结果还是比较满意的。好评。

回复 支持 反对

使用道具 举报

0

主题

591

帖子

591

积分

积分
591
5#定制软件#
发表于 2017-7-15 12:59:13 | 只看该作者
,风格很赞,系统很稳定。很好。

回复 支持 反对

使用道具 举报

0

主题

636

帖子

624

积分

积分
624
6#定制软件#
发表于 2017-7-17 15:41:35 | 只看该作者
搞了,雏形出来了,看起来真不错,还有多谢工作人员耐心指导。

回复 支持 反对

使用道具 举报

0

主题

596

帖子

677

积分

积分
677
7#定制软件#
发表于 2017-7-17 17:30:40 | 只看该作者
快,而且都完美解决!

回复 支持 反对

使用道具 举报

0

主题

612

帖子

596

积分

积分
596
8#定制软件#
发表于 2017-7-20 05:47:30 | 只看该作者
服务超好

回复 支持 反对

使用道具 举报

1

主题

2204

帖子

565

积分

积分
565
9#定制软件#
发表于 2017-7-21 23:15:57 | 只看该作者
好,专业的就是不一样,价格很便宜,大公司,给中评是因为对客服的无语

回复 支持 反对

使用道具 举报

0

主题

623

帖子

612

积分

积分
612
10#定制软件#
发表于 2017-7-24 04:21:06 | 只看该作者
服务也好。谢谢卖家帮我解决。

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

相关导读
信息发布软件AIWROK软件苹果IOS里如何启动其他APP?
原理ios的快捷指令可以接收参数我们可以用命令 app.openApp("微信") 来启动微信但是这个指令有两个权限要求第一需要通过快捷指令第二需要aiwork在前端不能在后台 第一步先创建快捷指令如何创建?方案一搜索快捷指令app并打开 点击+号,选打开app 长按这个App文字 这样就创建好打开app并且能接受参数的快捷指令了方案2 直接扫码安装快捷指令 注意到这里还没完因为 使用 命令必须让aiwork在前端,所以必须配置自启动 让执行命令的时
信息发布软件AIWROK软件完整的例子脚本分享1
AIWROK软件完整的例子脚本分享1 https://www.yuque.com/aiwork/nba2pr/mf8wfx4tw5ct3rf2 这里下载附件 这段代码是一个使用AutoApp安卓自动化IDE编写的脚本,主要用于自动化操作名为“红果短视频”的应用程序。脚本的主要功能包括登录应用、播放视频、领取奖励和签到等操作。以下是对代码的详细说明: [*]注释说明: [*]代码开头是一些注释,提供了使用说明以及相关的帮助文档、官方地址和QQ群信息。 [*]引入外部脚本
信息发布软件&#127800;AIWROK软件悬浮窗自定义启停
🌸AIWROK软件悬浮窗自定义启停 这段代码是使用 AIWROK 编写的,一个基于JavaScript的自动化工具,可以用于Android设备上的自动化操作。代码的主要功能是创建一个悬浮窗,悬浮窗上包含两个按钮:“启动”和“关闭”。这两个按钮的功能分别是启动和停止一个后台线程,以及关闭所有运行的任务。代码详细说明如下: [*]创建一个悬浮窗对象 f,使用 new floatUI() 来初始化。 [*]定义变量 t,用于存储线程对象。 [*]使用 loa
信息发布软件AIWROK软件里opencv.findImages找到目标如何打印出来座标呢
安卓的方法:opencv.findImages找到目标如何打印出来座标呢这段代码的主要功能是在一个特定的屏幕上查找并点击一个目标图像。下面是对代码的详细解释: [*]定义屏幕尺寸: var SCREEN_WIDTH = 750;var SCREEN_HEIGHT = 1334; 这两行代码定义了屏幕的宽度和高度,分别为750像素和1334像素。 [*]打印日志: printl('图色232783'); 这行代码打印一条字符串“图色232783”到日志中。需要注意的是,这里使用了printl,在标准的Jav
信息发布软件aiwrok软件屏幕点亮和屏幕息屏的命令无障碍模式
aiwrok软件屏幕点亮和屏幕息屏的命令无障碍模式 [*]导入类:导入PowerManager类。 [*]获取电源管理服务:通过context.getSystemService获取电源管理服务。 [*]创建唤醒锁:创建一个可以唤醒设备并点亮屏幕的唤醒锁。 [*]定义唤醒屏幕函数:创建一个函数wakeScreen,用于唤醒屏幕。 [*]定义释放唤醒锁函数:创建一个函数releaseWakeLock,用于释放唤醒锁。 [*]示例调用:展示如何调用这两个函数来唤醒屏幕并随后释放唤醒
信息发布软件AIWROK软件自定义Activity页面背景图片
AIWROK软件自定义Activity页面背景图片 [*]var ac = new activity();:这行代码创建了一个新的Activity对象。Activity是Android应用的基本构建块之一,通常代表一个单一的屏幕。 [*]ac.loadXML(...):这里通过加载一段XML布局代码来初始化Activity的布局。XML布局代码描述了用户界面的结构和外观。在这个例子中,使用了一个垂直方向的LinearLayout作为根布局,其中包含一个Button。 [*]var view = ac.findViewById("bg"):
信息发布软件opencv原生模板找图转座标方法
这段代码是使用OpenCV库进行图像匹配的JavaScript代码示例。它的主要功能是在一个较大的图像中查找一个小图像的位置。以下是代码的详细说明: [*]导入OpenCV库: [*]importClass(org.opencv.imgproc.Imgproc):导入图像处理类Imgproc,该类包含了图像模板匹配的方法。 [*]importClass(org.opencv.imgcodecs.Imgcodecs):导入图像编码解码类Imgcodecs,该类用于读取和写入图像文件,以及将字节数组转换为Mat对象。 [*]impor
信息发布软件hui动态生成复选框显示所有app
// 官方QQ群 711841924function getChcek1() { var check1 = { id: "check_c16291c6", type: "check", style: { width: "300", height: "auto", position: "absolute", top: 122, left: 103, right: "", bottom: "", borderWidth: "0", borderColor: "", borderStyle: "none",
信息发布软件AIWROK软件随机范围点击随机范围拖动
AIWROK软件随机范围点击随机范围拖动 1. 随机位置点击[/backcolor] 函数 [*]功能:在指定的百分比坐标附近随机点击。 [*]参数: [*]x[/backcolor]:点击位置的百分比 X 坐标。 [*]y[/backcolor]:点击位置的百分比 Y 坐标。 [*]x范围[/backcolor]:X 坐标的随机范围。 [*]y范围[/backcolor]:Y 坐标的随机范围。 [*]实现: [*]首先将百分比坐标转换为实际屏幕坐标。 [*]然后在指定范围内生成新的随机坐标。 [
信息发布软件AIWROK软件里的PaddLeOCR里的OCR
这里有第一种方法:这里带第二种方法:
信息发布软件AIWROK软件YOLO找色判断两个页面是否一样
这段代码常用于自动化测试、监控屏幕内容变化或者实现某些特定的自动化操作,比如在等待某个界面加载完成时,通过检测特定区域的颜色变化来判断页面是否已经加载完毕。// 获取当前屏幕的全屏截图,并保存为/sdcard/1.jpg var img = screen.screenShotFull(); img.save('/sdcard/1.jpg'); // 获取截图中某个特定点的RGB值(此处坐标为屏幕宽度的82.2%,屏幕高度的64.27%) var rgb = img.getPointRGB(0.822, 0.6427);
信息发布软件在AIWROK软件中loadDex 加载插件
说明:可以使用安卓studio 开发出apk,jar,或者dex使用此方法加载模块,注意:插件直接放到插件文件夹中然后上传到手机英文方法: loadDex(plugin),加载插件到系统参数:plugin:插件名称例如导入的插件为 p1.dex,则参数名就填写 loadPlugin(‘p1.dex’)案例://导入dex模块 rhino.loadDex('p1.dex') //导入apk模块 rhino.loadDex('demo.apk')importClass 导入插件中的类方法说明:通过这个方法可以导入插件里编写好的类英文方法:imp
信息发布软件rhino犀牛Java交互AIWROK应用
Java交互简介:AutoApp 提供了 Java交互API,比如导入Java包、类。1.如何让java代码转成js代码例如:我们想要通过java代码获取手机的像素javaDisplayMetrics dm = context.getResources().getDisplayMetrics(); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels;在js代码中变量不需要声明,比如 dm是一个 DisplayMetrics类型 js中直接使用 let 或者 var即可js代码var dm = context.getResources().getDisplay
信息发布软件HID如何开启节点功能呢?
HID如何开启节点功能呢?第一步,HID 连接上好后,灯是快闪的,连上了才可以节点,这要注意一下,打开 APP 图标点击一下打开这个侧栏图标,弹出左边这个主软件界面,这里有很多功能,如下图所示: 第二步是点开 HID 硬件这个按钮侧栏,要 3.36 才有这个功能的,以前的版本没有,这个也要 168 个人会员以上才能用的功能,这个 APP 最新的版本 3.38 可以对部分的自绘界面进行节点操作,有的不规则面页是比较难有节点出现的,有部分
信息发布软件AIWORK软件获取当前所有线程指定停止
getAllThreads 函数用于获取当前Java虚拟机中所有活动线程的信息。它通过获取当前线程的线程组,然后不断向上遍历,直到找到根线程组。接着,利用 enumerate 方法将所有线程枚举到一个数组中,并返回这个数组。 getThreadNames 函数调用 getAllThreads 函数获取所有线程对象后,使用 map 方法提取每个线程的名称,形成一个新的数组并返回。这个数组包含了所有活动线程的名称。 stopThread 函数用于尝试终止指定名称的线程。它
信息发布软件苹果IOS配置读写怎么实现的呢?
// 创建一个单选按钮组,用于管理性别选择的单选按钮let rg = new RadioButtonGroup();// 从配置中获取性别值,如果配置中没有性别值,则默认为空字符串let sexvalue = config.getConfig("sex", "");// 创建一个输入框,用于用户输入其他信息(例如用户名)let user = new Input();// 创建一个单选按钮,表示男性选项let nan = new RadioButton();nan.setText("男"); // 设置单选按钮的文本为“男”if (sexvalue === "男") { na
信息发布软件okHttp实例判断一下网址打不开的方法
// 创建 okHttp 实例var http = new okHttp();http.setHeader("User-Agent", "Mozilla/5.0");var url = "http://www.baidu.com/";try { printl("开始发送 GET 请求到: " + url); var result = http.get(url); printl("请求完成,响应对象: " + JSON.stringify(result)); // 打印完整的响应对象 if (result && result.code !== undefined) { printl("请求成功,状态码: " + result.code); if (result
信息发布软件AIWROK软件内容匹配 match()函数用来查找字符串中特定的字符
内容匹配 match()函数用来查找字符串中特定的字符function findSubstringInString(mainStr, pattern) { // 使用 match() 查找给定的模式 var result = mainStr.match(pattern); if (result !== null) { // 如果找到了匹配项,则返回匹配的结果 return "Match found: " + result[0]; } else { // 如果没有找到匹配项,则返回相应的消息 return "No match found."; }}// 定义字符串和要
信息发布软件&#127800;用AIWROK软件游戏选项执行不选择项随机执行怎么弄?
🌸用AIWROK软件游戏选项执行不选择项随机执行怎么弄?// 群号711841924function 游戏选项执行(易玩游戏选择) { // 随机选择一个元素 var 随机索引 = Math.floor(Math.random() * 易玩游戏选择.length); var 随机字符 = 易玩游戏选择[随机索引]; // 检查易玩游戏选择和随机字符的组合,执行相应游戏 if (易玩游戏选择.indexOf('美女泡泡大战') !== -1 && 随机字符 === '美女泡泡大战') { printl('
信息发布软件实用型多线程脚本运行20秒后停止
本帖最后由 信息发布软件 于 2025-5-15 06:28 编辑 var threads = [];function 计划任务(函数, 运行时间){    var t = new thread();    threads.push(t);    t.runJsCode( () => {        函数();    }, "计划任务")    sleep.second(运行时间);    t.stop();}function 脚本1(){    while(true){     &n
信息发布软件分享苹果UI里的AIWROK一个完整的界面
分享苹果UI里的AIWROK一个完整的界面// 群号711841924// 创建 TabViewvar tab = new TabView();// 设置标签页标题tab.setTitles(["首页", "第二页", "第三页", "第四页"]);// 显示 TabView,并在加载完成后执行回调函数tab.show(() => { printl("TabView 显示完成"); // 添加每个标签页的视图 tab.addView(0, h1()); // 首页 tab.addView(1, h2()); // 第二页 tab.addView(2, h3()); // 第三页 tab.addView(3,
信息发布软件AIWROK软件手机短信采集按需采集
/* 这个是获取手机短信的例子, 最近很多人用AIWORK怎么获取短信验证码,这样就不用去打开,然后一点一点的采集了。 其实AIwork是有很便捷的方式进验证码采集的,比如下面这段,按时间排序的短信验证码,这样就可以采集出验证码, 并且可以全部输入数字出来,有哪位朋友需要这段代码的请加群或是加我Q获取这段现成的代码。 下面是AIWORK演示代码操作:*/// 定义一个函数,用于读取最新的短信function readLatestSms() { //
信息发布软件HID键鼠其它功能设备如关充电开充电息屏亮屏
hid.keyPress(0,keycode.A());//在光标后面输入aa//方法1hid.keyPress(0,keycode.Enter());//亮屏//方法2hid.keyPress(0,0x07);//唤醒屏亮屏hid.keyPress(0,0x66);//息屏,关屏键盘设备Android 支持各种键盘设备,包括特殊功能小键盘(音量和电源控制),紧凑型嵌入式 QWERTY 键盘和全能型 PC 式外接键盘。本文档仅介绍物理键盘。有关软键盘(输入法编辑器)的信息,请参阅 Android SDK。键盘分类只要满足以下任一条件,输入设备即
信息发布软件AIWROK软件定义手势路径构造函数
AIWROK软件定义手势路径构造函数// 定义手势路径构造函数function GesturePath() { this.points = []; this.duration = 0;}// 设置持续时间的方法GesturePath.prototype.setDurTime = function(duration) { this.duration = duration;};// 添加点的方法GesturePath.prototype.addPoint = function(x, y) { this.points.push({ x: x, y: y });};// 定义多手指手势构造函数function MultiFingerGesture() { this.fing
信息发布软件用AIWROK软件排除打叉关闭区域并让它点击我想点的关闭怎么弄?
function 点击区域跳过检测(left, top, right, bottom) { var leftPercent = left; var topPercent = top; var rightPercent = right; var bottomPercent = bottom; // 获取屏幕的宽度和高度 var screenWidth = screen.getScreenWidth(); var screenHeight = screen.getScreenHeight(); // 计算矩形区域的坐标 var x1 = screenWidth * leftPercent; var y1 = screenHeight * topPercent; var x2
群发软件AIWROK软件生成随机时间函数妙用技术方法
/** * 生成随机时间函数 * @returns {string} 格式为HH:MM:SS的随机时间字符串 */function 随机时间() { // 生成随机小时、分钟和秒数 var hours = Math.floor(Math.random() * 24); var minutes = Math.floor(Math.random() * 60); var seconds = Math.floor(Math.random() * 60); // 格式化时间为两位数 hours = hours < 10 ? '0' + hours : hours; minutes = minutes < 10 ? '0' + minutes : minutes;
群发软件AIWROK软件如何使用webview 实现 h5界面ui
var web = new WebView()web.show();web.loadHtml(`<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>WKWebView JS to Swift</title> <style> body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; padding: 40px; background-color: #f2f2f7; text-align: center; } button {
群发软件AIWROK软件如何训练自己的数据集
通用yolo模型aiwork平台提供了通用yolov5插件,可以自行下载开源训练库或者把你已经训练好的yolov5模型转成.tflite格式即可使用调用案例:复制var yolo=new yoloV5(); //可以自己配置是否gpu加速和int8量化 yolo.loadTFMode("/插件/fp16_320.tflite","/插件/YoloV5.txt",320,false,false,false); //或者简写 //yolo.loadTFMode("/插件/fp16_320.tflite","/插件/YoloV5.txt",640); //本地图片识别 var img=new image().readT
群发软件AIWROK常用的随机位置范围点击随机拖动
/* * 随机位置点击函数 * @param {number} x - 点击位置的百分比 X 坐标 * @param {number} y - 点击位置的百分比 Y 坐标 * @param {number} x范围 - X 坐标的随机范围 * @param {number} y范围 - Y 坐标的随机范围 */function 随机位置点击(x, y, x范围, y范围) { // 将百分比坐标转成真实坐标 var x1 = screen.percentToWidth(x); var y1 = screen.percentToHeight(y); // 在指定范围内生成新的随机坐标 x1 = ran
群发软件AIWROK软件FTP完整例子自动链接可以上传可以下载
AIWROK软件FTP完整例子自动链接可以上传可以下载/* 欢迎使用AiWork安卓自动化IDE qq群: 711841924 */// 加载FTP库rhino.loadDex(project.getResourcesPath() + "ftp.dex");importClass(org.apache.commons.net.ftp.FTP);importClass(org.apache.commons.net.ftp.FTPClient);importPackage(java.io);// FTP配置参数var ftpHost = "154.201.80.249";var ftpPort = 21;var username = "rtyerye";var password = "8AafKDs4KhMDR3yy
群发软件AIWROK真正能包打天下的三种查找随机方法
AIWROK真正能包打天下的三种查找随机方法// 图片文字识别相关方法// 使用opencv的OCR进行文字识别并随机点击function 找字随机点击() { var ocr = opencv.OCREx('今日头条极速版8.cv'); if(!ocr) return; var target = ocr.findIncludeText('今日头条极速版'); if(target) { var rect = target.rect; var screenWidth = screen.getScreenWidth(); var screenHeight = screen.getScreenHeight
群发软件AIWROK软件技巧分享图片二值化封装使用
AIWROK软件技巧分享图片二值化封装使用// 引入 Android 和 OpenCV 的类importPackage(org.opencv.core);importPackage(org.opencv.imgproc);importPackage(org.opencv.android);importClass(android.graphics.Bitmap);function screenshotAndBinarize(width, height, quality, threshold1, threshold2) { // 进行屏幕截图 var bitmap = screen.screenShot(width, height, quality).getBitmap(); // 将 Bitmap 转换为 Open
群发软件AIWROK软件安卓自动化auto__小结方法总汇集
第一个:back按下回退键auto.back();这个代码示例展示了如何调用一个名为 back() 的函数来返回上一页或执行某种“返回”操作。例子:function demoExample() { // 打印信息表明即将返回上一页 printl("即将返回上一页"); // 使用 auto.back() 返回上一页 auto.back(); } // 调用示例函数 demoExample();代码说明:function demoExample() { ... }:定义了一个名为 demoExample 的函数,该函数没有参数。printl("
群发软件floatUI自定义极度美化悬浮窗
/* 欢迎使用AiWork安卓自动化IDE 帮助文档: http://help.autoapp.net.cn 官方地址: www.aiwork24.com qq群: 743723025*/ // 定义一个名为悬浮窗的构造函数function 悬浮窗() {}// 创建一个悬浮窗实例var float = new 悬浮窗()// 定义一个全局变量用于控制停止状态var 全局_停止 = false// 为悬浮窗构造函数的原型添加create方法,用于创建悬浮窗界面悬浮窗.prototype.create = function () { // 创建一个floatUI实例,f
群发软件AIWROK软件agent代理模式ADB方法集合
第一个例子:开启代理模式判断agent.start()agent.start() 函数用于开启代理模式,需 root 权限,无需参数。此函数执行后会返回一个布尔值:如果成功返回 true,否则返回 false。下面是一个可能的使用例子:// 尝试启动代理模式 let result =agent.start(); printl(result); if (result) { console.log("代理启动成功!"); } else { console.log("代理启动失败,请检查是否具有root权限。"); }此代码尝试启动代理模式,
群发软件用在AIWORK软件代码中的实用符号分类整理
var 任务进行中 = true;var 倒计时已启动 = false;var 任务三已执行 = false;var 任务一定时器, 任务二定时器;function 任务一() { print.log("🚀▶️ 准备执行任务一"); // 使用您的环境专用输出 function 执行任务一() { if (!任务进行中) { clearTimeout(任务一定时器); return; } print.log("✅🔁 任务一执行中..."); 任务一定时器 =
群发软件AIWROK多线程方法UI线程对象方法
AIWROK多线程方法UI线程对象方法名称new thread()作用多线程方法权限root键鼠无障碍语法new thread()参数类型是/否说明线程对象对象是创建一个线程对象返回类型是/否说明对象/对象成功对象失败函数线程对象方法类型是/否说明.runJsCode(fun, name )函数/字符是fun 执行的函数name 执行线程名称返回类型是/否说明无无成功失败文件线程对象方法类型是/否说明. runJsFile (js, name )字符是js 执行的js文件name 执行线程名称返回类型
群发软件AIWROK软件常用数组方法小结汇集方法
/* 官方交流群号711841924 *//* 安卓手机 Android 和Rhino1.7.13 和ES5 JavaScript环境 */var 数组 = {};// 1. 元素升序(小到大)数组.元素升序 = function(arr) { try { if (!Array.isArray(arr)) throw new Error("需要数组"); return arr.slice().sort(function(a,b){return a-b;}); } catch(e) { printl("[错误] "+e.message); return null; }};// 2. 元素降序(大到小) 数组.元素降
群发软件AIWROK软件多线程thread1.runJsFile例子
本帖最后由 群发软件 于 2025-4-15 09:24 编辑 T = time.nowStamp();// 正确启动两个线程(线程名必须不同!)var thread1 = new thread(); // 线程对象1var thread2 = new thread(); // 线程对象2thread1.runJsFile('线程1.js', 'worker1'); // 线程名用"worker1" thread2.runJsFile('线程2.js', 'worker2'); // 线程名用"worker2"// 监控循环(10秒后停止线程1)while (true) { printl("正常运行"); sleep.millisecon
群发软件AIWROK软件支持的Java标准库和Android SDK库
特别是针对Android开发时导入的各种类。这些类分别属于Java标准库和Android SDK库,用于处理不同的功能需求。下面是对这些代码的详细说明://java类//importClass(java.math.Session);//importClass(java.math.Transport);//importClass(java.math.BigInteger);//importClass(java.math.internet.MimeMessage);importClass(java.sql.Connection);importClass(java.sql.DriverManager);importClass(java.sql.ResultSet);importClass
群发软件AIWROK软件thread使用全局变量控制线程状态
AIWROK软件thread使用全局变量控制线程状态// 安卓手机 Android 和Rhino1.7.13 和ES5 JavaScript环境// Android 环境 Rhinoceros 引擎与 JavaScript 的多线程示例{ // 使用全局变量控制线程状态 var shouldStop = false; // 创建一个 Java 的 Thread 对象 var runnable = new java.lang.Runnable({ run: function() { var count = 0; while (!shouldStop) {
群发软件AIWROK软件HID点击方法的方法集合小结
// 点击坐标// boolean click(int x, int y) 返回值: boolean// 参数: int x: 横坐标 int y: 纵坐标// 案例: hid.click(0, 0)hid.click(0, 0)// 点击百分比坐标// void clickPercent(double arg0, double arg1) 返回值: void// 参数: double arg0: 横坐标 double arg1: 纵坐标// 案例: hid.clickPercent(0, 0)hid.clickPercent(0, 0)// 连续点击// boolean clicks(int x, int y, int times, int delay) 返回值: boolean// 参数: in
群发软件AIWROK软件常用OKHTTP方法小结汇集
群发软件AIWROK软件字符方法集合小结
//字符.分割字符/** * 字符串分割工具模块 - 修正版 * 最后更新:2025-04-02 */var 字符 = { /** * 字符串分割方法 * @param {string} str 要分割的字符串 * @param {string} divide 分隔符 * @returns {Array|null} 分割后的数组或null(错误时) */ 分割字符: function(str, divide) { try { if (typeof str !== 'string') return null; if (typeof divide !== 'string')
群发软件AIWROK软件数学方法集合小结
/** * //适用本文档ES5系统安卓 JavaScript引擎Rhino * 数学方法全集 * 运行环境: Android + Rhino 1.7.13 + ES5 */// 定义数学对象var 数学 = {};/** * 二为底的e的对数 * @setting ROOT 代理激活 无障碍 键鼠硬件 * @returns {number} 返回二为底的e的对数 */数学.__二为底的e的对数 = function() { return Math.LOG2E;};/** * 二的平方根 * @setting ROOT 代理激活 无障碍 键鼠硬件 * @returns {number} 返回二的平方根 */数
群发软件AIWROK软件应用方法集合小结
// 应用管理工具集const 应用 = {};// 模拟日志函数const LOG = { info: function(msg) { printl(' ' + msg); }, err: function(msg) { printl('[ERROR] ' + msg); }};/** * 停止当前脚本 */应用.停止脚本 = function () { try { LOG.info("尝试停止脚本..."); if (typeof runtime !== 'undefined' && runtime.exit) { LOG.info("使用runtime.exit()停止脚本"); runtime.exit();
群发软件AIWROK软件常见正则方法集合小结
//适用本文档ES5系统安卓 JavaScript引擎Rhinoconst 字符 = { /** * 匹配查找字符串中的内容 * @param {string} str 需要查找的字符串 * @param {string|RegExp} searchvalue 需要查找的字符串或正则表达式 * @returns {Array|null} 成功:返回包含匹配结果的数组,失败:返回null * @example * // 示例1:查找字符串 * var str = "How are you doing you today?"; * var fgh = 字符.匹配查找(str
群发软件AIWORK类语聊智能聊天机器人带意图识别例子演示
类语聊智能聊天机器人带意图识别例子演示 飞桨智能聊天机器人集成指南示例代码转换为实际可用的智能聊天机器人应用。1. 代码结构说明当前代码包含两个主要模块:HTTP工具模块提供基础的HTTP请求功能,用于与飞桨API进行通信: [*]HTTP工具.创建请求() - 创建HTTP请求实例 [*]HTTP工具.设置请求头(http, headers) - 设置HTTP请求头 [*]HTTP工具.POST请求(url, data, headers) - 发送POST请求并处理响应 智能聊天机器人模块实现
群发软件AIWROK软件时间方法集合小结
AIWROK软件时间方法集合小结//适用本文档ES5系统安卓 JavaScript引擎Rhinoconst 时间 = { /** * 获取当前时间戳 * @returns {number} 返回当前的时间戳(毫秒) * @example * var timestamp = 时间.当前时间戳(); * printl(timestamp); // 输出类似: 1677649423000 */ 当前时间戳: function() { return Date.now(); }, /** * 格式化时间为指定格式 * @param {Date|number|str
群发软件IOS苹果TabView视图和Horizontal水平布局控件
IOS苹果TabView视图和Horizontal水平布局控件 导航条视图模式可以支持多个页面标签切换案例:创建TAB视图显示视图function show(function fun)参数 func :ui显示以后调用的方法设置tabtab.setTitles(["首页", "关于", "我的"])//关闭视图tab.dismiss()添加子视图tab.addView(tabindex,view)参数tabindex:tab的序号从0开始参数 view:子视图案例Horizontal水平布局控件用于横向放置多个控件案例:
群发软件苹果熟悉layout线性布局和IOS苹果View视图
本帖最后由 群发软件 于 2025-3-27 07:34 编辑 线性布局是垂直或者水平布局类似网格 水平布局 比如就是一行可以放多个控件文本框:按钮:单选框:复选框类似上面这样一行可以放多个控件的就是水平布局垂直布局就是一行只能放一个元素文本框按钮单选复选混合布局,就是水平和垂直嵌套就可以实现复杂的界面例如一个登录界面,先创建一个垂直布局 ,每个垂直布局的每一行再放一个水平布局用户名————————密码————————
群发软件AIWROK软件生成椭圆曲线手势
这段代码定义了一些用于生成和执行贝塞尔曲线手势的函数。具体来说,代码分为以下几个部分: 1随机数生成函数: 这个函数 random(a, b) 使用 rand.randNumber(a, b) 来生成一个在 a 到 b 之间的随机数。不过,在完整的代码中,rand.randNumber 需要是一个已定义的函数或库方法。 2椭圆曲线点生成器: 函数 generateEllipticPoints(a, b, xStart, xEnd, step) 用于根据椭圆曲线的参数 a 和 b,在指定的 x 范围内生成一系列的点。
群发软件AIWROK软件屏幕自动化操作方法汇集
代码的简要说明和一些注意事项: [*]MLKitOcr 文字识别: [*]代码中使用了 MLKitOcr 方法来进行文字识别。'zhs' 和 'zh' 都是中文的识别代码,但通常使用 'zh'。 [*]识别结果通过 getAllString() 方法获取,然后打印出来。 [*]使用完截图后,记得调用 recycle() 方法来释放资源。 [*]截图并压缩: [*]使用 screenShot 方法可以指定截图的尺寸和压缩质量。 [*]检查截图是否成功后再进行后续操作。 [*]计算面
群发软件苹果IOS在IDE中配置AIWork直播插件的详细图文教程
在IDE中配置AIWork直播插件的详细图文教程以下是关于在集成开发环境(IDE)中配置AIWork直播插件的详细步骤说明,帮助您顺利完成设置。第一步:安装IDE1. 下载并安装IDE· 下载安装包:访问官方网站或可信来源下载最新版本的IDE安装包。· 安装步骤:a. 双击安装包文件,按照提示完成安装。b. 安装完成后,重启计算机以确保环境变量生效。· 验证安装:打开IDE,检查是否能正常运行,确保所有组
群发软件AIwok软件苹果IOS手机初始化设置和IOS HTTP接口
配置要求:IDE AIWORK >3.25手机 >= iphone6sIOS版本 >=IOS15(ios15不支持画中画日志,16以上支持)苹果HID硬件必须设置:自动息屏:必须关闭,不然截屏权限会自动关闭蓝牙:必须打开辅助触控:必须打开 (设置->辅助功能->触控->辅助触控->打开)软件安装1.下载tf并安装https://testflight.apple.com/join/1sVURYPb或者扫二维码下载 安装完tf以后 再安装aiwork初始化第一步 硬件连接手机,选择硬件第二步 开启辅助触
群发软件AIWROK软件多线程协作示例代码解析
AIWROK软件多线程协作示例代码解析 详细说明 [*]线程对象创建 [*]使用new thread()创建两个独立线程对象 [*]dataThread用于数据处理,logThread用于日志记录 [*]每个线程有独立的执行上下文和生命周期 [*]数据生成线程 [*]通过runJsCode方法执行匿名函数 [*]使用for循环生成1-5的序列数据 [*]java.lang.Thread.sleep(1000)实现1秒间隔(Rhino引擎特性) [*]线程命名为"数据线程"便于调试识别 [*]日志记录线程
群发软件AiWork软件下载蓝奏云OCR文件到文件夹
这段代码是一个用于从蓝奏云(Lanzou)下载文件的自动化工具脚本,主要基于JavaScript编写,并且是在一个安卓自动化环境中运行的,例如使用AiWork这样的自动化IDE。代码中定义了一个主要的函数downloadLanzouFile,它接受三个参数:文件的URL地址url,保存文件的路径saveFilePath,以及最大重试次数maxRetries(如果未提供,函数默认设置为5次)。代码的主要功能和步骤如下: [*]初始化和配置: [*]定义了蓝奏云的备用域
群发软件setTimeout__方法异步延迟加载函数
这段代码定义了一个简单的任务链,模拟了一个从数据查询到数据处理再到数据保存的流程。代码中使用了runTime.setTimeout来模拟每个任务的执行耗时。以下是代码的详细说明: [*]taskOne函数:这是第一个任务,负责开始数据查询。 [*]使用printl函数打印一条消息,表示任务一即将开始。 [*]使用runTime.setTimeout函数来模拟数据查询的过程,设置的延迟时间为3秒(3000毫秒)。 [*]在3秒后,生成一个模拟数据字符串"查
群发软件floatUI悬浮窗 实用示例合集
floatUI悬浮窗 实用示例合集如何使用 floatUI 创建不同的 UI 组件,并为它们设置点击事件。每个示例都展示了不同的 UI 布局和事件处理逻辑。示例 1: 创建一个带有多个按钮的垂直布局,并为每个按钮设置不同的点击事件var f1 = new floatUI(); f1.loadSXML(` <vertical> <button text="按钮1" id="button1"/> <button text="按钮2" id="button2"/> <button text="按钮3"
群发软件AIWROK软件找图__方法小汇集
方法一:定义图像查找函数 [*]功能:在指定的查找区域内查找与模板图像相似度达到设定值的目标,并自动点击该目标的中心位置。 [*]参数: [*]searchRegion:查找区域的相对坐标,格式为 [x1, y1, x2, y2],其中 (x1, y1) 是左上角坐标,(x2, y2) 是右下角坐标。 [*]templateImage:模板图像的Base64编码字符串。 [*]similarity:相似度阈值,用于判断是否匹配。 [*]流程: [*]获取屏幕截图并转换为Mat格
群发软件awirok软件找色__方法小汇集
群发软件AIWORK 软件全功能 OCR 查找区域功能代码示例
    // 第一个示例:获取屏幕截图并进行 OCR 文字识别(简体中文)var img1 = screen.screenShotFull();var ocr1 = img1.MLKitOcr('zhs');var text1 = ocr1.getAllString();printl(text1);img1.recycle();/*说明:- 这是一个最基本的 OCR 示例。- 使用 MLKitOcr 方法通过简体中文词库识别截图中的文字。- 最终输出识别到的全文本信息。*/// 第二个示例:指定区域内的 OCR 文字识别(中文)var img2 = screen.s
群发软件AiWROK软件里的OpenCV图片分辨率压缩和质量压缩
// 导入必要的Android和OpenCV类importClass(android.graphics.Bitmap);importClass(java.io.File);importClass(org.opencv.core.Core);importClass(org.opencv.core.Mat);importClass(org.opencv.core.Size);importClass(org.opencv.imgproc.Imgproc);// 全屏截图var img = screen.screenShotFull();if (img.isNull()) {printl("截图失败");exit();}// 原始图片信息var originalPath = "/sdcard/original.jpg";img.save(originalP
群发软件定时任务示例:使用 setInterval 和 clearInterval 实现多种功能
1. 倒计时功能var countdownTime = 10; var countdownInterval; function updateCountdown() { if (countdownTime > 0) { console.log("剩余时间: " + countdownTime + "秒"); countdownTime--; } else { clearInterval(countdownInterval); console.log("倒计时结束!"); } }用法启动:startCountdown()停止:stopCountdown()应用场景游戏倒计时、会议提醒、考试计时、烹饪计时等。2. 实时时
群发软件AIWORK软件将数组↔互转字符串
AIWORK软件将数组↔互转字符串1.方法将数组转换为字符串// 定义函数function myFunction() {// 定义一个包含水果名称的数组var fruits = ["Banana", "Orange", "Apple", "Mango"];console.log("原始数组: ", fruits);// 使用 toString 方法将数组转换为字符串var str = fruits.toString();console.log("转换后的字符串: ", str);// 返回转换后的字符串return str;}// 调用函数var result = myFunction();2. 将数组互转字符串/

QQ|( 京ICP备09078825号 )

本网站信息发布软件,是可以发布论坛,发送信息到各大博客,各大b2b软件自动发布,好不夸张的说:只要手工能发在电脑打开IE能发的网站,用这个宣传软件就可以仿制动作,进行推送发到您想发送的B2B网站或是信息发布平台上,不管是后台,还是前台,都可以进行最方便的广告发布,这个广告发布软件,可以按月购买,还可以试用软件,对网站的验证码也可以完全自动对信息发布,让客户自动找上门,使企业轻松实现b2b发布,这个信息发布软件,均是本站原创正版开发,拥有正版的血统,想要新功能,欢迎提意见给我,一好的分类信息群发软件在手,舍我其谁。QQ896757558

GMT+8, 2025-6-16 19:34 , Processed in 0.201783 second(s), 56 queries .

宣传软件--信息发布软件--b2b软件广告发布软件

快速回复 返回顶部 返回列表