Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Jmeter completes the API request parameters for md5 encryption

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Baidu search: Xiaoqiang Test Brand

Kick talk shows, entertain technology and systematize fragments, all in Litchi FM (http://www.lizhi.fm/200893)

"Xiaoqiang Software testing Crazy handout-performance and Automation" has been published and can be purchased by all online stores.

It is not difficult for jmeter to complete the interface test. For basic use, you can watch my video: http://edu.51cto.com/course/course_id-2324.html

But sometimes the parameters we request may need to be encrypted, for example, the password in the login interface may need to be encrypted by md5.

The first method:

This method is relatively simple, jmeter has a built-in function of md5, which can be used directly. Parameter username is the user name, which is entered normally, and password is the password encrypted by md5.

If you don't have this function, install it, as shown in the figure

The second method:

Some programming skills are required, which can be done with beanshell. The general steps are as follows:

1. The algorithm for exporting md5 is jar package, which can be completed with the help of the developer.

2. Copy the jar package to the lib/ext file directory of jmeter

3. Create a new beanshell sampler in jmeter and write code

Import hehe.md5.Str2MD5;// package name, not known for developer

String res = newStr2MD5 () .MD5 ("xiaoqiang"); / / new an object and call the method to get the encrypted return

System.out.println (res); / / print the result

Vars.put ("md5", res.toString ()); / / Save the encrypted data into the variable md5 for use in jmeter

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report