CN109858588B - Chaos mapping-based two-dimensional code parallel generation method - Google Patents

Chaos mapping-based two-dimensional code parallel generation method Download PDF

Info

Publication number
CN109858588B
CN109858588B CN201910013696.4A CN201910013696A CN109858588B CN 109858588 B CN109858588 B CN 109858588B CN 201910013696 A CN201910013696 A CN 201910013696A CN 109858588 B CN109858588 B CN 109858588B
Authority
CN
China
Prior art keywords
code
area
server
client
bit sequence
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
CN201910013696.4A
Other languages
Chinese (zh)
Other versions
CN109858588A (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.)
Harbin University of Science and Technology
Original Assignee
Harbin University of Science and Technology
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 Harbin University of Science and Technology filed Critical Harbin University of Science and Technology
Priority to CN201910013696.4A priority Critical patent/CN109858588B/en
Publication of CN109858588A publication Critical patent/CN109858588A/en
Application granted granted Critical
Publication of CN109858588B publication Critical patent/CN109858588B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a chaos mapping-based two-dimension code parallel generation method. The client sends a QR code request to the server through the MPI function and transmits an information source to the server through the MPI function; after the server accepts the client request and receives the information source, the server firstly interferes the data code words containing the information source through two threads of a processor core and Logistic chaotic mapping and piecewise linear chaotic mapping to generate chaotic random bit sequences in parallel, then fills different areas of the QR code in parallel through a plurality of threads of the processor core, divides the areas into a left area and a right area when filling the data and error correcting code areas, fills the left area and the right area in parallel with the rest areas, finally stores the assembled QR code in a dynamic buffer area, and sends the QR code to the client through an MPI function.

Description

Chaos mapping-based two-dimensional code parallel generation method
Technical Field
The invention relates to a parallel chaotic mapping and two-dimension code generating method, in particular to a two-dimension code parallel generating method based on chaotic mapping, and belongs to the field of parallel computing.
Background
The two-dimensional code is also called as a two-dimensional bar code, and data symbol information is recorded by using a certain black and white pattern which is distributed on a two-dimensional plane according to a certain rule. In code coding, the two-dimensional code uses bits of '0' and '1' in a computer, uses a plurality of geometric figures corresponding to binary systems to represent literal numerical information, and realizes automatic processing of the information by automatic recognition through an image input device or an optoelectronic scanning device. The two-dimensional code symbol can be represented by various code systems, and a QR (Quick Response) code is a common two-dimensional code representation mode and is widely applied.
The two-dimensional code has the characteristics of large information capacity, low cost and convenience. With the continuous development of information technology and the continuous popularization of intelligent mobile terminal equipment, the application of two-dimensional codes in the fields of e-commerce, ticketing systems, resource acquisition and the like becomes more and more common, and the use of the two-dimensional codes is almost undisclosed in daily life of people. However, the wide application of the two-dimensional code brings convenience to users, and also has potential safety hazards such as information tampering and personal information leakage, so in the era of rapid development of information, it is necessary to protect important data in the two-dimensional code to prevent leakage. In addition, the two-dimensional code is mostly generated at the server side and transmitted to the client side through the network, so that the physical processor core in the server needs to be fully utilized to quickly generate the two-dimensional code, thereby accelerating the real-time response to the client side. Application cases of the two-dimensional code are listed below.
Case 1, a certain e-commerce platform needs two-dimensional codes for online payment. Because the two-dimensional code contains sensitive information of the client, the sensitive information can be stolen by lawbreakers in the process of being transmitted from the server to the client through the network, and sensitive data of the client is leaked. Therefore, before the sensitive information is transmitted to the client through the network, the chaos mapping is used for interfering the data code word containing the sensitive data, so that even if lawbreakers steal the information, the sensitive information of the user cannot be obtained.
Case 2, a platform needs to log in with a code scan. The server generates the two-dimensional code in a single-processor single-thread mode, and in the generation process of the two-dimensional code, the login verification time limited by the platform is overtime and needs to be logged in again, so that a client cannot log in the platform in time. Therefore, the advantage of multithreading of a processor core in the server can be utilized, the generation of the two-dimensional code is accelerated by adopting a multithreading parallel mode, and a client can log in the platform in time.
The information source generating the two-dimensional code needs to be encrypted. Both the traditional symmetric encryption method and the asymmetric encryption method are theoretically breakable. The chaotic mapping has the characteristics of non-convergence, sensitivity to initial values and the like, and the chaotic sequence has the characteristic of pseudo-random more easily due to the interference among different tracks, so that the chaotic mapping can be used for interfering sensitive data, and sensitive information is generated into a chaotic random sequence through the chaotic mapping.
The server comprises a plurality of processor cores, each processor core supports multi-thread parallel computation, and when the server generates the two-dimensional code, the two-dimensional code generated by adopting a single-thread computation mode is time-consuming; therefore, the server can interfere the information source in parallel in a multithreading mode to generate a chaotic random bit sequence to guarantee the safety of the information source, then the two-dimensional matrix of the QR code is filled in parallel in a multithreading mode, the generation time of the QR code is shortened, and the request of the client is responded in real time.
The basic idea of the chaos mapping-based two-dimensional code parallel generation method is as follows: the method comprises the steps that a client and a server interact through a Message Passing Interface (MPI) function, the client sends an information source to the server through the MPI function, after the server receives the information source through the MPI function, firstly, two threads and two different chaotic mapping methods, namely Logistic chaotic mapping and piecewise linear chaotic mapping, are used for carrying out parallel interference on a complete data code word containing the information source to generate a chaotic random bit sequence, then, the server carries out parallel filling on a two-dimensional matrix of a QR code according to a format of the QR code in a multithreading parallel mode, finally, a QR two-dimensional code image is stored in a dynamic buffer area of a local QR code, and the QR code image is sent to the client through the MPI function so as to quickly respond to a QR code request of the client.
Disclosure of Invention
Technical problem to be solved
In order to realize the requirement of quick response of the QR code to the client and the requirement of parallel generation of the chaotic random bit sequence of the QR code by the server, the invention combines the characteristic of chaotic mapping parallel generation and designs the quick response request of the client. Firstly, in order to realize the parallel generation of chaotic random bit sequences by chaotic mapping, two chaotic mappings, namely Logistic chaotic mapping and piecewise linear chaotic mapping, are designed as generating functions, threads are dynamically established and reside in a physical computing core according to the demand of a client, the generation of the chaotic random bit sequences is realized, and control parameters and initial values are different in each thread so as to ensure that the tracks are different. The filling of the QR code two-dimensional matrix is divided into six areas: the system comprises a detection graph area, a positioning graph area, a correction graph area, a format information area, a version information area and a data and error correction code word area, so that a processor core in the server fills different areas in a multithreading parallel mode; when the data and error correction codeword regions are filled, the data and error correction codeword regions are divided into left and right regions, and the two regions may be filled in parallel with the remaining five regions. And the filling of the left area of the QR code is finished by the chaotic random bit sequence generated by the first chaotic mapping, and the filling of the right area of the QR code is finished by the chaotic random bit sequence generated by the second chaotic mapping. The design is mainly to generate a more random and secret chaotic random bit sequence and utilize the interference characteristic of a chaotic track; because different chaotic maps have different chaotic attractors, the interference between different tracks more easily makes the chaotic sequence have the characteristic of pseudo-random. And the QR code generated by each processor core is stored in a QR code dynamic buffer area. The dynamic buffer area of the QR code is used for storing the QR code which is assembled and can be sent to a user for use, and the design mainly considers the following steps: under the conditions of large scale and sudden increase of client requirements, the supply pressure of the server is relieved, the request of the client can be effectively met, and meanwhile, the QR code request of the client and the response of the server are interacted in an MPI function mode.
(II) technical scheme
In order to solve the safety problem of an information source in a two-dimensional code and quickly generate a two-dimensional code image to respond to a client request in real time, the invention provides a chaos mapping-based two-dimensional code parallel generation method, which comprises the following steps:
(1) The server utilizes two threads and two different chaotic mapping modes of Logistic chaotic mapping and piecewise linear chaotic mapping to carry out parallel interference on a complete data code word of an information source, so that a chaotic random bit sequence is generated;
(2) The server parallelly fills the two-dimensional matrix of the QR code according to regions in a multithread parallel mode, and each thread is responsible for filling a task of one region, so that a QR two-dimensional code image is quickly generated;
(3) The client and the server interact by adopting an MPI function, the server stores the generated QR code two-dimensional matrix in a dynamic buffer area of the QR code to relieve the supply pressure of the server, and the dynamic buffer area is constructed in a dynamic linked list mode so as to dynamically distribute the QR code to the client to realize quick response.
A two-dimension code parallel generation method based on chaos mapping is characterized in that a server dynamically creates threads and resides in a physical computing core by using Logistic chaos mapping and piecewise linear chaos mapping as generation functions according to the demand of a client to realize the generation of chaos random bit sequences, control parameters and initial values are different in each thread, and random numbers generated by a system are used as the control parameters and the initial values to ensure that tracks are different, and the method mainly comprises the following steps:
s1, a server main process generates a complete data code word bit sequence Str _0 containing an information source according to the version and the error correction level of the selected QR two-dimensional code, wherein the length of the bit sequence is length;
s2, the server main process divides the bit sequence Str _0 into two bit sequences Str _1 and Str _2, and the length of each bit sequence is length/2;
s3, the server main process distributes two threads, thread _1 and thread _2, to generate a chaotic random bit sequence in parallel:
s3.1, the thread _1 utilizes Logistic chaotic mapping to interfere with the bit sequence Str _1, and further generates a chaotic random bit sequence Str _4:
first, random numbers between (0, 1) are generated by Logistic chaotic mapping:
x n+1 =x n *u*(1-x n ) U lies in the interval [0,4 ]]Upper, x n In the interval [0,1]In the above-mentioned manner,
iterating n = length/2 times to generate length/2 random numbers;
then, the random number binarization processing: when x is n In the interval (0, 0.5)]When x is 0, the random number obtained is n When the random number is located in the interval (0.5, 1), the obtained random number is 1, and then a random bit sequence Str _3 is obtained;
finally, performing XOR operation on the bit sequence Str _1 and the random bit sequence Str _3 to obtain an interfered chaotic random bit sequence Str _4;
s3.2, the thread _2 interferes the bit sequence Str _2 by utilizing piecewise linear chaotic mapping, and further generates a chaotic random bit sequence Str _6:
first, random numbers between (0, 1) are generated by piecewise linear chaotic mapping:
when x is n In the interval [0, p ]]When above, x n+1 =x n P; when x is n In the interval (p, 1)]When above, x n+1 =(1-x n )/(1-p),
Iteration n = length/2 times is needed to generate length/2 random numbers;
then, the random number binarization processing: when x is n Is located in the interval (0, 0.5)]When x is 0, the random number obtained is n When the random number is located in the interval (0.5, 1), the obtained random number is 1, and then a random bit sequence Str _5 is obtained;
finally, carrying out XOR operation on the bit sequence Str _2 and the random bit sequence Str _5 to obtain an interfered chaotic random bit sequence Str _6;
and S4, the server main process generates the chaotic random bit sequence in parallel and ends.
A two-dimensional code parallel generation method based on chaotic mapping is characterized in that a server fills a two-dimensional matrix of a QR code in a multithreading parallel mode, so that a QR two-dimensional code image is generated. The filling of the QR code is divided into six regions: the system comprises a detection graph area, a positioning graph area, a correction graph area, a format information area, a version information area and a data and error correction code word area, so that different areas are filled in a multi-thread parallel mode; in filling the data and error correction codeword regions, the data and error correction codeword regions are divided into left and right regions, which may be filled in parallel with the remaining five regions. The left region is filled with a chaotic random bit sequence Str _4; the right area is filled with a chaotic random bit sequence Str _6, which mainly comprises:
s1, constructing an n-order square matrix A by a server main process according to the version and the error correction level of the QR code, and setting an initial value to be 0;
s2, the server main process distributes 7 threads to execute different subtasks in parallel:
and filling the position detection area by the thread _1, namely setting the position detection graphic area of the matrix A to be 1 according to the QR code format:
A[0][0…6]=A[2][2…4, 6]= A[3][3, 4, 6]=A[4][4, 6]=1;
A[0][n-7 … n-1]= A[1][n-7, n-1]=A[2][n-7, n-5 … n-3, n-1]= A[3][n-7, n-5 … n-3, n-1]= A[4][n-7, n-5 … n-3, n-1]=A[5][n-7 … n-1]=A[6][n-7 … n-1]=1;
the operation only fills the upper right triangle of the matrix, and the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition because the position detection graph area is highly symmetrical in the matrix about the main diagonal;
and filling the positioning graph area by the thread _2, namely setting the positioning graph area of the matrix A to be 1 according to a QR code format:
A[6][8, 10, 12 … n-9]=1;
the operation only fills the upper right triangle of the matrix, and because the positioning graphic area is highly symmetrical in the matrix about the main diagonal line, the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition;
and filling the corrected graph area by the thread _3, namely setting the corrected graph area of the QR code to be 1 according to the QR code format according to the version of the QR code, wherein the corrected graph numbers and positions of the QR codes of different versions are different. The correction graph area is highly symmetrical in the matrix with respect to the main diagonal, so that the upper right triangular area can be filled first, and then the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition;
the thread _4 fills the format information area, namely, the information format of the QR code is filled, and the Dark Module part A [ n-9] [8] =1 is also filled;
the thread _5 fills a version information area, namely, the thread fills according to the version format of the QR code;
thread _6 fills the left area of the data code and error correction code word area, namely, the chaotic random bit sequence Str _4 is firstly inverted, then, the inverted bit sequence is used for filling and masking in sequence from the lower left corner, if the non-data and error correction code word area is met, the area is skipped over, and filling is continued;
filling a right area of the data and error correction code word area by the thread _7, namely, sequentially filling and masking by using the chaotic random sequence Str _6 according to the sequence from the lower right corner, and if a non-data and error correction code word area is met, skipping the area and continuing filling;
and S3, the server fills the QR code two-dimensional matrix in parallel, and the completion is finished.
A two-dimension code parallel generation method based on chaotic mapping is characterized in that a client and a server interact by adopting an MPI function, and a QR code generated by each processor core of the server is stored in a dynamic buffer area of the QR code. The dynamic buffer area of the QR code is used for storing the QR code which is assembled and can be sent to a user for use, the process comprises that a client acquires a two-dimensional code of a server end through MPI, the server end sends the two-dimensional code in the buffer area to the client end through MPI, and the node of the dynamic buffer area comprises 3 parts: the data area, the exclusive district and the pointer district, the data area is used for storing the QR code, and the exclusive district is used for multithread locking exclusive access, realizes the parallelization, and the pointer district stores the pointer address of next node, mainly includes:
the client acquires the two-dimensional code of the server through the MPI:
s1, a client sends a request for acquiring a two-dimensional code to a server by using an MPI _ send (main process ID of a QR code buffer area of the server, process ID of a request client) function;
s2, the client sends an information source to the server by using an MPI _ send (main process ID of a QR code buffer zone of the server, information source of the client) function;
s3, the client acquires the two-dimensional code sent by the server by using an MPI _ Recv (main process ID of a QR code buffer area of the server, process ID of a request client, a local buffer area for receiving the QR code and a communication state) function, wherein the operation is blocking operation, and if the server does not have the available two-dimensional code, the client waits for the two-dimensional code;
and S4, the client acquires the two-dimension code of the server and finishes the acquisition.
The server side sends the two-dimensional codes in the buffer area to the client side through the MPI:
s1, a server main process receives a request of a client by using an MPI _ Recv (main process ID of a QR code buffer area of a server, process ID of a request client, the distributable number of the current QR code buffer area and a communication state) function;
s2, the server main process receives the information source of the client by using an MPI _ Recv (main process ID of a QR code buffer area of the server, process ID of a request client, information source and communication state) function;
s3, generating a chaotic random bit sequence in parallel by the server main process;
s4, the server main process fills a QR code two-dimensional matrix in parallel;
s5, the server main process stores the two-dimensional matrix into a QR code dynamic buffer area:
the generated QR codes are stored in the data area part of the dynamic linked list, and when one QR code is generated, a dynamic linked list node is distributed to the memory, and the three parts are initialized, so that the node is linked to the dynamic linked list; the design mainly considers that in a multi-core processor, only one process is allowed to obtain the access of the QR code when the multiple processes access, one process obtains the QR code and must lock the exclusive area to finally obtain the QR code, and if the area is locked, the next node is accessed according to the pointer area. After the QR codes are distributed, deleting the nodes of the dynamic linked list from the memory for use in preparation for continuously generating the QR codes, wherein the capacity of the dynamic linked list is determined according to the access amount and the set capacity of the server memory, so that the problems of delay and waiting caused by the increase of the access amount of the client can be relieved;
s6, the server main process sends the QR two-dimensional code to the client by utilizing an MPI _ send (main process ID of a server QR code buffer area, process ID of a request client and QR code data) function;
and S7, the server generates the QR two-dimensional code and ends.
(III) advantageous effects
The beneficial results of the invention are: the client and the server adopt MPI function to interact, and the QR code generated by the server is stored in a dynamic buffer area of the QR code; a processor core of the server adopts two threads and two different chaotic mapping modes of Logistic and piecewise linear chaotic mapping, and interferes complete data code words containing an information source according to the data sensitivity and non-convergence of a chaotic algorithm and the interference characteristic of a chaotic track so as to generate a chaotic random bit sequence which is more random and secret in parallel; and a processor core of the server parallelly fills different areas of the QR code two-dimensional matrix in a multithreading mode to quickly generate a two-dimensional code image, so that the client side is timely responded.
Drawings
Fig. 1 is a flowchart of a two-dimensional code parallel generation method based on chaotic mapping.
FIG. 2 is a multithreading-based QR code two-dimensional matrix parallel filling task allocation diagram.
Detailed Description
Embodiments of the present invention are described in further detail below with reference to the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Example 1: the server generates chaotic random bit sequences in parallel.
S1, a server main process generates a complete data code word bit sequence Str _0 containing an information source according to the version and the error correction level of the selected QR two-dimensional code, wherein the length of the bit sequence is as follows:
let the complete data codeword be Str _0= "0011 0001 0011 0001 0011 1001 0011 0010", length =40;
s2, the server host process divides the bit sequence Str _0 into two bit sequences Str _1 and Str _2, wherein the length of each bit sequence is length/2:
Str_1=“0011 0001 0011 0001 0011”;
Str_2=“0001 0011 1001 0011 0010”;
s3, the server main process distributes two threads, thread _1 and thread _2, to generate a chaotic random bit sequence in parallel:
s3.1, the thread _1 utilizes Logistic chaotic mapping to interfere with the bit sequence Str _1, and further generates a chaotic random bit sequence Str _4:
first, random numbers between (0, 1) are generated by Logistic chaotic mapping: setting the ratio of control parameter to initial value as u =3.99 and x 0 =0.55, iteration n =20 times, yielding 20 random numbers;
then, the random number is subjected to binarization processing, so that a random bit sequence Str _3= '1100 1101 1001 0010 0110' is obtained;
finally, performing XOR operation on the bit sequence Str _1 and the random bit sequence Str _3 to obtain an interfered chaotic random bit sequence Str _4= '1111 1100 1010 0011 0101';
s3.2, the thread _2 interferes the bit sequence Str _2 by utilizing piecewise linear chaotic mapping, and further generates a chaotic random bit sequence Str _6:
first, the random number between (0, 1) is generated by segmenting the active chaotic map: let the parameter and initial value be p =0.31 and x, respectively 0 =0.35, iteration n =20 times, yielding 20 random numbers;
then, the random sequence is subjected to binarization processing, so that a random bit sequence Str _5= "0100 1011 1111 1111 1111 0101" is obtained;
finally, performing XOR operation on the bit sequence Str _2 and the random bit sequence Str _5 to obtain an interfered chaotic random bit sequence Str _6= '0101 1000 0110 1100 0111';
and S4, the server main process generates the chaotic random bit sequence in parallel and ends.
Example 2: and the server parallelly fills the QR code two-dimensional matrix.
The selected QR code version and error correction level are set to 7-Q.
S1, constructing an n-order square matrix A by a server main process according to the version and the error correction level of the QR code, setting the initial value of the n-order square matrix A to be 0, and regarding the QR code of the 7-Q version, setting the A to be a 45-order square matrix;
s2, the server main process allocates 7 threads to execute the following tasks in parallel, as shown in FIG. 2:
and filling the position detection area by the thread _1, namely setting the position detection graphic area of the matrix A to be 1 according to the QR code format:
A[0][0…6]=A[2][2…4, 6]= A[3][3, 4, 6]=A[4][4, 6]=1;
A[0][n-7 … n-1]= A[1][n-7, n-1]=A[2][n-7, n-5 … n-3, n-1]= A[3][n-7, n-5 … n-3, n-1]= A[4][n-7, n-5 … n-3, n-1]=A[5][n-7 … n-1]=A[6][n-7 … n-1]=1;
the operation only fills the upper right triangle of the matrix, and since the position detection pattern area is highly symmetrical in the matrix with respect to the main diagonal, the corresponding position of the lower left triangle of the matrix a is also set to 1 by matrix transposition, i.e. a = transpose (a) + a, thereby completing the filling of the position detection pattern area;
filling the positioning graphic area by the thread _2, namely setting the positioning graphic area of the matrix A to be 1 according to a QR code format:
A[6][8, 10, 12 … n-9]=1;
the operation only fills the upper right triangle of the matrix, and since the positioning graphic area is highly symmetrical in the matrix with respect to the main diagonal, the corresponding position of the lower left triangle of the matrix a is also set to 1 by matrix transposition, i.e. a = transpose (a) + a, thereby completing filling of the positioning graphic area;
thread _3 fills the correct graphics area, for a total of 45 modules (n = 45) for the 7-Q version, requiring 6 correct graphics areas:
A[4][n/2-2 … n/2+2]=A[5][n/2-2, n/2+2]=A[6][n/2-2, n/2, n/2+2]=A[7][n/2-2, n/2+2]=A[8][n/2-2 … n/2+2]=1;
A[n/2-2][n/2-2 … n/2+2]=A[n/2-1 … n/2+2][n/2+2]=A[n/2][n/2]=1;
A[n/2-2][n-9 … n-5]=A[n/2-1][n-9, n-5]=A[n/2][n-9, n-7, n-5]=A[n/2+1][n-9, n-5]=A[n/2+2][n-9 … n-5]=1;
A[n-9][n-9 … n-5]=A[n-8 … n-5][n-5]=A[n-7][n-7]=1;
the correction pattern area is highly symmetrical in the matrix with respect to the main diagonal, so the upper right triangle area can be filled first, and then the corresponding position of the lower left triangle of the matrix a is also set to 1 by matrix transposition, i.e. a = transpose (a) + a, thereby completing the filling of the correction pattern area;
the thread _4 fills the format information area, namely, the information format of the QR code is filled, and a Dark Module part A [ n-9] [8] =1 is also filled, wherein the selected mask level is 110, and the error correction level is Q (11);
the thread _5 fills the version information area, namely fills according to the version format of the QR code;
thread _6 fills the left area of the data code and error correction code word area, namely, the chaotic random bit sequence Str _4 is firstly inverted, then, the inverted bit sequence is used for filling and masking in sequence from the lower left corner, if the non-data and error correction code word area is met, the area is skipped over, and filling is continued;
filling a right area of the data and error correction code word area by the thread _7, namely, sequentially filling and masking by using the chaotic random sequence Str _6 according to the sequence from the lower right corner, and if a non-data and error correction code word area is met, skipping the area and continuing filling;
and S3, the server fills the QR code two-dimensional matrix in parallel, and the completion is finished.
Example 3: the client and the server interact through an MPI function, and the server stores the generated QR code in a QR code dynamic buffer area.
Let ID of server main process be 0, ID of client process be 1, information source of client be "10243798374135624", and server QR code buffer allocable amount be N.
The client acquires the two-dimensional code of the server:
s1, a client sends a request for acquiring a two-dimensional code to a server by using an MPI _ send (0, 1) function;
s2, the client sends the information source to the server by using an MPI _ send (0, 10243798374624 ") function;
s3, the client side obtains the two-dimension code sent by the server by utilizing MPI _ Recv (0, 1, qr _buffer, & status), the operation is blocking operation, and if the server does not have the available two-dimension code, the client side can wait for all the time;
and S4, the client acquires the two-dimension code of the server and finishes the acquisition.
The server generates a QR two-dimensional code:
s1, a server main process receives a request of a client by using MPI _ Recv (0, 1, N, & status);
s2, the server main process receives the information source of the client by using MPI _ Recv (0, 1, source, & status);
s3, the server main process generates a chaotic random bit sequence in parallel according to the case 1;
s4, the server main process fills the QR code two-dimensional matrix in parallel according to the case 2;
s5, the server main process stores the two-dimensional matrix into a QR code dynamic buffer QR _ buffer:
firstly, allocating dynamic linked list nodes and initializing a data area, a mutual exclusion area and a pointer area of the nodes; then, storing the generated QR code in a data area of the node; finally, adding the nodes into a dynamic linked list;
s6, the server main process sends the QR two-dimensional code to the client by utilizing MPI _ send (0, 1, QR _buffer);
and S7, the server generates the QR two-dimensional code and ends.
Finally, it should be noted that: the above examples are intended only to illustrate the technical process of the invention, and not to limit it; although the invention has been described in detail with reference to the foregoing examples, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing examples can be modified, or some technical features can be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions.

Claims (1)

1. A chaos mapping-based two-dimension code parallel generation method is characterized by comprising the following steps:
the server utilizes two threads and two different chaotic mapping modes of Logistic chaotic mapping and piecewise linear chaotic mapping to carry out parallel interference on a complete data code word of an information source, so that a chaotic random bit sequence is generated; the server parallelly fills the two-dimensional matrix of the QR code according to regions in a multithread parallel mode, and each thread is responsible for filling a task of one region, so that a QR two-dimensional code image is quickly generated; the client and the server interact by adopting an MPI function, the server stores the generated QR code two-dimensional matrix in a dynamic buffer area of a QR code to relieve the supply pressure of the server, and the dynamic buffer area is constructed in a dynamic linked list mode so as to dynamically distribute the QR code to the client to realize quick response;
when the chaotic random bit sequence is generated in parallel, the server dynamically creates threads and resides in a physical computing core by using Logistic chaotic mapping and piecewise linear chaotic mapping as generating functions according to the demand of a client, so as to realize the generation of the chaotic random bit sequence, wherein in each thread, control parameters and initial values are different, and a system generates random numbers as the control parameters and the iteration initial values of a chaotic equation to ensure that tracks are different, and the method mainly comprises the following steps:
s1, a server main process generates a complete data code word bit sequence Str _0 containing an information source according to the version and the error correction level of the selected QR two-dimensional code, wherein the length of the bit sequence is length;
s2, the server main process divides the bit sequence Str _0 into two bit sequences Str _1 and Str _2, and the length of each bit sequence is length/2;
s3, the server main process distributes two threads, namely thread _1 and thread _2, to generate a chaotic random bit sequence in parallel:
s3.1, the thread _1 utilizes Logistic chaotic mapping to interfere with the bit sequence Str _1, and further generates a chaotic random bit sequence Str _4:
first, random numbers between (0, 1) are generated by Logistic chaotic mapping:
x n+1 =x n *u*(1-x n ) U lies in the interval [0,4 ]]Upper, x n In the interval [0,1]In the above-mentioned manner,
iterating n = length/2 times to generate length/2 random numbers;
then, the random number binarization processing: when x is n In the interval (0, 0.5)]When x is 0 n When the random number is located in the interval (0.5, 1), the obtained random number is 1, and then a random bit sequence Str _3 is obtained;
finally, carrying out XOR operation on the bit sequence Str _1 and the random bit sequence Str _3 to obtain an interfered chaotic random bit sequence Str _4;
s3.2, the thread _2 interferes the bit sequence Str _2 by utilizing piecewise linear chaotic mapping, and further generates a chaotic random bit sequence Str _6:
first, random numbers between (0, 1) are generated by piecewise linear chaotic mapping:
when x is n In the interval 0, p]When above, x n+1 =x n P; when x is n In the interval (p, 1)]When above, x n+1 =(1-x n )/(1-p),
Iteration n = length/2 times is needed to generate length/2 random numbers;
then, the random number binarization processing: when x is n In the interval (0, 0.5)]When x is 0 n When the random number is located in the interval (0.5, 1), the obtained random number is 1, and then a random bit sequence Str _5 is obtained;
finally, performing XOR operation on the bit sequence Str _2 and the random bit sequence Str _5 to obtain an interfered chaotic random bit sequence Str _6;
s4, the server main process generates a chaotic random bit sequence in parallel and ends;
when the QR two-dimensional codes are filled in parallel, the server fills the two-dimensional matrix of the QR codes in a multithreading parallel mode, and accordingly QR two-dimensional code images are generated; the filling of the QR code is divided into six regions: the system comprises a detection graph area, a positioning graph area, a correction graph area, a format information area, a version information area and a data and error correction code word area, so that different areas are filled in a multi-thread parallel mode; when the data and error correction code word area is filled, the data and error correction code word area is divided into a left area and a right area, and the left area and the right area are filled with the remaining five areas in parallel; the left region is filled with a chaotic random bit sequence Str _4; the right area is filled with a chaotic random bit sequence Str _6, which mainly comprises:
s1, constructing an n-order square matrix A by a server main process according to the version and the error correction level of the QR code, and setting an initial value to be 0;
s2, the server main process distributes 7 threads to execute different subtasks in parallel:
the thread _1 fills the position detection area, namely, the position detection graphic area of the matrix A is set to be 1 according to the QR code format:
A[0][0…6]=A[2][2…4,6]=A[3][3,4,6]=A[4][4,6]=1;
A[0][n-7…n-1]=A[1][n-7,n-1]=A[2][n-7,n-5…n-3,n-1]=A[3][n-7,n-5…n-3,n-1]=A[4][n-7,n-5…n-3,n-1]=A[5][n-7…n-1]=A[6][n-7…n-1]=1;
the QR code format 1 setting operation only fills the upper right triangle of the matrix, and because the position detection graphic area is highly symmetrical in the matrix about the main diagonal, the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition;
filling the positioning graphic area by the thread _2, namely setting the positioning graphic area of the matrix A to be 1 according to a QR code format:
A[6][8,10,12…n-9]=1;
the operation only fills the upper right triangle of the matrix, and because the positioning graphic area is highly symmetrical in the matrix about the main diagonal line, the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition;
filling a corrected graph area by the thread _3, namely setting the corrected graph area of the QR code to be 1 according to the format of the QR code according to the version of the QR code, wherein the corrected graph numbers and positions of the QR codes of different versions are different; the correction graph area is highly symmetrical in the matrix with respect to the main diagonal, so that the upper right triangular area is filled first, and then the corresponding position of the lower left triangle of the matrix A is also set to be 1 through matrix transposition;
the thread _4 fills the format information area, namely, the information format of the QR code is filled, and the Dark Module part A [ n-9] [8] =1 is also filled;
the thread _5 fills a version information area, namely, the thread fills according to the version format of the QR code;
thread _6 fills the left area of the data code and error correction code word area, namely, the chaotic random bit sequence Str _4 is firstly inverted, then, the inverted bit sequence is used for filling and masking in sequence from the lower left corner, if the non-data and error correction code word area is met, the area is skipped over, and filling is continued;
filling a right area of the data and error correction code word area by the thread _7, namely, sequentially filling and masking by using the chaotic random sequence Str _6 according to the sequence from the lower right corner, and if a non-data and error correction code word area is met, skipping the area and continuing filling;
s3, the server fills the QR code two-dimensional matrix in parallel and finishes filling;
when the client side and the server interact, the client side and the server interact by adopting an MPI function, and a QR code generated by each processor core of the server is stored in a dynamic buffer area of the QR code; the dynamic buffer area of QR code is used for preserving the QR code that has been assembled and sent for the user to use, and client and server interaction process contains the client and obtains the two-dimensional code of server end through MPI and the server end sends the two-dimensional code in the buffer area to the client through MPI, and dynamic linked list node contains 3 parts: a data area, a mutual exclusion area and a pointer area; the data area is used for storing QR codes, and the mutual exclusion area is used for multithreading locking mutual exclusion access to realize parallelization; the pointer area stores the pointer address of the next node; the method mainly comprises the following steps:
the client acquires the two-dimensional code of the server through the MPI:
s1, a client sends a request for acquiring a two-dimensional code to a server by using an MPI _ send (main process ID of a QR code buffer area of the server, process ID of a request client) function;
s2, the client sends an information source to the server by using an MPI _ send (main process ID of a QR code buffer zone of the server, client information source) function;
s3, the client acquires the two-dimensional code sent by the server by using an MPI _ Recv (main process ID of a QR code buffer area of the server, process ID of a request client, a local buffer area for receiving the QR code and a communication state) function, wherein the operation is blocking operation, and if the server does not have the available two-dimensional code, the client waits for the two-dimensional code;
s4, the client end finishes the acquisition of the two-dimension code of the server;
the server side sends the two-dimensional code in the buffer area to the client side through the MPI:
s1, a server main process receives a request of a client by using an MPI _ Recv (main process ID of a QR code buffer area of a server, process ID of a request client, the distributable number of the current QR code buffer area and a communication state) function;
s2, the server main process receives the information source of the client by using an MPI _ Recv (main process ID of a QR code buffer area of the server, process ID of a request client, information source and communication state) function;
s3, generating a chaotic random bit sequence in parallel by the server main process;
s4, filling a QR code two-dimensional matrix in parallel by the server main process;
s5, the server main process stores the two-dimensional matrix into a QR code dynamic buffer area:
the generated QR codes are stored in the data area part of the dynamic linked list, and when one QR code is generated, a dynamic linked list node is distributed to the memory, and the three parts are initialized, so that the node is linked to the dynamic linked list; the exclusive area corresponding to the QR code access realizes the distribution of the node QR codes and the exclusive access process, the exclusive access is mainly designed by considering that in a multi-core processor, only one process is allowed to obtain the access of the QR codes when the multi-process access is carried out, one process obtains the QR codes, the exclusive area needs to be locked to finally obtain the QR codes, and if the exclusive area is locked, the next node is accessed according to the pointer area; after the QR codes are distributed, deleting the nodes of the dynamic linked list from the memory for use in preparation for continuously generating the QR codes, wherein the capacity of the dynamic linked list is determined according to the access amount and the set capacity of the server memory, so that the problems of delay and waiting caused by the increase of the access amount of the client can be relieved;
s6, the server main process sends the QR two-dimensional code to the client by utilizing an MPI _ send (main process ID of a server QR code buffer area, process ID of a request client and QR code data) function;
and S7, the server generates the QR two-dimensional code and ends.
CN201910013696.4A 2019-01-08 2019-01-08 Chaos mapping-based two-dimensional code parallel generation method Active CN109858588B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910013696.4A CN109858588B (en) 2019-01-08 2019-01-08 Chaos mapping-based two-dimensional code parallel generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910013696.4A CN109858588B (en) 2019-01-08 2019-01-08 Chaos mapping-based two-dimensional code parallel generation method

Publications (2)

Publication Number Publication Date
CN109858588A CN109858588A (en) 2019-06-07
CN109858588B true CN109858588B (en) 2022-10-18

Family

ID=66894089

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910013696.4A Active CN109858588B (en) 2019-01-08 2019-01-08 Chaos mapping-based two-dimensional code parallel generation method

Country Status (1)

Country Link
CN (1) CN109858588B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110263895B (en) * 2019-06-25 2023-02-17 北京慧眼智行科技有限公司 Code graph generation method and system
CN110958106B (en) * 2019-11-29 2020-10-23 珠海大横琴科技发展有限公司 Parallel hybrid chaotic system under precision limited mode
CN110912674B (en) * 2019-11-29 2020-09-01 珠海大横琴科技发展有限公司 Image encryption method and device, electronic equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103414549A (en) * 2013-07-16 2013-11-27 广东工业大学 QR two-dimensional code binary image partition-based key varying chaotic encryption method
CN103427979A (en) * 2013-06-09 2013-12-04 浙江工业大学 Internet picture transparent and safe transmission method based on chaotic encryption
CN107194313A (en) * 2017-04-19 2017-09-22 中国国土资源航空物探遥感中心 A kind of parallel intelligent object-oriented classification method
CN108960387A (en) * 2018-07-12 2018-12-07 南京林业大学 A kind of anti-counterfeiting two dimensional code and its generation and recognition methods

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1320026A1 (en) * 2001-12-13 2003-06-18 STMicroelectronics S.r.l. Method for generating a random number sequence and a relative random bit generator
US20180293591A1 (en) * 2017-04-05 2018-10-11 General Electric Company System and Method for Authenticating Components Using Dual Key Authentication

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103427979A (en) * 2013-06-09 2013-12-04 浙江工业大学 Internet picture transparent and safe transmission method based on chaotic encryption
CN103414549A (en) * 2013-07-16 2013-11-27 广东工业大学 QR two-dimensional code binary image partition-based key varying chaotic encryption method
CN107194313A (en) * 2017-04-19 2017-09-22 中国国土资源航空物探遥感中心 A kind of parallel intelligent object-oriented classification method
CN108960387A (en) * 2018-07-12 2018-12-07 南京林业大学 A kind of anti-counterfeiting two dimensional code and its generation and recognition methods

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A digital watermarking approach based on DCT domain combining QR code and chaotic theory;Qingbo Kang,Ke Li,Jichun Yang;《2014 Eleventh International Conference on Wireless and Optical Communications Networks (WOCN)》;20141016;全文 *
数据分块并行优化的分布式AES加密算法;廖建飞,莫太平,黄进财;《科技通报》;20170531;全文 *

Also Published As

Publication number Publication date
CN109858588A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN109858588B (en) Chaos mapping-based two-dimensional code parallel generation method
CN108985066B (en) Intelligent contract security vulnerability detection method, device, terminal and storage medium
EP3000068B1 (en) Protecting data
CN105512881A (en) Method and terminal for completing payment on the basis of two-dimensional code
US20080250502A1 (en) Software Checking
US20200111190A1 (en) Method and apparatus for watermark embedding and extracting
US10489117B2 (en) Method and apparatus for generating random character string
CN110839014B (en) Authentication method, authentication device, computer equipment and readable storage medium
KR102558330B1 (en) Apparatus and method for distributing and storing data
CN108876864A (en) Image coding, coding/decoding method, device, electronic equipment and computer-readable medium
US20170048213A1 (en) Runtime instantiation of broadcast encryption schemes
US10817596B2 (en) Image based authentication code method, server, and authentication code system
Hu et al. Efficient JPEG batch steganography using intrinsic energy of image contents
CN109446761B (en) Information security processing method, storage medium and terminal equipment
CN109902493A (en) The delivery method and server of script
CN112434317A (en) Data processing method, device, equipment and storage medium
CN111552945B (en) Resource processing method, device and equipment
Mawgoud et al. A deep learning based steganography integration framework for ad-hoc cloud computing data security augmentation using the V-BOINC system
US20160379131A1 (en) Fuzzy opaque predicates
CN107272920B (en) Method and device for changing corresponding relation between keys and characters
Cai et al. Partial encryption of feature-based product models for collaborative development
US8643872B2 (en) Method and system for generating unique object identifiers for derived objects
CN109525553A (en) A kind of transmission protecting of URL request, intermediate equipment, server and system
Ahmed Developing Check-Point Mechanism to Protect Mobile Agent Free-Roaming Against Untrusted Hosts
CN102214095A (en) Generating exception-based component models from non-exception-based models

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