JMeter performs function assistant MD5 encryption

JMeter function assistant MD5 encryption
JMeter function assistant provides the method of MD5 encryption, as shown in the figure, we encrypt the content "123456", and we can see that the encryption is successful.
insert image description here
Let's take a look at the request parameters of the project interface.
insert image description here
This is an authentication interface, and we can see that the requested parameters include: username, channel code, time (passed in the form of a timestamp), and sign encryption.

  • First, user_id I randomly extract a user name as a parameter value from the previous interface through the regular expression extractor
  • Timestamp, here we use the function provided in the JMeter function assistant ${__time(,)} to generate a timestamp. There is a small detail here, that is, in ${__time(,)}the rear, I customized a variable. now_time,
    The purpose of the custom variable here is mainly to provide the timestamp provided in the encryption below, which needs to be consistent with the current timestamp. Otherwise, every ${__time(,)}time the timestamp function is called, a new timestamp will be randomly generated, which will cause time inconsistency during encryption and authentication, and the backend verification will seriously fail.
  • sign authentication: the encryption rule here is user_id + PCode + timestampto perform MD5 encryption

Then it is very simple, we only need to splice the three sets of data, the obtained data is ${user_id}testfan${now_time}, and then we use the MD5 encryption function to encrypt the data. Get the following string of function strings.

1|"sign": "${__MD5(${phoneNum}test${now_time},)}"

Next, we check the request data in the result tree, and we can see that the encryption has been successful~insert image description here

Guess you like

Origin blog.csdn.net/weixin_42274846/article/details/128165097