jmeter the md5 encryption

1, may be added in jmeter md5 encrypted code in the bean shell

package cn.wk.jl.util;

import java.security.MessageDigest;


public class Str2MD5 {
    /***
     * MD5加码 生成32位md5码
     */
    public static String string2MD5(String inStr){
        MessageDigest md5 = null;
        try{
            md5 = MessageDigest.getInstance("MD5");
        }catch (Exception e){
            System.out.println(e.toString());
            e.printStackTrace();
            return "";
        }
        char[] charArray = inStr.toCharArray();
        byte[] byteArray = new byte[charArray.length];

        for (int i = 0; i < charArray.length; i++)
            byteArray[i] = (byte) charArray[i];
        byte[] md5Bytes = md5.digest(byteArray);
        StringBuffer hexValue = new StringBuffer();
        for (int i = 0; i < md5Bytes.length; i++){
            int val = ((int) md5Bytes[i]) & 0xff;
            if (val < 16)
                hexValue.append("0");
            hexValue.append(Integer.toHexString(val));
        }
        return hexValue.toString();

    }

}


String user = "ddwt_adam02";
String pwd = "123qwe";
String data1 = user.concat(pwd);
log.info("原始的 "+data1);
vars.put("var1",data1);
Str2MD5 d = new Str2MD5();
String d2 = d.string2MD5(data1);
log.info("---------"+d2);
vars.put("var2",d2);
        

2, set up encryption, you can directly use the md5 encrypted content

 

About the cookie, session, variable shared among threads, regular expressions reference:

https://blog.csdn.net/xiaoxiao_renhe/article/details/81062324

https://blog.csdn.net/xiaoxiao_renhe/article/details/80268205

https://blog.csdn.net/xiaoxiao_renhe/article/details/78894454

Add two methods between threads cookie and cookie sharing jmeter manual:

https://mp.csdn.net/postedit/81108973

Automatic redirection and follow the redirect difference:

https://blog.csdn.net/XiaoXiao_RenHe/article/details/80982426

jmeter test Export excel:

https://blog.csdn.net/XiaoXiao_RenHe/article/details/76548937

In parametric jmeter jdbc:

https://mp.csdn.net/postedit/75258451

In response jmeter json:

https://mp.csdn.net/postedit/79037594

Published 98 original articles · won praise 39 · views 210 000 +

Guess you like

Origin blog.csdn.net/XiaoXiao_RenHe/article/details/102797706