CN109788349B - Method and related device for detecting computing capability - Google Patents

Method and related device for detecting computing capability Download PDF

Info

Publication number
CN109788349B
CN109788349B CN201910038559.6A CN201910038559A CN109788349B CN 109788349 B CN109788349 B CN 109788349B CN 201910038559 A CN201910038559 A CN 201910038559A CN 109788349 B CN109788349 B CN 109788349B
Authority
CN
China
Prior art keywords
client
message
platform server
computing
live broadcast
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910038559.6A
Other languages
Chinese (zh)
Other versions
CN109788349A (en
Inventor
周志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201910038559.6A priority Critical patent/CN109788349B/en
Publication of CN109788349A publication Critical patent/CN109788349A/en
Application granted granted Critical
Publication of CN109788349B publication Critical patent/CN109788349B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Power Sources (AREA)

Abstract

The embodiment of the application discloses a method and a related device for detecting computing capacity, which are used for improving the safety and efficiency of communication between a server and a client. The method in the embodiment of the application comprises the following steps: the method comprises the steps that a live broadcast platform server sends a first message to a client, wherein the first message is used for indicating the computing capacity of a detection client; the method comprises the steps that a live broadcast platform server receives a first response message which is sent by a client and responds to a first message, and a calculation result of client computing power detection is calculated by the client according to the first message in a preset mode; the live broadcast platform server obtains a platform computing power detection calculation result according to the first message and the client serial number in a preset mode; if the client computing power detection calculation result is consistent with the platform computing power detection calculation result, judging whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result; if so, the live broadcast platform server determines and stores the computing power of the client according to the equipment identification information of the client and the total computing consumed duration, and the computing power of the client is inversely related to the total computing consumed duration.

Description

Method and related device for detecting computing capability
Technical Field
The present application relates to the field of live broadcast platforms, and in particular, to a method for detecting computing power and a related apparatus.
Background
With the increasing popularity and development of networks, online live broadcasting becomes more and more popular with users. For some live broadcast platforms, all the ways of obtaining profits through the number of people who are online at the same time can be utilized by hackers, and the hackers obtain the corresponding profits by forging false clients, so that the benefits of manufacturers are damaged.
In view of this, in the prior art, the hacker cracking threshold is raised by encrypting the protocol. However, since the client is distributed to all the users' devices, a hacker can always obtain the cracking method through reverse analysis for a large amount of time. There is therefore a need for a more secure and efficient authentication method that makes it more difficult for hackers to gain even if the authentication functionality of the client is known.
Disclosure of Invention
The embodiment of the application provides a method and a related device for detecting computing capacity, which are used for improving the safety and efficiency of communication between a server and a client.
A first aspect of an embodiment of the present application provides a method for detecting computing power, including: a live broadcast platform server sends a first message to a client, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server; the live broadcast platform server receives a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client by the live broadcast platform server; the live broadcast platform server obtains a platform computing power detection calculation result according to the first message and the client serial number in the preset mode; the live broadcast platform server judges whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not; if yes, the live broadcast platform server determines and stores the computing capacity of the client according to the equipment identification information of the client and the total computing consumption duration, and the computing capacity of the client is inversely related to the total computing consumption duration.
In a possible embodiment, the obtaining, by the live broadcast platform server according to the first message and the client serial number and according to the preset mode, a platform computing power detection calculation result includes: the live broadcast platform server carries out HASH operation according to the client serial number, the timestamp information, the equipment identification information of the client, the current room number and the user identification information to obtain a first key; the live broadcast platform server performs HASH operation according to the random data to obtain a second key; and the live broadcast platform server obtains a target key according to the first key and the second key, and performs N times of Blowfish encryption calculation according to the target key to obtain a platform calculation force detection calculation result.
In a possible embodiment, the performing, by the live broadcast platform server, a HASH operation according to the client serial number, the timestamp information, the device identification information of the client, the current room number, and the user identification information to obtain the first key includes: the first key is obtained in the following manner: key1 ═ md5.create (sessionid + UserId + DeviceID + roomid + TimeStamp); the Key1 is used to represent the first Key, the sessionid is used to represent the serial number of the client, the UserId is used to represent the user identification information, the DeviceID is used to represent the device identification information of the client, the roomid is used to represent the current room number, the TimeStamp is used to represent the TimeStamp information, and the md5.create () is used to represent the computing interface of the HASH algorithm md5.
In one possible embodiment, the receiving, by the live platform server, a first response message sent by the client in response to the first message includes: the live broadcast platform server creates an instance object of a message parsing class DataDecoder; and the live broadcast platform server analyzes the first response message according to the message analysis type DataDecoder to obtain the type of the first response message, the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection through analysis.
A second aspect of an embodiment of the present application provides a method for detecting computing power, including: a client creates a detection thread, wherein the detection thread is used for realizing the detection of the computing capacity of the client; the client receives a first message sent by the live broadcast platform server, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server; based on the detection thread, the client obtains a total calculation consumed duration and a client calculation force detection calculation result according to the first message in a preset mode; and responding to the first message, the client sends a first response message to the live broadcast platform server, wherein the first response message comprises the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection.
In one possible embodiment, the client creating a probe thread comprises: the client creates the probe thread by calling a system function pthread _ create that includes a pointer to a thread identifier, a thread attribute, an address of the probe thread, and an execution parameter to run the probe thread.
A third aspect of an embodiment of the present application provides a live platform server, including: the receiving and sending unit is used for sending a first message to a client, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server; receiving a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client by the live broadcast platform server; the computing unit is used for obtaining a platform computing power detection computing result according to the first message and the client serial number in the preset mode; the judging unit is used for judging whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not; and if so, determining and storing the computing capacity of the client according to the equipment identification information of the client and the total computing consumed duration, wherein the computing capacity of the client is negatively related to the total computing consumed duration.
A fourth aspect of an embodiment of the present application provides a client, including: the creating unit is used for creating a detection thread, and the detection thread is used for realizing the detection of the computing capacity of the client; the receiving and sending unit is used for receiving a first message sent by the live platform server, the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live platform server; based on the detection thread, the computing unit is used for obtaining a total computing consumption duration and a client computing power detection computing result according to the first message in a preset mode; and responding to the first message, wherein the transceiver unit is further configured to send a first response message to the live broadcast platform server, and the first response message includes the total calculation consumption duration, the device identification information of the client, and the client calculation power detection calculation result.
A fifth aspect of the present application provides an electronic device, which includes a memory and a processor, and is characterized in that the processor is configured to implement the steps of the manner of connecting voice to microphone according to any one of the above first aspects when executing a computer management program stored in the memory.
A sixth aspect of the present application provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to perform the method of the above-described aspects.
A seventh aspect of the present application provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the above aspects.
According to the technical scheme, the embodiment of the application has the following advantages: a live broadcast platform server sends a first message to a client, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server; the live broadcast platform server receives a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client by the live broadcast platform server; the live broadcast platform server obtains a platform computing power detection calculation result according to the first message and the client serial number in the preset mode; the live broadcast platform server judges whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not; if yes, the live broadcast platform server determines and stores the computing capacity of the client according to the equipment identification information of the client and the total computing consumption duration, and the computing capacity of the client is inversely related to the total computing consumption duration. In the embodiment of the application, the live broadcast platform server obtains the computing power of the client according to the total computing consumption time of the client, so that the live broadcast platform server can issue different verification modes according to different computing powers of the equipment, and the safety and efficiency of communication between the server and the client are improved.
Drawings
Fig. 1 is a flowchart of a method for detecting computing power according to an embodiment of the present disclosure;
fig. 2a is a schematic structural diagram of a possible live broadcast platform server according to an embodiment of the present disclosure;
fig. 2b is a schematic structural diagram of a possible client according to an embodiment of the present disclosure;
fig. 3a is a schematic diagram of a hardware structure of a possible electronic device according to an embodiment of the present disclosure;
fig. 3b is a schematic diagram of a hardware structure of another possible electronic device according to an embodiment of the present disclosure
FIG. 4a is a schematic diagram of a hardware structure of a possible computer-readable storage medium according to an embodiment of the present application;
fig. 4b is a schematic hardware structure diagram of another possible computer-readable storage medium according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a method and a related device for detecting computing capacity, which are used for improving the safety and efficiency of communication between a server and a client.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It will be appreciated that the computing capabilities of different devices are different, for example, for an iphoneX handset and for an iphone4 handset, the CPU performance of the devices is different, so the computing capabilities of the two devices are far apart, and when the server performs computing capability verification, i.e., computing capability verification, on the client, if the verification mode issued by the server is the same, the server needs to compute for the worse device for a long time, and the server can compute for the good device for a short time. Therefore, it is difficult for the server to select an appropriate computing model, which is conventionally obtained by obtaining the CPU model or device model of the device, but hackers can tamper with the computing capability of the device by obtaining the interface of the device model through hook. There is a need to provide a more reasonable and sophisticated algorithm that yields client computing power. In view of this, a set of algorithms is designed to examine the computing power of the client, so that the live broadcast platform server can issue different verification modes according to different computing powers of the device.
Referring to fig. 1, a flowchart of a method for detecting computing power according to an embodiment of the present application includes:
101. a live broadcast platform server negotiates an encryption algorithm with a client;
it should be noted that the whole scheme of the present application is a proof of the authenticity of a client, so that in the authentication process of the authenticity of the whole client, a set of algorithm needs to be selected to obtain different outputs based on different inputs, and meanwhile, the server can also perform authentication of the calculation result of the client, and it needs to be satisfied that the data length of the encrypted original data does not change, and meanwhile, the calculation duration needs to be relatively fast. In the embodiment of the application, a Blowfish encryption algorithm can be selected, the algorithm meets the conditions, and the algorithm can be used during subsequent calculation force certification by using a client. The calculation capacity proof here is that the server issues a piece of data to the client for continuous encryption, and the calculation capacity detection value of the client is obtained by the time consumed by the continuous encryption and the final encryption for a preset number of times, wherein the preset number of times can be 1000 times.
The verification and certification related to the live broadcast platform are mentioned in the application, so that the safety and the cracking threshold of the algorithm can be enhanced by using the related characteristics of the live broadcast platform. For security algorithms and security verifications, the more varied information can provide the security of the algorithms, and meanwhile, the calculation power detection is performed on different devices, even the calculation power detection is performed on some devices for many times, so that the calculation results are different in each detection, and meanwhile, the calculation results are different for each user. Firstly, after each client is started, the client logs in a live broadcast platform server, then the client establishes a long connection of a Transmission Control Protocol (TCP) to connect with a barrage server of a live broadcast platform, so as to receive and send a barrage, at this time, the server establishes a unique serial number, namely sessionid, for distinguishing different users, so as to distinguish the different users, and in the subsequent step, the serial number, namely sessionid, of each user also participates in calculation of computational power detection. In addition, for each device, there is a device identification information, i.e. device id unique to the device is used to indicate the device, so the device DeviceID can also be involved in the whole calculation process in this embodiment. For each user, when logging in the live broadcast platform, each user also has user identification information, namely userid, which is unique to the user. Moreover, when the user watches the live broadcast, a room number roomid must exist, so that the result of the whole detection measuring power is different every time the user enters different rooms, and the roomid also participates in the whole detection process of calculation. In order to ensure that the results are inconsistent when the client side is subjected to calculation force detection by the live broadcast platform server every time, so that the safety of the algorithm is improved, when the client side is allowed to detect by the live broadcast platform server every time, the server can carry a current live broadcast platform server, namely timestamp information is sent to the client side, so that the timestamp information can participate in the whole calculation process, meanwhile, in order to ensure the randomness of the calculation results, the live broadcast platform server can also generate a section of random data to be issued to the client side, and the client side can participate in the calculation of the whole calculation force detection.
Therefore, it can be known that the client computing power detection is based on sending detection data and calculation times by the live broadcast platform server, the client performs calculation according to the data sent by the live broadcast platform server to obtain a result, the client reports the result to the live broadcast platform server, and the live broadcast platform server can know the gradient corresponding to the computing power of the client. Thereby providing basic data for a subsequent client computing power verification model. The live broadcast platform server sends the data to the client and the live broadcast platform server after the calculation of the client is completed, and the client and the server need to negotiate and transmit a network protocol, that is, the live broadcast platform server needs to negotiate an encryption algorithm with the client.
102. The client establishes a detection thread;
after the live broadcast platform server negotiates with the client to obtain an encryption algorithm, the client creates a detection thread to perform calculation of calculation power detection. That is, for the client, the calculation power detection required by the live broadcast platform server needs to be performed independently, so that an independent thread needs to be created to perform the function calculation of the calculation power detection, and the obtained calculation total time consumption is accurate. Specifically, a thread execution function needs to be defined first, so that the created thread executes the written thread execution function. The whole computation logic of computation detection needs to be written in the thread execution function, and then a thread is created by calling the system function pthread _ create, and the specific function is implemented as follows:
static void*thread_func(void*arg){
int pthread_create(pthread_t*tidp,const pthread_attr_t*attr,
(void*)(*start_rtn)(void*),void*arg);
};
wherein the first parameter pthread _ t _ tidp is a pointer to a thread identifier; wherein the second parameter const pthread _ attr _ t _ attr is used to set thread attributes; the third parameter (void) (# start _ rtn) (void) is the address of the thread execution function, i.e. the thread execution function thread _ func written herein; where arg is the incoming parameter for the running thread to execute the function. Then, a thread is created by calling a system function pthread _ create, and the specific implementation function is as follows:
pthread_create(&tidp,NULL,thread_func,(void*)arg);
it is understood that after the line of code is executed, i.e. after the probe thread is created, the probe thread executes the code logic in the function thread _ func.
103. A live broadcast platform server sends a first message to a client;
when the live platform server needs to detect the computing capability of the client, the live platform server sends a first message to the client, where the first message is used to indicate the computing capability of the detection client, so according to the negotiation between the live platform server and the client in step 101, the first message includes timestamp information, encryption times N, and random data of the current live platform server, where N is a positive integer, and for example, N may be 1000. Specifically, the live platform server may send the first message to the client in the following manner:
type@=CalcAbilityReq/TimeStamp@=1540100990/Times@=1000/RandData@=ab123dab9876abdabcd34a3aaaa32453/;
the type @ is the type of the first message, and the type @ ═ calca viability req indicates that the type is the computing capacity of the issued data detection client; TimeStamp @ ═ 1540100990 indicates the current TimeStamp information of the live platform server; time @ ═ 1000 indicates the number of Times that the live platform server requires the client to perform encryption calculation, that is, N; RandData @ ab123dab9876abdabcd34a3aaaa 32453/is random data in the first message, that is, random data to be sent by the live platform server to the client for calculation power calculation.
It can be understood that, to enhance the security of data transmission between the live broadcast platform server and the client, the first message may be encrypted and transmitted to the client, where the encryption mode may be a symmetric encryption mode or an asymmetric encryption mode, and is not limited herein. It should be noted that the encryption mode is also agreed in advance for the live broadcast platform server and the client, that is, after the live broadcast platform server encrypts the first message in the encryption mode, the client may decrypt in a decryption mode corresponding to the encryption mode.
104. The client side obtains the total time consumed by calculation and the calculation result of the client side calculation force detection according to the first message in a preset mode;
105. the client sends a first response message to the live broadcast platform server;
after receiving a first message sent by a live broadcast platform server, a client firstly analyzes the first message to obtain the content of each field in the first message, and then the client calculates the detection result of the client computing power according to the content of each field and a local algorithm and reports the detection result to the server. It should be noted that, if the live broadcast platform server encrypts the first message and then sends the encrypted first message to the client, the client further needs to decrypt and then analyze the encrypted first message after receiving the encrypted first message. In this embodiment of the present application, the decrypting, by the client, the first message includes:
1) firstly, an instance object of a message parsing class DataDecoder is created, and the specific implementation function is as follows:
DataDecoder*pDecoder=new DataDecoder();
2) analyzing the received first message according to the message analysis type DataDecoder, wherein the specific realization function is as follows:
pDecoder->Parse(buf);
and buf represents a received first message sent by the live broadcast platform server. After the analysis, the message type of the first message is obtained, and the specific implementation function is as follows:
std::string cmdtype=std::string(pDecoder->GetItem("type"));
the message type of the first message can be analyzed and obtained through the function, wherein the cmdtype value represents the type of the first message. In this embodiment of the present application, if the type of the first message is a message for computing power detection, other fields need to be analyzed to obtain the number of computations, timestamp information, and the random number in the first message, and the specific implementation function is as follows:
Figure BDA0001946748270000081
after analyzing each field, the Times Times, the current TimeStamp information TimeStamp and the random data RandData are calculated, and the subsequent client side can calculate the data through the encryption algorithm in the text.
After receiving the first message, the client analyzes the first message and generates a first response message according to each field obtained by analysis, where the first response message includes a total time consumed by calculation, device identification information of the client, and a calculation result of client computing power detection, and for example, the first response message may be sent to the live broadcast platform server through the following functions:
type@=CalcAbilityRes/elapse@=990/DeviceID@=ab234addda89/ResultData@=adabcd34ab3487aad822daaabbbbccc2/;
the server sends a response message to the client, wherein type @ ═ calca viability res represents a first response message, namely the client replies to the first message sent by the server; the else @ 990 represents the total time consumed by the calculation of the client, that is, the total time millisecond consumed by the calculation of the client; DeviceID @ ═ ab234addda89 represents device identification information of the client;
ResultData @ adabcd34ab3487aad822 daaabbbccc 2 represents the client computing power detection result, that is, the result data of the client computing power detection calculation. When the client computing power detection calculation is completed, the data are contained in a first response message and reported to the live broadcast platform server. It can be understood that the first response message reported by the client may also be encrypted and then sent to the live platform server.
Specifically, how the client generates the first response message according to the first message will be described next, including obtaining the total calculation consumption duration and the calculation result of the client computing power detection:
in the embodiment of the present application, the logic function in the thread _ func created in step 102 is executed. The concrete implementation is as follows: firstly, defining a variable record starting time for the client to perform computing power detection,
static void*thread_func(void*arg){
Uint64_t nStartTime=Time();
the nStartTime is used to represent a start Time of recording the power detection, and the start Time may be obtained by calling a system function Time (), in this embodiment of the present application.
Secondly, the recalculation of the calculation power detection calculation result of the client comprises the following steps: 1) the client performs HASH operation according to the client serial number, the timestamp information, the client device identification information, the current room number and the user identification information in the first message to obtain a first key, and the specific implementation function is as follows: key1 ═ md5.create (sessionid + UserId + DeviceID + roomid + TimeStamp); the Key1 is used to represent a first Key, sessionid is used to represent a serial number of a client, UserId is used to represent user identification information, DeviceID is used to represent device identification information of the client, roomid is used to represent a current room number, TimeStamp is used to represent TimeStamp information, and md5.create () is used to represent a computing interface of the HASH algorithm md5, that is, in the embodiment of the present application, these data include sessionid and UserId created by a live platform server, and md5 is performed together with device unique DeviceID and room number and TimeStamp information TimeStamp to obtain the first Key 1. The first Key1 is a 32-bit data, and here requires a 64-bit Key, so another second Key2 needs to be computed to obtain the final target Key. 2) The client performs HASH operation according to the random data in the first message to obtain a second key, and the specific implementation function is as follows: key2 ═ md5.create (RandData); wherein, Key2 is used to represent the second Key, and RandData is used to represent the random data in the first message; 3) the client side obtains a target key according to the obtained first key and the second key, and the specific implementation function is as follows: key1+ Key2, where Key is used to represent the target Key, since Md5 calculates out 32 bits of data, then the final 64 bits of data, i.e. the target Key, is obtained by calculating 2 Md 5; 4) performing Blowfish encryption calculation for N times according to the target key to obtain a client computing power detection calculation result, namely starting to perform Blowfish encryption calculation, and specifically realizing the following functions:
firstly, input data needing to be encrypted is defined, wherein the data needing to be encrypted is random data randData generated and issued by a live platform server, the random data is data with the length of 32 bits, and the function implementation can be as follows:
Char input[]=RandData;
then, defining the environment variable needed by the blowfish, namely defining the context environment variable of the blowfish, wherein the function can be realized as follows:
BLOWFISH_CTX ctx;
then, a function Blowfish _ Init performs initialization operation, where the function Blowfish _ Init is an environment variable interface for initializing a context and assigns an encrypted key to an environment variable, and the function implementation may be as follows:
Blowfish_Init(&ctx,key,sizeof(key));
and then, performing cyclic calculation on the calculation power detection required by the client, wherein in the embodiment of the application, for-cycle encryption is written, the encryption Times are encryption Times N carried in a first message sent by a live platform server and expressed by Times, and the function implementation can be as follows:
For(int i=0;i<Times;i++){
then, input data is calculated through an encryption interface Blowfish _ Encrypt of the Blowfish, so as to obtain an encryption result, and the function implementation can be as follows: .
Blowfish_Encrypt(&ctx,input);
Where parameter & ctx is a previously defined environment variable; the input is data to be encrypted, namely random data RandData, and the encryption result is stored in the input after encryption is finished. And continuously encrypting the encryption result through circulation, thereby completing time times encryption and obtaining the client computing power detection calculation result.
}
The time at this moment is obtained next after encryption is completed, and the function implementation can be as follows: .
Uint64_t nCurrentTime=Time();
Uint64_t nElapse=nCurrentTime-nStartTime;
And subtracting the starting time from the current time to obtain the time nElapse consumed by the whole algorithm, namely obtaining the total consumed time.
}
And the client packages the result including the total time consumed by calculation and the calculation result of the client calculation power detection to generate a first response message, encrypts the first response message and reports the encrypted first response message to the live platform server.
106. The live broadcast platform server obtains a platform computing power detection calculation result according to the first message and the client serial number in a preset mode;
after receiving the first response message, the live broadcast platform firstly analyzes the first response message to obtain a calculation result of the client. Then, in order to prevent hackers from bypassing the computation therein, the live platform server performs a check on the computation result, and if the check is normal, it indicates that the computation duration of the client is correct computation-consuming time, including:
1) an instance object of the message parsing class DataDecoder is created, and possible functions are implemented as follows:
DataDecoder*pDecoder=new DataDecoder();
the received message is then parsed,
pDecoder->Parse(buf);
the buf represents a received network message of computing power calculation issued by the client, namely a first response message. After parsing, obtaining the message type of the first response message,
std::string cmdtype=std::string(pDecoder->GetItem("type"));
the type value of the acquired message field represents the type of the message, if the type of the message represents a calculation force calculation message, other fields need to be analyzed to acquire the device identification information of the client, the total calculation consumption duration and the calculation result of the calculation force detection of the client in the first response message, and the specific implementation function is as follows:
If(cmdtype==“CalcAbilityRes”){
DeviceID=pDecoder->GetItemAsInt(“DeviceID”);
Elapse=pDecoder->GetItemAsInt(“elapse”);
ResultData=pDecoder->GetItemAsInt(“ResultData”);
wherein CalcAbiltyRes indicates that the type of the first response message is a computationally intensive message; DeviceID denotes device identification information of the client; the else @ 990 represents the total time consumed by the calculation of the client; ResultData represents the client computing power probe computation results.
After the first response message is analyzed, the live broadcast platform server calculates a platform calculation power detection calculation result according to the first message, it should be noted that a manner of calculating the platform calculation power detection calculation result by the live broadcast platform server is similar to a manner of calculating the client calculation power detection calculation result by the client, and details are not repeated here.
107. And when the client computing power detection calculation result is consistent with the platform computing power detection calculation result, the live broadcast platform server determines and stores the computing power of the client according to the equipment identification information and the total computing consumption duration of the client.
Then the live broadcast platform server compares whether the platform computing power detection calculation result is consistent with the client computing power detection calculation result, if not, the live broadcast platform server determines that the client is an illegally forged client; if the total time length of the calculated consumed time length is longer, the calculation capacity of the client is weaker; on the contrary, the shorter the total time consumed by calculation, the stronger the calculation capability of the client is.
In practical application, the live broadcast platform server may find a target calculation power level corresponding to the calculation capability of the client in a preset calculation power level table, where the preset calculation power level table includes an association relationship between total calculation consumption time and calculation power level, and the calculation power level is used to evaluate the calculation capability of the client, and for easy understanding, please refer to table 1, which is a possible preset calculation power level table provided in the embodiment of the present application:
TABLE 1
Calculating total time (ms) consumed Calculation of force grade
0~100 A
101~1000 B
1001~2000 C
And if the total calculation consumption time reported by the client is 800ms, determining the calculation power level of the client as B. In this embodiment, the computing capability of the client may also be correspondingly stored in the user information of the client through the device identification information of the client, and then different verification models may be issued according to the computing capability of the client.
In the embodiment of the application, a set of algorithm for computing power verification is designed, different verification models are issued according to the computing power of the client, and the method comprises the step of designing a set of algorithm for detecting the CPU performance of the client, so that the subsequent client verification and the server issue appropriate computation models conveniently. Meanwhile, the text is a calculation demonstration used for the live platform, so that the calculation demonstration of the text is calculated by combining some characteristics of the live platform.
The embodiments of the present application are described above from the perspective of a method for detecting computing power, and the embodiments of the present application are described below from the perspective of a live broadcast platform server and a client.
Referring to fig. 2a, fig. 2a is a schematic diagram of an embodiment of a possible live platform server according to an embodiment of the present application, where the live platform server specifically includes:
a transceiving unit 201, configured to send a first message to a client, where the first message is used to indicate to probe the computing capability of the client, and the first message includes timestamp information, encryption times, and random data of the current live platform server; receiving a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client by the live broadcast platform server;
the calculating unit 202 is configured to obtain a platform computing power detection calculation result according to the first message and the client serial number in the preset manner;
a judging unit 203, configured to judge whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result;
a determining unit 204, configured to determine and store the computing capability of the client according to the device identification information of the client and the total computing consumed time, where the computing capability of the client is negatively related to the total computing consumed time.
Referring to fig. 2b, fig. 2b is a schematic diagram of an embodiment of a possible client according to the present application, where the client specifically includes:
a creating unit 210, configured to create a detection thread, where the detection thread is used to implement detection of computing capability of the client;
a receiving and sending unit 211, configured to receive a first message sent by the live platform server, where the first message is used to indicate to detect the computing capability of the client, and the first message includes timestamp information, encryption times, and random data of the current live platform server;
based on the detection thread, the computing unit 212 is configured to obtain a total time consumed by computing and a client computing power detection computing result according to the first message in a preset manner;
in response to the first message, the transceiver unit 211 is further configured to send a first response message to the live broadcast platform server, where the first response message includes a total calculation consumption duration, device identification information of the client, and a client computing power detection calculation result.
Referring to fig. 3a, fig. 3a is a schematic view of an embodiment of an electronic device according to an embodiment of the present disclosure.
As shown in fig. 3a, the embodiment of the present application provides an electronic device, which includes a memory 310, a processor 320, and a computer program 311 stored on the memory 320 and executable on the processor 320, and when the processor 320 executes the computer program 311, the following steps are implemented: sending a first message to a client, wherein the first message is used for indicating the detection of the computing capacity of the client, and the first message comprises current timestamp information, encryption times and random data; receiving a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client; obtaining a platform computing power detection calculation result according to the first message and the client serial number in the preset mode; judging whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not; if so, determining and storing the computing capacity of the client according to the equipment identification information of the client and the total computing consumed duration, wherein the computing capacity of the client is inversely related to the total computing consumed duration.
Optionally, in a possible embodiment, the processor 320 is specifically configured to: performing HASH operation according to the client serial number, the timestamp information, the equipment identification information of the client, the current room number and the user identification information to obtain a first key; the live broadcast platform server performs HASH operation according to the random data to obtain a second key; and the live broadcast platform server obtains a target key according to the first key and the second key, and performs N times of Blowfish encryption calculation according to the target key to obtain a platform calculation force detection calculation result.
Optionally, in a possible embodiment, the processor 320 is specifically configured to: the first key is obtained in the following manner: key1 ═ md5.create (sessionid + UserId + DeviceID + roomid + TimeStamp); the Key1 is used to represent the first Key, the sessionid is used to represent the serial number of the client, the UserId is used to represent the user identification information, the DeviceID is used to represent the device identification information of the client, the roomid is used to represent the current room number, the TimeStamp is used to represent the TimeStamp information, and the md5.create () is used to represent the computing interface of the HASH algorithm md5.
Optionally, in a possible embodiment, the processor 320 is specifically configured to: creating an instance object of a message parsing class DataDecoder; and the live broadcast platform server analyzes the first response message according to the message analysis type DataDecoder to obtain the type of the first response message, the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection through analysis.
As shown in fig. 3b, an electronic device according to the embodiment of the present application includes a memory 330, a processor 340, and a computer program 331 stored in the memory 340 and executable on the processor 340, where the processor 340 executes the computer program 331 to implement the following steps: creating a detection thread, wherein the detection thread is used for realizing the detection computing capacity; receiving a first message sent by the live platform server, wherein the first message is used for indicating the detection computing capacity and comprises timestamp information, encryption times and random data of the current live platform server; based on the detection thread, obtaining a total consumed time and a client computing power detection calculation result according to the first message in a preset mode; and responding to the first message, and sending a first response message to the live broadcast platform server, wherein the first response message comprises the equipment identification information for calculating the total consumed duration and the calculation result of client computing power detection.
Optionally, in a possible embodiment, the processor 340 is specifically configured to: the probe thread is created by calling a system function pthread _ create that includes a pointer to a thread identifier, a thread attribute, an address of the probe thread, and an execution parameter to run the probe thread.
Since the electronic device described in this embodiment is a device used for implementing a live platform server or a client in this embodiment, based on the method described in this embodiment, a person skilled in the art can understand a specific implementation manner of the electronic device of this embodiment and various variations thereof, so that how to implement the method in this embodiment by the electronic device is not described in detail herein, and as long as the person skilled in the art implements the device used for implementing the method in this embodiment, the device is within the scope of protection intended by this application.
Referring to fig. 4a, fig. 4a is a schematic diagram illustrating an embodiment of a computer-readable storage medium according to the present application.
As shown in fig. 4a, the present embodiment provides a computer-readable storage medium 400, on which a computer program 411 is stored, which computer program 411, when being executed by a processor, realizes the following steps: sending a first message to a client, wherein the first message is used for indicating the detection of the computing capacity of the client, and the first message comprises current timestamp information, encryption times and random data; receiving a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total calculation consumption duration, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, and the client serial number is issued to the client; obtaining a platform computing power detection calculation result according to the first message and the client serial number in the preset mode; judging whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not; if so, determining and storing the computing capacity of the client according to the equipment identification information of the client and the total computing consumed duration, wherein the computing capacity of the client is inversely related to the total computing consumed duration.
Optionally, in a possible embodiment, the computer program 411 is specifically adapted to implement the following steps when being executed by a processor: performing HASH operation according to the client serial number, the timestamp information, the equipment identification information of the client, the current room number and the user identification information to obtain a first key; the live broadcast platform server performs HASH operation according to the random data to obtain a second key; and the live broadcast platform server obtains a target key according to the first key and the second key, and performs N times of Blowfish encryption calculation according to the target key to obtain a platform calculation force detection calculation result.
Optionally, in a possible embodiment, the computer program 411 is specifically adapted to implement the following steps when being executed by a processor: the first key is obtained in the following manner: key1 ═ md5.create (sessionid + UserId + DeviceID + roomid + TimeStamp); the Key1 is used to represent the first Key, the sessionid is used to represent the serial number of the client, the UserId is used to represent the user identification information, the DeviceID is used to represent the device identification information of the client, the roomid is used to represent the current room number, the TimeStamp is used to represent the TimeStamp information, and the md5.create () is used to represent the computing interface of the HASH algorithm md5.
Optionally, in a possible embodiment, the computer program 411 is specifically adapted to implement the following steps when being executed by a processor: creating an instance object of a message parsing class DataDecoder; and the live broadcast platform server analyzes the first response message according to the message analysis type DataDecoder to obtain the type of the first response message, the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection through analysis.
Referring to fig. 4b, fig. 4b is a schematic diagram illustrating an embodiment of a computer-readable storage medium according to the present application.
As shown in fig. 4b, the present embodiment provides a computer-readable storage medium 420 having a computer program 431 stored thereon, the computer program 431 when executed by a processor implementing the steps of: creating a detection thread, wherein the detection thread is used for realizing the detection computing capacity; receiving a first message sent by the live platform server, wherein the first message is used for indicating the detection computing capacity and comprises timestamp information, encryption times and random data of the current live platform server; based on the detection thread, obtaining a total consumed time and a client computing power detection calculation result according to the first message in a preset mode; and responding to the first message, and sending a first response message to the live broadcast platform server, wherein the first response message comprises the equipment identification information for calculating the total consumed duration and the calculation result of client computing power detection.
Optionally, in a possible embodiment, the computer program 431 is specifically configured to implement the following steps when executed by the processor: the probe thread is created by calling a system function pthread _ create that includes a pointer to a thread identifier, a thread attribute, an address of the probe thread, and an execution parameter to run the probe thread.
It should be noted that, in the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to relevant descriptions of other embodiments for parts that are not described in detail in a certain embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include such modifications and variations.

Claims (9)

1. A method of detecting computing power, comprising:
a live broadcast platform server sends a first message to a client, wherein the first message is used for indicating and detecting the computing capacity of the client, the first message comprises timestamp information, encryption times N and random data of the current live broadcast platform server, and N is a positive integer;
the live broadcast platform server receives a first response message which is sent by the client and responds to the first message, wherein the first response message comprises total calculation consumed time, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, the preset mode is a network protocol and an encryption algorithm negotiated between the client and the live broadcast platform server, and a client serial number is issued to the client by the live broadcast platform server;
the live broadcast platform server obtains a platform computing power detection calculation result according to the first response message and the client serial number in the preset mode;
the live broadcast platform server judges whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not;
if yes, the live broadcast platform server determines and stores the computing capacity of the client according to the equipment identification information of the client and the total computing consumption duration, and the computing capacity of the client is inversely related to the total computing consumption duration.
2. The method of claim 1, wherein the obtaining, by the live broadcast platform server, a platform computing power detection calculation result according to the first response message and the client serial number in the preset manner comprises:
the live broadcast platform server carries out HASH operation according to the client serial number, the timestamp information, the equipment identification information of the client, the current room number and the user identification information to obtain a first key;
the live broadcast platform server performs HASH operation according to the random data to obtain a second key;
and the live broadcast platform server obtains a target key according to the first key and the second key, and performs the N times of Blowfish encryption calculation according to the target key to obtain a platform calculation force detection calculation result.
3. The method of claim 2, wherein the performing, by the live platform server, a HASH operation according to the client serial number, the timestamp information, the device identification information of the client, the current room number, and the user identification information to obtain the first key comprises:
the first key is obtained in the following manner:
Key1=Md5.Create(sessionid+UserId+DeviceID+roomid+TimeStamp);
the Key1 is used to represent the first Key, the sessionid is used to represent the serial number of the client, the UserId is used to represent the user identification information, the DeviceID is used to represent the device identification information of the client, the roomid is used to represent the current room number, the TimeStamp is used to represent the TimeStamp information, and the md5.create () is used to represent the computing interface of the HASH algorithm md5.
4. The method of claim 1, wherein receiving, by the live platform server, a first response message sent by the client in response to the first message comprises:
the live broadcast platform server creates an instance object of a message parsing class DataDecoder;
and the live broadcast platform server analyzes the first response message according to the message analysis type DataDecoder to obtain the type of the first response message, the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection through analysis.
5. A method of detecting computing power, comprising:
a client creates a detection thread, wherein the detection thread is used for realizing the detection of the computing capacity of the client;
the client receives a first message sent by a live broadcast platform server, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server;
based on the detection thread, the client obtains a total calculation consumption time and a client calculation force detection calculation result according to the first message in a preset mode, wherein the preset mode is a network protocol and an encryption algorithm negotiated between the client and the live broadcast platform server;
and responding to the first message, the client sends a first response message to the live broadcast platform server, wherein the first response message comprises the total calculation consumption duration, the equipment identification information of the client and the calculation result of client calculation power detection.
6. The method of claim 5, wherein the client creating a probe thread comprises:
the client creates the probe thread by calling a system function pthread _ create that includes a pointer to a thread identifier, a thread attribute, an address of the probe thread, and an execution parameter to run the probe thread.
7. A live platform server, comprising:
the receiving and sending unit is used for sending a first message to a client, wherein the first message is used for indicating and detecting the computing capacity of the client, and the first message comprises timestamp information, encryption times and random data of the current live broadcast platform server; receiving a first response message which is sent by the client and responds to the first message, wherein the first response message comprises a total time consumed by calculation, equipment identification information of the client and a client computing power detection calculation result, the client computing power detection calculation result is calculated by the client according to the first message in a preset mode, the preset mode is a network protocol and an encryption algorithm negotiated between the client and the live broadcast platform server, and a client serial number is issued to the client by the live broadcast platform server:
the computing unit is used for obtaining a platform computing power detection computing result according to the first response message and the client serial number in the preset mode;
the judging unit is used for judging whether the client computing power detection calculation result is consistent with the platform computing power detection calculation result or not;
and if so, determining and storing the computing capacity of the client according to the equipment identification information of the client and the total computing consumed duration, wherein the computing capacity of the client is negatively related to the total computing consumed duration.
8. A client, comprising:
the creating unit is used for creating a detection thread, and the detection thread is used for realizing the detection of the computing capacity of the client;
the client-side comprises a receiving and sending unit, a processing unit and a processing unit, wherein the receiving and sending unit is used for receiving a first message sent by a live platform server, the first message is used for indicating and detecting the computing capacity of the client-side, and the first message comprises timestamp information, encryption times and random data of the current live platform server;
based on the detection thread, a computing unit is used for obtaining a total time consumed by computing and a detection computing result of client computing power according to the first message in a preset mode, wherein the preset mode is a network protocol and an encryption algorithm negotiated between the client and the live broadcast platform server;
and responding to the first message, wherein the transceiver unit is further configured to send a first response message to the live broadcast platform server, and the first response message includes the total calculation consumption duration, the device identification information of the client, and the client calculation power detection calculation result.
9. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of any of claims 1-6.
CN201910038559.6A 2019-01-16 2019-01-16 Method and related device for detecting computing capability Active CN109788349B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910038559.6A CN109788349B (en) 2019-01-16 2019-01-16 Method and related device for detecting computing capability

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910038559.6A CN109788349B (en) 2019-01-16 2019-01-16 Method and related device for detecting computing capability

Publications (2)

Publication Number Publication Date
CN109788349A CN109788349A (en) 2019-05-21
CN109788349B true CN109788349B (en) 2021-09-07

Family

ID=66499388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910038559.6A Active CN109788349B (en) 2019-01-16 2019-01-16 Method and related device for detecting computing capability

Country Status (1)

Country Link
CN (1) CN109788349B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114062891A (en) * 2021-10-11 2022-02-18 深圳市德斯戈智能科技有限公司 Calculation force testing device based on AI chip
CN115065843B (en) * 2022-07-22 2022-12-20 广州万协通信息技术有限公司 Video encryption and decryption processing method and system under security authentication

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109089428B (en) * 2015-11-30 2022-03-25 舍普施福特股份公司 Zero custody transfer of digital assets
CN107454110A (en) * 2017-09-26 2017-12-08 武汉斗鱼网络科技有限公司 A kind of data verification method and server

Also Published As

Publication number Publication date
CN109788349A (en) 2019-05-21

Similar Documents

Publication Publication Date Title
EP1662691A1 (en) Device authentication system
CN111698088A (en) Key alternation method, key alternation device, electronic equipment and medium
US20030016819A1 (en) Secure socket layer (SSL) load generation with handshake replay
CN108881966B (en) Information processing method and related equipment
US20230052608A1 (en) Remote attestation
CN111683090A (en) Block chain digital signature method and device based on distributed storage
CN109788349B (en) Method and related device for detecting computing capability
Khan et al. Resource efficient authentication and session key establishment procedure for low-resource IoT devices
CN111510442A (en) User verification method and device, electronic equipment and storage medium
CN110910110A (en) Data processing method and device and computer storage medium
CN111131127B (en) Communication method based on live broadcast platform and related device
CN116402169B (en) Federal modeling verification method, federal modeling verification device, federal modeling verification equipment and storage medium
CN116170144B (en) Smart power grid anonymous authentication method, electronic equipment and storage medium
CN109905395B (en) Method and related device for verifying credibility of client
CN110380843B (en) Information processing method and related equipment
CN109218009B (en) Method, client and server for improving equipment ID security
CN115834085A (en) Method and device for generating signature and method and device for security authentication
CN110381342B (en) Information processing method and related equipment
CN107193884B (en) Data matching method and device
CN108769748B (en) Information processing method and related equipment
CN111552950A (en) Software authorization method and device and computer readable storage medium
Alharbi et al. An enhanced Dragonfly key exchange protocol against offline dictionary attack
WO2021082404A1 (en) Information monitoring method, system, device, and storage medium
CN112784314B (en) Data integrity detection method and device, electronic equipment and storage medium
CN115955309B (en) Encryption reasoning method, system, equipment and storage medium thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant