Data processing method, device, electronic device and storage medium

By performing format conversion and matrix operations on the data to be encrypted, a confusion matrix is ​​generated for secondary encryption, which solves the problem of low security of existing encryption and decryption algorithms in data transmission and significantly improves data security.

CN117156061BActive Publication Date: 2024-10-11CHONGQING JINKANG NEW ENERGY VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311117231.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-31
Publication Date
2024-10-11
Estimated Expiration
2043-08-31

AI Technical Summary

Technical Problem

Existing encryption and decryption algorithms are easily deciphered during data transmission, resulting in leakage of secret keys and low security of encrypted data.

Method used

By obtaining the data to be encrypted and performing format conversion, a numerical matrix and an image matrix are generated, and these matrices are combined to generate a confusion matrix, thereby achieving secondary encryption of the data to form encrypted picture data and improve data security.

Benefits of technology

It effectively avoids the leakage of secret keys, improves the security of encrypted data, makes the encryption method difficult to identify and decipher, and enhances the security of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117156061B_ABST
    Figure CN117156061B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data processing technology, and provides a data processing method, device, electronic device and storage medium. The method obtains data to be encrypted, and performs format conversion on the encrypted data according to a target format conversion method to obtain a numerical conversion set; then subsequently generates a numerical matrix according to the numerical conversion set, thereby converting the encrypted data into a matrix form, realizing the first encryption, and then obtains a target image, and generates an image matrix according to the image data corresponding to the target image, and generates a confusion matrix according to the numerical matrix and the image matrix, wherein the numerical matrix is ​​confused into the image matrix generated by the target image, thereby realizing the encryption operation on the data matrix, thereby realizing the secondary encryption of the encrypted data through the image matrix, and improving the security of the data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] In the complex environment of the Internet, data security during transmission is very important. If necessary encryption measures are not taken and plain text transmission is adopted, hackers can easily intercept data packets on the network and use the public TCP / IP protocol to decompose the packets and obtain our core data.

[0003] In order to solve the above problems, the traditional approach is to use existing encryption and decryption algorithms to directly encrypt plain text to prevent network interception and obtain plain text passwords, such as MD5 encryption, DES / AES encryption, and base64 encryption. However, the above encryption and decryption algorithms all have different defects. Taking MD5 encryption as an example, MD5 encryption is irreversible, and the server also stores encrypted strings. Once the encrypted string is intercepted, it is equivalent to exposing the plain text password.

[0004] In summary, although the above method can ensure the security of data transmission to a certain extent, its encryption and decryption method is easy to be deciphered and has a low security factor. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a data processing method, device, electronic device and storage medium to solve the problem in the prior art that the secret key is easily leaked, resulting in the encrypted data being easily deciphered and obtained.

[0006] According to a first aspect of an embodiment of the present application, a data processing method is provided, which includes: obtaining data to be encrypted, and converting the format of the data to be encrypted according to a target format conversion method to obtain a numerical conversion set; obtaining a target image, and generating an image matrix according to image data corresponding to the target image; generating a numerical matrix according to the numerical conversion set; generating a confusion matrix according to the numerical matrix and the image matrix, and generating encrypted image data corresponding to the data to be encrypted according to the confusion matrix.

[0007] According to a second aspect of an embodiment of the present application, a data processing device is provided, which includes: an acquisition module, used to acquire data to be encrypted, and convert the format of the data to be encrypted according to a target format conversion method to obtain a numerical conversion set; a generation module, used to acquire a target image, and generate an image matrix according to image data corresponding to the target image; a processing module, used to generate a numerical matrix according to the numerical conversion set, and the number of columns of the numerical matrix is ​​the same as the number of columns of the image matrix; an encryption module, used to generate a confusion matrix according to the numerical matrix and the image matrix, and generate encrypted picture data corresponding to the data to be encrypted according to the confusion matrix.

[0008] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0009] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0010] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in the embodiments of the present application, the data to be encrypted is obtained, and the format of the data to be encrypted is converted according to the target format conversion method to obtain a numerical conversion set; then a numerical matrix is ​​subsequently generated according to the numerical conversion set, thereby converting the data to be encrypted into a matrix form, thereby realizing the first encryption, and then the target image is obtained, and an image matrix is ​​generated according to the image data corresponding to the target image, and a confusion matrix is ​​generated according to the numerical matrix and the image matrix, wherein the numerical matrix is ​​confused with the image matrix generated by the target image, thereby realizing the encryption operation on the data matrix, thereby realizing the secondary encryption of the encrypted data through the image matrix, and in addition, the numerical matrix is ​​confused with the image matrix generated by the target image, and the encryption method is not easy to identify, thereby further improving the security of the data to be encrypted, and avoiding the problem in the related technology that the secret key is easily leaked, resulting in the encrypted data being easily deciphered and obtained. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0012] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present application;

[0013] Figure 2 It is a flowchart of a data processing method provided in an embodiment of the present application;

[0014] Figure 3 It is a flowchart of another data processing method provided in an embodiment of the present application;

[0015] Figure 4 It is a flowchart of another data processing method provided in an embodiment of the present application;

[0016] Figure 5It is a basic schematic diagram of a numerical matrix provided in an embodiment of the present application;

[0017] Figure 6 It is a flowchart of another data processing method provided in an embodiment of the present application;

[0018] Figure 7 It is a basic schematic diagram of completing a numerical matrix to obtain a completed matrix provided by an embodiment of the present application;

[0019] Figure 8 This is a basic schematic diagram of completing an image matrix to obtain a completed matrix provided by an embodiment of the present application;

[0020] Fig. 9 It is a flowchart of another optional data processing method provided in an embodiment of the present application;

[0021] Fig.10 It is a flowchart of another optional data processing method provided in an embodiment of the present application;

[0022] Fig.11 It is a flowchart of another optional data processing method provided in an embodiment of the present application;

[0023] Fig.12 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

[0024] Fig.13 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0026] A data processing method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0027] Figure 1 1 is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.

[0028] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present application are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0029] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, a server cluster composed of several servers, or a cloud computing service center, which is not limited in the present application.

[0030] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present application are not limited to this.

[0031] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present application.

[0032] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc.

[0033] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present application do not limit this.

[0034] A data processing method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0035] Figure 2 This is a data processing method provided by an embodiment of the present application, such as Figure 2 As shown, the method includes:

[0036] S201, obtaining data to be encrypted, and performing format conversion on the data to be encrypted according to a target format conversion method to obtain a value conversion set;

[0037] S202, acquiring a target image, and generating an image matrix according to image data corresponding to the target image;

[0038] S203, generating a numerical matrix according to the numerical transformation set;

[0039] S204: Generate a confusion matrix according to the numerical matrix and the image matrix, and generate encrypted picture data corresponding to the data to be encrypted according to the confusion matrix.

[0040] Specifically, take the execution of steps S201 to S204 by the terminal as an example (it can be understood that the steps S201 to S204 can be partially executed by the terminal and partially executed by the server. This example only takes the execution of the steps by the terminal as an example, and is not used to limit the steps to be executed only by the terminal); the data to be encrypted is a character string to be encrypted determined by the terminal, and the character string is composed of at least any one of letters, symbols and numbers. After determining the character string to be encrypted, the terminal splits the character string into a character set with a length of 1, and then performs format conversion on each character in the character set according to the target format conversion method to obtain a numerical conversion set, wherein the target format conversion method includes but is not limited to: one of a binary conversion method, a decimal conversion method, and an octal conversion method; it can be understood that all characters in the data to be encrypted use the same target format conversion method.

[0041] Continuing with the above example, taking the data to be encrypted as the string "AB" and the target format conversion method as the binary conversion method, the terminal first converts the string into a character set, which contains two characters: A and B. Then the terminal converts "A" into a binary representation "01000010" through the binary conversion method, and converts "B" into a binary representation "01000011" through the binary conversion method, and puts "01000010" and "01000011" into a set to obtain a numerical conversion set.

[0042] In some examples, obtaining a target image includes but is not limited to: obtaining a target image from a server, obtaining a target image from local storage; it is understandable that the target image may be a randomly obtained image, or a preset default image; for example, the terminal randomly obtains an image from the server as the target image, and then determines the image data corresponding to the target image, and generates an image matrix based on the image data; it is understandable that the method of generating an image matrix based on image data is not limited in this embodiment, and relevant personnel may flexibly select a specific method, for example, generating an image matrix from image data using any method in Python, Java, and C language.

[0043] In some examples, a numerical matrix is ​​generated according to a numerical transformation set, and the number of columns of the generated numerical matrix is ​​the same as the number of columns of the image matrix, for example, if the image matrix has N columns of elements, then the numerical matrix also has N columns of elements; in some examples, the number of rows of the generated numerical matrix is ​​the same as the number of rows of the image matrix, for example, if the image matrix has N rows of elements, then the numerical matrix also has N rows of elements. It can be understood that at least one of the number of rows and the number of columns of the numerical matrix and the image matrix is ​​the same.

[0044] In some examples, after obtaining the image matrix and the numerical matrix, a confusion matrix is ​​generated according to the numerical matrix and the image matrix. The method of generating the confusion matrix will be described in detail later and will not be repeated here. After generating the confusion matrix, the encrypted image data corresponding to the data to be encrypted is generated according to the confusion matrix. It can be understood that this embodiment also does not limit the specific method of "generating the encrypted image data corresponding to the data to be encrypted according to the confusion matrix". Relevant personnel can flexibly choose the method to implement the above steps, for example, the confusion matrix is ​​converted into encrypted image data by any method in Python, Java and C language.

[0045] According to the technical solution provided in the embodiment of the present application, the data to be encrypted is obtained, and the format of the data to be encrypted is converted according to the target format conversion method to obtain a numerical conversion set; then a numerical matrix is ​​subsequently generated according to the numerical conversion set, and the data to be encrypted is converted into a matrix form, and the first encryption is realized. Then the target image is obtained, and an image matrix is ​​generated according to the image data corresponding to the target image, and a confusion matrix is ​​generated according to the numerical matrix and the image matrix, wherein the numerical matrix is ​​confused into the image matrix generated by the target image, and the encryption operation of the data matrix is ​​realized, and the secondary encryption of the encrypted data through the image matrix is ​​realized. In addition, the numerical matrix is ​​confused into the image matrix generated by the target image, and the encryption method is not easy to identify, thereby further improving the security of the data to be encrypted, and avoiding the problem in the related technology that the secret key is easy to leak, resulting in the encrypted data being easy to be deciphered and obtained.

[0046] In some embodiments, Figure 3 As shown, a target image is obtained, and an image matrix is ​​generated according to the image data corresponding to the target image, including:

[0047] S301, obtaining a target image from a server, and determining grayscale data of the target image;

[0048] S302, determining the number of rows and columns of the image matrix according to the resolution of the target image, and constructing an initial image matrix based on the determined number of rows and columns;

[0049] S303 , assigning values ​​to elements in the initial image matrix according to the grayscale data of the target image to obtain an image matrix.

[0050] Specifically, after obtaining the target image from the server, the grayscale data of the target image is determined, wherein the method for determining the grayscale data of the target image includes but is not limited to: obtaining the grayscale data of the target image using a programming language, obtaining the grayscale data of the target image using image processing software, and obtaining the grayscale data of the target image using a data formula; taking the use of a programming language to obtain the grayscale data of the target image as an example, the programming language is input through the MTLAB tool to obtain the grayscale data of the target image. It can be understood that in some examples, in order to reduce the amount of calculation for obtaining the grayscale data of the target image, the server can perform grayscale processing on the image so that the target image obtained from the server is a grayscale image.

[0051] In some examples, after obtaining the grayscale data, the number of rows and columns of the image matrix is ​​determined according to the resolution of the target image, and the initial image matrix is ​​constructed based on the determined number of rows and columns; specifically, after obtaining the resolution of the target image, the width of the resolution is used as the number of columns of the image matrix, and the height of the resolution is used as the number of rows of the image matrix; for example, the resolution of the target image is N*M, that is, the width of the target image resolution is N, and the height of the target image resolution is M, then N is used as the number of columns of the image matrix, and M is used as the number of rows of the image matrix.

[0052] Finally, each element in the initial image matrix is ​​assigned a value according to the grayscale data of the target image to obtain the image matrix. It can be understood that each pixel in the target image corresponds to an element in the initial image matrix, and the grayscale data corresponding to each pixel is assigned to the corresponding element, thereby realizing the assignment of each element in the initial image matrix.

[0053] It can be understood that this embodiment is not used to limit the present scheme to constructing an image matrix only through the grayscale data of the target image; in some examples, the image matrix can also be constructed by any of the RGB data, HSV data and YUV data of the target image, wherein the specific construction method is the same as the above method and will not be repeated here.

[0054] According to the technical solution provided in the embodiment of the present application, the target image is obtained from the server, and the grayscale data of the target image is determined; the number of rows and columns of the image matrix is ​​determined according to the resolution of the target image, and the initial image matrix is ​​constructed based on the determined number of rows and columns; the elements in the initial image matrix are assigned values ​​according to the grayscale data of the target image to obtain the image matrix, thereby realizing the construction of an image matrix having a corresponding relationship with the target image, avoiding the problem of arbitrary use of the matrix, which is too random and leads to the inability to decrypt, and also avoiding the problem of using a fixed matrix, which leads to a high risk of leakage. In addition, when there is a subsequent decryption demand, the terminal with the decryption demand can reconstruct the corresponding image matrix according to the target image, avoiding the problem of direct transmission of the encrypted matrix, which leads to the easy leakage of the encrypted matrix.

[0055] In some embodiments, Figure 4 As shown, a numerical matrix is ​​generated according to a set of numerical transformations, including:

[0056] S401, determining a target division method, and determining the number of target matrix columns according to the image matrix;

[0057] S402 , dividing the numerical transformation set according to the target division method and the number of target matrix columns to obtain a numerical matrix.

[0058] Specifically, relevant personnel preset multiple division methods in advance, and then determine the target division method from the multiple division methods. The above division methods include but are not limited to the following methods:

[0059] The first way: from left to right, from top to bottom;

[0060] The second way: from right to left, from top to bottom;

[0061] The third way: from left to right, from bottom to top;

[0062] The fourth way: from right to left, from bottom to top.

[0063] Continuing with the above example, the method of determining the target division method includes but is not limited to: randomly determining the target division method from the division methods, determining the target division method from the division methods according to preset rules; wherein the preset rules are flexibly set by relevant personnel, for example, the above preset rules are to determine the target division method according to the current time, then when determining the target division method, the current time is obtained, and the target division method is determined from multiple division methods based on the current time; for another example, the above preset rules are to cyclically determine the target division method, then when determining the target division method, the first time the target division method is determined is the first method, the second time the target division method is determined is the second method... the fifth time the target division method is determined is the first method, and so on. It can be understood that in some examples, only one division method can be set. When only one division method is set, the only division method can be directly used as the target division method.

[0064] In some examples, the number of columns of the target matrix is ​​determined based on the image matrix, including obtaining the number of columns of the image matrix and using the number of columns of the image matrix as the number of columns of the target matrix; for example, if the number of columns of the image matrix is ​​N (the image matrix has N columns of elements), then the number of columns of the target matrix is ​​N.

[0065] In some examples, the numerical transformation set is divided according to the target division method and the number of target matrix columns to obtain a numerical matrix; specifically, taking the numerical transformation set corresponding to the to-be-encrypted data "AB" as {0100001001000011}, the target division method as "from left to right, from top to bottom", and the number of target matrix columns as 6 as an example, the numbers in the numerical transformation set are arranged in sequence from left to right and from top to bottom to obtain a numerical matrix, such as Figure 5 As shown; it can be understood that in the numerical matrix, if there is a vacancy in a row of elements, the vacant elements are filled with specified values, and the above specified values ​​do not include but are not limited to -1.

[0066] It can be understood that in some examples, the number of target matrix rows can be determined based on the image matrix, and the numerical transformation set can be divided according to the number of target matrix rows and the target division method to obtain a numerical matrix.

[0067] According to the technical solution provided in the embodiment of the present application, a target division method is determined, and the number of target matrix columns is determined according to the numerical matrix; according to the target division method and the number of target matrix columns, the numerical transformation set is divided to obtain a numerical matrix, wherein the target matrix column number and the target division method are determined to accurately divide the numerical transformation set into corresponding numerical matrices, so that the number of columns of the numerical matrix is ​​the same as the number of columns of the image matrix, thereby facilitating subsequent operations on the image matrix and the numerical matrix, and avoiding the problem of randomly determining the rows and columns of the numerical matrix, which results in the inability to subsequently operate the numerical matrix and the image matrix together and encryption failure.

[0068] In some examples, such as Figure 6 As shown, a confusion matrix is ​​generated based on a numerical matrix and an image matrix, including:

[0069] S601, classifying the numerical matrix and the image matrix respectively, to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix;

[0070] S602, determining the number of target matrix rows according to the sample matrix;

[0071] S603, based on the number of rows of the target matrix and the preset completion method, a completion operation is performed on the matrix to be completed to obtain a completed matrix;

[0072] S604: Generate a confusion matrix according to the completion matrix and the sample matrix.

[0073] Specifically, if the number of columns of the numerical matrix and the image matrix is ​​equal, the numerical matrix and the image matrix are classified respectively to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix, including: obtaining the number of rows of the numerical matrix and the number of rows of the image matrix, comparing the number of rows of the numerical matrix with the number of rows of the image matrix, taking the matrix with a lower number of rows as the matrix to be completed, and taking the matrix with a higher number of rows as the sample matrix; for example, the number of rows of the numerical matrix is ​​X, and the number of rows of the image matrix is ​​Y, when X is greater than Y, the image matrix is ​​taken as the matrix to be completed, and the numerical matrix is ​​taken as the sample matrix, and vice versa when X is less than Y, the image matrix is ​​taken as the sample matrix, and the numerical matrix is ​​taken as the matrix to be completed. It can be understood that if X=Y, the confusion matrix can be directly generated according to the numerical matrix and the image matrix, and there is no need to determine the completion matrix and the sample matrix.

[0074] In some examples, after the sample matrix is ​​determined, the number of target matrix rows is determined according to the sample matrix. Specifically, the number of rows of the sample matrix is ​​directly used as the number of rows of the target matrix. For example, if the number of rows of the sample matrix is ​​N, then the number of rows of the target matrix is ​​N.

[0075] In some examples, based on the number of rows of the target matrix and a preset completion method, a completion operation is performed on the matrix to be completed to obtain a completed matrix, wherein the preset completion method includes but is not limited to: using a specified value to perform a padding operation on the matrix to be completed until the number of rows of the obtained completed matrix is ​​the same as the number of rows of the sample matrix; for example, taking the matrix to be completed as a numerical matrix as an example, wherein the sample matrix (image matrix) has N rows of elements, the numerical matrix is ​​padded by "-1" until the number of rows of the numerical matrix is ​​equal to the number of rows of the image matrix, such as Figure 7 As shown; for another example, take the matrix to be completed as an image matrix (the elements in the image matrix are replaced by x), where the sample matrix (image matrix) has N rows of elements, and the image matrix is ​​filled with "-1" until the number of rows of the image matrix is ​​equal to the number of rows of the numerical matrix, as shown Figure 8 shown.

[0076] Continuing with the above example, after completing the matrix to be completed and obtaining the completed matrix, the number of rows and columns of the matrix to be completed and the sample matrix are the same. Therefore, at this time, a confusion matrix can be generated based on the completed matrix and the sample matrix, thereby realizing the encryption of the numerical matrix.

[0077] It can be understood that in some examples, if the number of rows of the numerical matrix and the image matrix are the same when generating the numerical matrix, then this example can also determine the number of columns of the target matrix according to the sample matrix, and based on the number of columns of the target matrix and the preset completion method, perform a completion operation on the matrix to be completed to obtain a completed matrix.

[0078] According to the technical solution provided in the embodiment of the present application, the numerical matrix and the image matrix are classified respectively to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix; the number of rows of the target matrix is ​​determined according to the sample matrix; based on the number of rows of the target matrix and the preset completion method, the matrix to be completed is completed to obtain the completed matrix; a confusion matrix is ​​generated according to the completed matrix and the sample matrix, wherein the number of rows of the target matrix is ​​determined according to the sample matrix, so that the sample matrix and the matrix to be completed have the same number of rows and the same number of columns, which facilitates the subsequent operation of the sample matrix and the completed matrix to obtain the confusion matrix.

[0079] In some examples, such as Fig. 9 As shown, the confusion matrix is ​​generated based on the completion matrix and the sample matrix, including:

[0080] S901, determining a target operation mode;

[0081] S902, operating the completion matrix and the sample matrix according to the target operation mode to obtain an initial confusion matrix;

[0082] S903: Generate identification data based on the target operation mode, and add the identification data to the initial confusion matrix to obtain the confusion matrix.

[0083] Specifically, the operation methods between matrices include but are not limited to: addition operation, subtraction operation; the method of determining the target operation method includes but is not limited to: randomly determining the target operation method from the operation methods, determining the target operation method from the operation methods according to preset operation determination rules. The above-mentioned preset operation determination rules are flexibly set by relevant personnel according to actual needs, and will not be repeated here.

[0084] In some examples, after determining the target operation mode, the completion matrix and the sample matrix are operated according to the target operation mode to obtain an initial confusion matrix; specifically, taking the target operation mode as an addition operation as an example, the completion matrix and the sample matrix are added to obtain the initial confusion matrix. It can be understood that by determining the target operation mode from at least two operation modes, the problem of using only one operation mode in the related art, which makes the confusion matrix easy to be parsed, is avoided, thereby improving the encryption security of the confusion matrix.

[0085] In some examples, after the initial confusion matrix is ​​generated, corresponding identification data is generated based on the target operation mode, and the identification data is added to the initial confusion matrix to obtain the confusion matrix; specifically, for example, taking the addition operation identification as 1 and the subtraction operation identification as 0, if the target operation mode is 1, an identification element row is added to the top of the initial confusion matrix, and the identification element row is used to identify that the initial confusion matrix is ​​a matrix obtained by the addition operation mode; in some examples, the identification element row is composed entirely of 1s, and in some examples, the first bit of the identification element row is 1, and the remaining bits are 0s; it can be understood that in some examples, an identification element row can also be added to the bottom of the initial confusion matrix, an identification element column can be added to the left side of the initial confusion matrix, and an identification element column can be added to the right side of the initial confusion matrix.

[0086] It can be understood that, in some examples, the confusion matrix also includes a conversion method identification row and / or a conversion method identification column, which can characterize the target format conversion method when converting the data to be encrypted into a numerical conversion set.

[0087] According to the technical solution provided in the embodiment of the present application, a target operation mode is determined; the completion matrix and the sample matrix are operated according to the target operation mode to obtain an initial confusion matrix; identification data is generated based on the target operation mode, and the identification data is added to the initial confusion matrix to obtain a confusion matrix, wherein, by determining the target operation mode, the completion matrix and the sample matrix are combined, thereby achieving the determination of the confusion matrix, and at the same time, the identification data corresponding to the target operation mode is added to the confusion matrix, so that when the confusion matrix is ​​subsequently received, the target operation mode when the confusion matrix is ​​generated can be accurately obtained, and then the confusion matrix can be parsed according to the target operation mode, thereby avoiding the problem that the confusion matrix cannot be parsed due to the target operation mode not being carried in the confusion matrix.

[0088] In some examples, such as Fig.10 As shown, after generating encrypted image data corresponding to the data to be encrypted according to the confusion matrix, the method further includes:

[0089] S1001, determining the image identification of the target image;

[0090] S1002: Send the image identifier and the encrypted image to the server, so that the server obtains the target image according to the image identifier, and decrypts the encrypted image data according to the target image to obtain the data to be encrypted.

[0091] Specifically, an image identifier of a target image is determined, and the image identifier has a unique correspondence with the target image, that is, other clients and / or servers can determine the target image according to the image identifier.

[0092] Continuing with the above example, after determining the image identifier corresponding to the target image, the image identifier and the encrypted image are sent to the server, so that the server can obtain the target image according to the image identifier, and decrypt the encrypted image data according to the target image to obtain the data to be encrypted. It can be understood that there are multiple images stored in the server, and the server can determine the target image from the images according to the image identifier.

[0093] According to the technical solution provided in the embodiment of the present application, the image identifier of the target image is determined; the image identifier and the encrypted image are sent to the server, so that the server obtains the target image according to the image identifier, and decrypts the encrypted image data according to the target image to obtain the data to be encrypted. After the image identifier and the encrypted image data are sent to the server, the server can decrypt the encrypted image data according to the image identifier, thereby avoiding sending the target image or the secret key directly to the server, thereby further ensuring the security of the data to be encrypted.

[0094] In some examples, such as Fig.11As shown, the encrypted picture data is decrypted according to the target image to obtain the data to be encrypted, including:

[0095] S1101, the server determines an image matrix according to the target image, and converts the encrypted image data into a confusion matrix;

[0096] S1102, determining a numerical matrix according to the confusion matrix and the image matrix;

[0097] S1103, converting the numerical matrix into a numerical character set, and performing a reverse conversion on the numerical character set based on a target format conversion method to obtain data to be encrypted.

[0098] Specifically, the server determines the image matrix corresponding to the target image in the same manner as the client, which is not described in detail here. Similarly, the server converts the encrypted image data into a confusion matrix, wherein the manner of converting the encrypted image data into the confusion matrix is ​​the same as the manner of generating the image matrix according to the image data in the above step S202, which is not described in detail here.

[0099] In some examples, the server determines a numerical matrix based on a confusion matrix and an image matrix, including: the server determines identification data from the confusion matrix, and determines the corresponding target operation mode and the initial confusion matrix based on the identification data, and operates the initial confusion matrix and the image matrix based on an operation mode opposite to the target operation mode, thereby determining the numerical matrix; for example, the server determines that the target operation mode is an addition operation based on the identification data, and determines that the operation mode opposite to the addition operation is a subtraction operation, and then subtracts the image matrix from the initial confusion matrix to obtain a numerical matrix.

[0100] In some examples, if the initial confusion matrix is ​​composed of a completion matrix and a sample matrix, the completion matrix and the sample matrix need to be determined. Specifically, by comparing the number of rows of the image matrix and the initial confusion matrix, if the number of rows of the image matrix is ​​equal to the number of rows of the initial confusion matrix, it indicates that when the initial confusion matrix is ​​generated, the completion matrix is ​​obtained by completing the numerical matrix, and the sample matrix is ​​the image matrix. In this case, the image matrix is ​​not processed, and the initial confusion matrix and the image matrix are directly operated based on the operation method opposite to the target operation method, thereby determining the numerical matrix. If the number of rows of the image matrix is ​​lower than the number of rows of the initial confusion matrix, it indicates that when the initial confusion matrix is ​​generated, the completion matrix is ​​obtained by completing the image matrix, and the sample matrix is ​​a numerical matrix. In this case, the image matrix needs to be completed to obtain the completion matrix, and the initial confusion matrix and the completion matrix are operated based on the operation method opposite to the target operation method, thereby determining the numerical matrix. For the specific completion method, please refer to the above embodiment, which will not be repeated here.

[0101] In some examples, after determining the numerical matrix, the elements in the numerical matrix are grouped based on the target partitioning method to obtain a numerical character set; it can be understood that in some examples, in the process of grouping the elements in the numerical matrix, if a preset specified value is encountered, it indicates that the remaining elements in the numerical matrix are filler data, the reading is terminated, and the subsequent matrix data is no longer read and converted. For example, if the specified value is "-1", in the process of reading the elements of the numerical matrix, if -1 is encountered, it indicates that the remaining elements are filler data, the reading is terminated, and the subsequent matrix data is no longer read and converted.

[0102] Continuing from the above example, after determining the numeric character set, the server can determine the target format conversion method through the conversion method identification row and / or conversion method identification column carried in the confusion matrix, and perform reverse format conversion on the numeric character set through the target format conversion method to obtain the data to be encrypted. For example, taking the binary conversion method as an example, after reading the numeric character set, the data in the numeric character set is grouped into groups of eight digits, and each group of data is converted into ASCII code, and then concatenated in sequence to obtain the data to be encrypted.

[0103] It can be understood that the above step of decrypting the encrypted image data can be performed by any client and / or server.

[0104] According to the technical solution provided in the embodiment of the present application, in this example, the server determines an image matrix based on the target image, and converts the encrypted picture data into a confusion matrix; determines a numerical matrix based on the confusion matrix and the image matrix; converts the numerical matrix into a numerical character set, and reversely converts the numerical character set based on the target format conversion method to obtain the data to be encrypted, wherein the image matrix is ​​determined by the target image, and the confusion matrix is ​​decrypted by the image matrix, which ensures the security of the data to be encrypted while realizing reversible encryption and decryption operations, thereby improving the user experience.

[0105] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0106] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0107] This embodiment also provides a data processing device, such as Fig.12 As shown, the device comprises:

[0108] The acquisition module 1201 is configured to acquire the data to be encrypted, and perform format conversion on the data to be encrypted according to the target format conversion method to obtain a value conversion set;

[0109] A generating module 1202 is configured to obtain a target image and generate an image matrix according to image data corresponding to the target image;

[0110] The processing module 1203 is configured to generate a numerical matrix according to the numerical transformation set, wherein the number of columns of the numerical matrix is ​​the same as the number of columns of the image matrix;

[0111] The encryption module 1204 is configured to generate a confusion matrix according to the numerical matrix and the image matrix, and generate encrypted image data corresponding to the data to be encrypted according to the confusion matrix.

[0112] In some examples, the processing module 1203 is further configured to determine a target partitioning method and determine the number of target matrix columns based on the image matrix; and divide the numerical transformation set according to the target partitioning method and the number of target matrix columns to obtain a numerical matrix.

[0113] In some examples, the encryption module 1204 is also configured to classify the numerical matrix and the image matrix respectively to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix; determine the number of rows of the target matrix according to the sample matrix; based on the number of rows of the target matrix and the preset completion method, complete the matrix to be completed to obtain the completed matrix; generate a confusion matrix based on the completed matrix and the sample matrix.

[0114] In some examples, the encryption module 1204 is also configured to determine a target operation mode; perform operations on the completion matrix and the sample matrix according to the target operation mode to obtain an initial confusion matrix; generate identification data based on the target operation mode, and add the identification data to the initial confusion matrix to obtain a confusion matrix.

[0115] In some examples, the generation module 1202 is also configured to obtain a target image from a server and determine the grayscale data of the target image; determine the number of rows and columns of the image matrix according to the resolution of the target image, and construct an initial image matrix based on the determined number of rows and columns; assign values ​​to elements in the initial image matrix according to the grayscale data of the target image to obtain the image matrix.

[0116] In some examples, the encryption module 1204 is also configured to determine the image identifier of the target image; send the image identifier and the encrypted image data to the server so that the server obtains the target image according to the image identifier, and decrypts the encrypted image data according to the target image to obtain the data to be encrypted.

[0117] The server determines an image matrix according to the target image, and converts the encrypted image data into a confusion matrix; determines a numerical matrix according to the confusion matrix and the image matrix; converts the numerical matrix into a numerical character set, and reversely converts the numerical character set based on the target format conversion method to obtain the data to be encrypted.

[0118] According to the technical solution provided in the embodiment of the present application, the above-mentioned device in the embodiment of the present application obtains the data to be encrypted, and converts the format of the data to be encrypted according to the target format conversion method to obtain a numerical conversion set; then subsequently generates a numerical matrix according to the numerical conversion set, and then realizes the conversion of the data to be encrypted into the form of a matrix, realizes the first encryption, and then obtains the target image, and generates an image matrix according to the image data corresponding to the target image, and generates a confusion matrix according to the numerical matrix and the image matrix, wherein the numerical matrix is ​​confused into the image matrix generated by the target image, and then the encryption operation of the data matrix is ​​realized, and then the secondary encryption of the encrypted data through the image matrix is ​​realized. In addition, the numerical matrix is ​​confused into the image matrix generated by the target image, and the encryption method is not easy to identify, thereby further improving the security of the data to be encrypted, and avoiding the problem in the related technology that the secret key is easy to leak, resulting in the encrypted data being easy to be deciphered and obtained.

[0119] Fig.13 Schematic diagram of an electronic device 13 provided in an embodiment of the present application. Fig.13 As shown, the electronic device 13 of this embodiment includes: a processor 1301, a memory 1302, and a computer program 1303 stored in the memory 1302 and executable on the processor 1301. When the processor 1301 executes the computer program 1303, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1301 executes the computer program 1303, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0120] The electronic device 13 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 13 may include, but is not limited to, a processor 1301 and a memory 1302. Those skilled in the art will appreciate that Fig.13 The electronic device 13 is merely an example and does not limit the electronic device 13 , and may include more or less components than those shown in the figure, or different components.

[0121] The processor 1301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0122] The memory 1302 may be an internal storage unit of the electronic device 13, for example, a hard disk or memory of the electronic device 13. The memory 1302 may also be an external storage device of the electronic device 13, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 13. The memory 1302 may also include both an internal storage unit of the electronic device 13 and an external storage device. The memory 1302 is used to store computer programs and other programs and data required by the electronic device.

[0123] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0124] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0125] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Acquire data to be encrypted, and perform format conversion on the data to be encrypted according to a target format conversion method to obtain a numerical conversion set; Acquire a target image, and generate an image matrix according to image data corresponding to the target image; generating a numerical matrix according to the numerical transformation set; The numerical matrix and the image matrix are classified respectively to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix; the number of target matrix rows is determined according to the sample matrix; based on the number of target matrix rows and a preset completion method, the matrix to be completed is completed to obtain a completed matrix; an operation matrix is ​​generated according to the completed matrix and the sample matrix, and encrypted picture data corresponding to the data to be encrypted is generated according to the operation matrix.

2. The method according to claim 1, characterized in that: Generating a numerical matrix according to the numerical transformation set includes: Determine a target division method, and determine the number of target matrix columns according to the image matrix; The numerical transformation set is divided according to the target division method and the number of columns of the target matrix to obtain the numerical matrix.

3. The method according to claim 1, characterized in that Generating the operation matrix according to the completion matrix and the sample matrix includes: Determine the target operation mode; Performing operations on the completion matrix and the sample matrix according to the target operation mode to obtain an initial operation matrix; Identification data is generated based on the target operation mode, and the identification data is added to the initial operation matrix to obtain the operation matrix.

4. The method according to claim 1, characterized in that: Acquiring a target image and generating an image matrix according to image data corresponding to the target image, including: Acquire the target image from the server, and determine the grayscale data of the target image; Determining the number of rows and columns of the image matrix according to the resolution of the target image, and constructing an initial image matrix based on the determined number of rows and columns; The elements in the initial image matrix are assigned values ​​according to the grayscale data of the target image to obtain the image matrix.

5. The method according to claim 1, characterized in that After generating the encrypted picture data corresponding to the data to be encrypted according to the operation matrix, the method further includes: Determining an image identifier of the target image; The image identifier and the encrypted picture data are sent to a server, so that the server obtains the target image according to the image identifier, and decrypts the encrypted picture data according to the target image to obtain the data to be encrypted.

6. The method according to claim 5, characterized in that Decrypting the encrypted picture data according to the target image to obtain the data to be encrypted includes: The server determines the image matrix according to the target image, and converts the encrypted image data into the operation matrix; Determine the numerical matrix according to the operation matrix and the image matrix; The numerical matrix is ​​converted into the numerical transformation set, and the numerical transformation set is reversely transformed based on the target format conversion method to obtain the data to be encrypted.

7. A data processing device, characterized in that: The device comprises: An acquisition module is used to acquire data to be encrypted, and perform format conversion on the data to be encrypted according to a target format conversion method to obtain a numerical conversion set; A generating module, used for acquiring a target image and generating an image matrix according to image data corresponding to the target image; A processing module, used for generating a numerical matrix according to the numerical transformation set, wherein the number of columns of the numerical matrix is ​​the same as the number of columns of the image matrix; The encryption module is used to classify the numerical matrix and the image matrix respectively to determine the matrix to be completed and the sample matrix from the numerical matrix and the image matrix; determine the number of rows of the target matrix according to the sample matrix; based on the number of rows of the target matrix and a preset completion method, perform a completion operation on the matrix to be completed to obtain a completed matrix; generate an operation matrix according to the completed matrix and the sample matrix, and generate encrypted picture data corresponding to the data to be encrypted according to the operation matrix.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.