常用的几种加密方式
内置函数_MD5加密
参数说明:
String to calculate MD5 hash(必填):要加密的字符串
Name of variable in which to store the result (optional):存储结果的变量的名称
1、使用${__MD5(13300001111,phone)}进行MD5加密,加密结果为32位小写
2、使用KaTeX parse error: Expected group after '_' at position 2: {_̲_uppercase(,)}可…{__uppercase(${__MD5(13300001111,phone)},)}
内置函数_digest 加密
参数说明:
Digest algorithm(必填):加密算法,支持:MD2、MD5、SHA-1、SHA-224、SHA-256、SHA-384、SHA-512
String to be hashed(必填):需要加密的字符串
Salt to be used for hashing (optional):用于加密的盐
Upper case result, defaults to false (optional):大写结果,默认为false
Name of variable in which to store the result (optional):存储结果的变量的名称
使用实例:${__digest(MD5,13300001111,true,)},对字符串进行MD5加密,并将加密结果转为大写。
内置DigestUtils方法加密
在Jmeter中添加BeanShell Sampler,使用如下代码进行加密。
// md5
import org.apache.commons.codec.digest.DigestUtils;
String str = "${token}"