JMeter Beanshell
Jmeter实现对字符串加密
package com.wjika.test; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class mymd5 { public static String getMd5(String plainText) { try{ MessageDigest md = MessageDigest.getInstance("MD5"); md.update(plainText.getBytes()); byte b[] = md.digest(); int i; StringBuffer buf = new StringBuffer(""); for (int offset = 0; offset < b.length; offset++) { i = b[offset]; if (i < 0) i += 256; if (i < 16) buf.append("0"); buf.append(Integer.toHexString(i)); } //32位加密 return buf.toString(); // 16位的加密 //return buf.toString().substring(8, 24); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); return null; } } }
生成Jar包放入jmeterlib目录中。
相关推荐
singebogo 2020-09-23
84226432 2020-08-19
Cherishyuu 2020-08-19
TesterJingel 2020-08-18
登峰小蚁 2020-08-01
Cherishyuu 2020-07-28
84226432 2020-07-05
89421478 2020-07-05
HappinessCat 2020-07-05
TesterJingel 2020-06-28
singebogo 2020-06-27
TesterJingel 2020-06-26
Seleton 2020-06-26
xinjing0 2020-06-25
Cherishyuu 2020-06-25