A method and device for cracking SM3 password based on OpenCL

By calling the SM3 algorithm kernel function on the OpenCL platform and combining GPU parallel computing, the problem of slow SM3 password cracking speed under traditional CPU computing methods is solved, achieving more efficient password cracking efficiency and data security.

CN118520484BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410985804.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-26
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

The existing SM3 algorithm uses traditional CPU computing methods to crack passwords slowly, which is difficult to meet the security and efficiency requirements of modern cryptography.

Method used

Using OpenCL-based method, the kernel function of the SM3 algorithm is called by the OpenCL device for cyclic compression and iterative compression, and the encrypted samples are divided into multiple parallel data blocks using parallel computing power, and combined with the collaborative calculation of the CPU and GPU, the cracking process is optimized.

Benefits of technology

It significantly improves the speed and efficiency of password cracking, achieves cracking speed 20% faster than traditional methods, and improves data security and the credibility of security products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520484B_ABST
    Figure CN118520484B_ABST
Patent Text Reader

Abstract

The present invention relates to an SM3 password cracking method and device based on OpenCL, the method comprising: collecting encrypted samples, and extracting features of the encrypted samples to obtain feature values; obtaining OpenCL devices, using SM3 algorithms as kernel functions called by OpenCL main programs, and performing cyclic compression on predicted passwords through the OpenCL devices to obtain output values; compiling OpenCL objects for target devices, calling kernel functions to crack encrypted samples according to the output values, and obtaining password plaintext; comparing the password plaintext with the feature values, using the password plaintext consistent with the feature values ​​as the cracking password corresponding to the encrypted samples and storing it in the device memory of the target device. The present invention can improve the speed and efficiency of password cracking and improve data security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of password solving, and in particular relates to an OpenCL-based SM3 password cracking method and device. Background Art

[0002] The SM3 algorithm is a hash algorithm based on the Merkle-Damgard structure, which has the characteristics of high security and strong versatility. With the continuous development of cryptography, the SM3 algorithm has become a widely used hash algorithm with broad application prospects in the field of information security. The SM3 algorithm is suitable for digital signatures and verification, message authentication code generation and verification, and random number generation in commercial cryptographic applications, and can meet the security requirements of a variety of cryptographic applications. At the same time, it can also provide security product manufacturers with standard positioning of products and technologies and standardized references to improve the credibility and interoperability of security products.

[0003] The SM3 algorithm has been widely used in the field of information security, but it has a large amount of calculation and is difficult to crack. The current SM3 algorithm uses the traditional CPU calculation method to crack passwords, which is slow and takes several hours or even longer. The existing SM3 password cracking method needs to further improve its cracking speed and efficiency to meet the requirements of modern cryptography for security and efficiency. Summary of the invention

[0004] In view of the above deficiencies in the prior art, the purpose of the invention is to provide an SM3 password cracking method and device based on OpenCL.

[0005] The first aspect of the present invention provides an SM3 password cracking method based on OpenCL, comprising:

[0006] S1: Collecting encrypted samples, and performing feature extraction on the encrypted samples to obtain feature values;

[0007] S2: Obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform cyclic compression on the prediction password through the OpenCL device to obtain an output value;

[0008] S3: compile an OpenCL object for the target device, and according to the output value, call a kernel function to crack the encrypted sample to obtain the password plaintext;

[0009] S4: Compare the password plaintext with the characteristic value, use the password plaintext consistent with the characteristic value as the cracked password corresponding to the encryption sample and store it in the device memory of the target device.

[0010] According to an OpenCL-based SM3 password cracking method provided by the present invention, step S1 also includes:

[0011] S11: parsing the encrypted sample to obtain attribute data;

[0012] The attribute data includes: sample direction, operation history data of other environments, and sample source.

[0013] According to an OpenCL-based SM3 password cracking method provided by the present invention, step S1 also includes:

[0014] S12: Determine whether the eigenvalue is a sample generated by the SM3 algorithm. If so, output the eigenvalue. If not, change the length of the eigenvalue to 256 bits so that the sample not generated by the SM3 algorithm can be used as the input value of the SM3 algorithm.

[0015] According to an OpenCL-based SM3 password cracking method provided by the present invention, the kernel function in step S2 includes message filling, message expansion, iterative compression, and result output.

[0016] According to an OpenCL-based SM3 password cracking method provided by the present invention, step S2 further comprises:

[0017] S21: Expanding the SM3 algorithm to match the SM3 loop compression function to obtain an optimized SM3 algorithm;

[0018] S22: Iteratively compress the optimized SM3 algorithm through a loop compression function to obtain an output value.

[0019] According to an OpenCL-based SM3 password cracking method provided by the present invention, the step of obtaining the cracked password in step S4 further includes:

[0020] S411: Determine whether the password plaintext of the preset iterative compression rounds is cracked successfully. If cracked successfully, output the successfully cracked password plaintext as the cracked password. If cracked unsuccessfully, execute step S412;

[0021] S412: Determine whether the password plaintext after multiple rounds of iterative compression is consistent with the characteristic value. If they are consistent, output the password plaintext that is consistent as the cracked password.

[0022] According to an OpenCL-based SM3 password cracking method provided by the present invention, in step S4, the step of storing the cracked password in the device memory of the target device further includes:

[0023] S421: Divide the cracked password into 32-bit units to obtain multiple grouping temporary variables;

[0024] S422: performing an XOR operation on the multiple grouping temporary variables and the initial state vector of SM3 to obtain a preprocessed sample;

[0025] S423: Transmit the preprocessed sample to a target device for storage.

[0026] According to an OpenCL-based SM3 password cracking method provided by the present invention, step S3 also includes:

[0027] S31: Dividing the encrypted sample into a plurality of parallel data blocks according to the parallel execution capability of the target device;

[0028] The expression of the parallel execution capability is:

[0029]

[0030] in, The number of parallel threads supported by the target device. is the block size of the divided parallel data blocks, is the number of work groups that are scheduled to execute on the target device simultaneously. The total amount of memory on the target device.

[0031] According to an OpenCL-based SM3 password cracking method provided by the present invention, step S4 also includes:

[0032] S43: Release the pointer corresponding to the unused OpenCL object.

[0033] The second aspect of the present invention further provides an SM3 password cracking device based on OpenCL, comprising:

[0034] Encrypted sample acquisition module: used to collect encrypted samples and also used to extract features from the encrypted samples to obtain feature values;

[0035] Compression module: used to obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform cyclic compression on the prediction password through the OpenCL device to obtain an output value;

[0036] The cracking sample acquisition module is used to compile the OpenCL object for the target device, and according to the output value, call the kernel function to crack the encrypted sample to obtain the password plain text;

[0037] Cracking module: used to compare the password plaintext with the characteristic value, use the password plaintext consistent with the characteristic value as the cracking password corresponding to the encrypted sample and store it in the device memory of the target device.

[0038] The beneficial effects of the present invention are as follows:

[0039] The present invention provides an OpenCL-based SM3 password cracking method and device, which provide technical support for password attack and defense in the field of cryptographic security challenges and cryptographic practical applications, help improve data security, provide powerful data protection capabilities for the development of the information technology field, provide security product manufacturers with standard positioning of products and technologies and standardized references, improve the credibility of security products, improve the efficiency of password cracking by combining deformation technology with dictionary attack, and adopt optimized algorithms and data structures to make the cracking process more efficient and more fault-tolerant. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings are only used to illustrate specific embodiments and are not considered to limit the present invention. In the entire drawings, the same reference symbols represent the same components. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.

[0041] Figure 1 A flow chart of an SM3 password cracking method based on OpenCL provided by an embodiment of the present invention;

[0042] Figure 2 A schematic diagram of an OpenCL-based SM3 password cracking device provided in an embodiment of the present invention.

[0043] Reference numerals:

[0044] 100, encryption sample acquisition module; 200, compression module; 300, cracking sample acquisition module; 400, cracking module. DETAILED DESCRIPTION

[0045] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in the field without making creative work should fall within the scope of protection of the present invention.

[0046] Furthermore, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts disclosed in the present invention.

[0047] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the orientation or position relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. is based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. The terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0048] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of methods and systems consistent with some aspects of the present invention as detailed in the appended claims.

[0049] In order to better understand the present invention, the research background of the present invention is firstly described below.

[0050] Password cracking is an important research field in cryptography. It decrypts encrypted information by exhaustive and dictionary attacks on passwords. Its purpose is to crack the password in the encryption system by trying different password strings, so as to achieve security assessment of the system.

[0051] Existing password cracking methods mainly use CPU for calculations, but due to the limited computing power of the CPU, the cracking speed is slow and it is powerless to crack complex passwords. However, with the popularity of GPU (graphics processing unit) and the rapid improvement of its performance, GPU computing has been widely used in the field of password cracking. GPU stands for graphics processing unit, which is a special type of processor mainly used for processing computer graphics and other applications. Compared with CPU, GPU has higher parallelism and floating-point computing power, and is suitable for application scenarios that require a lot of calculations. It can greatly shorten the cracking time and improve the efficiency of password cracking, providing a more practical and efficient solution for the security field.

[0052] At the same time, the development of GPU technology has also promoted the development of related software and frameworks, such as the parallel computing framework based on OpenCL, which can support cross-platform parallel development and bring more flexible and efficient computing solutions to the password cracking field. OpenCL (Open Computing Language) is a cross-platform high-performance programming language that can realize multi-device parallel computing. It has the advantages of openness, ease of use and scalability. The use of OpenCL technology can greatly improve the computing power and performance of computer systems and realize fast and efficient computing tasks. Using OpenCL to call heterogeneous chips can use a large number of processing cores and efficient memory access capabilities. When performing password cracking, the characteristics of parallel computing can be fully utilized to greatly improve the computing speed.

[0053] For commonly used cryptographic algorithms, such as MD5, SHA1 and other hash algorithms, OpenCL is hundreds of times faster than C language. The SM3 algorithm is a hash algorithm based on the Merkle-Damgard structure, which has the characteristics of high security and strong versatility. With the continuous development of cryptography, the SM3 algorithm has become a widely used hash algorithm with broad application prospects in the field of information security. The SM3 algorithm is suitable for digital signatures and verification, message authentication code generation and verification, and random number generation in commercial cryptographic applications, and can meet the security requirements of a variety of cryptographic applications. At the same time, it can also provide security product manufacturers with standard positioning of products and technologies and standardized references to improve the credibility and interoperability of security products.

[0054] The SM3 algorithm has been widely used in the field of information security, but it has a large amount of calculation and is difficult to crack. The current SM3 algorithm uses the traditional CPU calculation method to crack passwords, which is slow and takes several hours or even longer. The existing SM3 password cracking method needs to further improve its cracking speed and efficiency to meet the requirements of modern cryptography for security and efficiency.

[0055] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.

[0056] like Figure 1 As shown, the first aspect of the present invention provides an SM3 password cracking method based on OpenCL, comprising:

[0057] S1: Collecting encrypted samples, and performing feature extraction on the encrypted samples to obtain feature values;

[0058] In step S1, first obtain the sample encrypted by the SM3 hash function, and then perform feature extraction, specifically the 256-bit hash value output by the encrypted sample. In the context of SM3 hash function encryption, this hash value can be regarded as the feature value of the original message because it uniquely identifies the original message and will produce significant changes for any slight modification.

[0059] Wherein, step S1 also includes:

[0060] S12: Determine whether the eigenvalue is a sample generated by the SM3 algorithm. If so, output the eigenvalue. If not, change the length of the eigenvalue to 256 bits so that the sample not generated by the SM3 algorithm can be used as the input value of the SM3 algorithm.

[0061] Furthermore, after the feature value is extracted, it is necessary to determine whether the acquired feature value is a sample generated by the SM3 algorithm. If not, the sample needs to be processed to satisfy the cracking algorithm input value of 256 bits in length.

[0062] Wherein, step S1 also includes:

[0063] S11: parsing the encrypted sample to obtain attribute data;

[0064] The attribute data includes: sample direction, operation history data of other environments, and sample source.

[0065] In addition, when collecting encrypted samples in step S1, it is also necessary to judge the SM3 samples to determine whether they are single samples or batches. And understand the relevant data of the sample source and the area / address of the sample direction; secondly, understand whether the sample has been run in other environments. If so, determine the operation mode / scheme / rule / dictionary to avoid repeated cracking; finally, understand whether the generated sample is an individual / institution / test, whether it is a professionally trained / ordinary user, and some other information / file name, etc.

[0066] S2: Obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform loop compression on the prediction command through the OpenCL device to obtain an output value;

[0067] In this stage, first, an OpenCL platform is obtained through clGetPlatformIDs(). In a specific embodiment, the present invention selects the NVIDIA platform, then allocates space for the platform object, and then obtains the OpenCL device through clGetDeviceIDs(). In a specific embodiment, the present invention obtains A800. Subsequently, clCreateCommandQueue() is used to create a command queue, and the command queue establishes a connection between the device and the context. Then, clCreateContext() is used to create a context to use the Context to manage the context environment of OpenCL objects and resources.

[0068] The kernel function in step S2 includes message filling, message expansion, iterative compression, and result output.

[0069] Wherein, step S2 further comprises:

[0070] S21: Expanding the SM3 algorithm to match the SM3 loop compression function to obtain an optimized SM3 algorithm;

[0071] Furthermore, the above-mentioned message padding is to pad the input message. The purpose of padding is to ensure that the length of the message is a multiple of 512 bits for subsequent iterative compression. The padding steps include: adding a bit "1" at the end of the message, and then adding a sufficient number of "0"s so that the length of the entire message (including the added "1" and "0") satisfies the condition of modulo 512 remainder 448.

[0072] S22: Iteratively compress the optimized SM3 algorithm through a loop compression function to obtain an output value.

[0073] Furthermore, the specific process of the above-mentioned iterative compression includes expanding, converting and compressing each group, and finally generating an intermediate hash value. This process will be repeated until all groups are processed.

[0074] In a specific embodiment, the message group is first expanded to generate 132 words to match the compression function, and then the SM3_ROUND function is used to perform circular compression to obtain an output hash value.

[0075] S3: compile an OpenCL object for the target device, and according to the output value, call a kernel function to crack the encrypted sample to obtain the password plaintext;

[0076] In step S3, first use clCreateProgramWithSource() to read in the Kernel function source code or binary file, then use clBuildProgram() to create a program object through the source code (strings). After using clCreateKernel() to create the Kernel, before running the Kernel, you also need to use clSetKernelArg() to set parameters. These parameters include the processed digest, pwd, kernel_param, etc., and then use the function clEnqueueNDRangeKerne to put the Kernel in a queue, but it does not need to be executed immediately. Finally, the queue is managed by OpenCLdriver to schedule the execution of the Kernel.

[0077] Wherein, step S3 also includes:

[0078] S31: Dividing the encrypted sample into a plurality of parallel data blocks according to the parallel execution capability of the target device;

[0079] The expression of the parallel execution capability is:

[0080]

[0081] in, The number of parallel threads supported by the target device. is the block size of the divided parallel data blocks, is the number of work groups that are scheduled to execute on the target device simultaneously. The total amount of memory on the target device.

[0082] Furthermore, the main largest memory of the GPU architecture is the off-chip global memory. All work items of all work groups can access the global memory, which is used to store pwd and related data, and the global memory area in the SM3 algorithm is reserved in sequence as a read-only memory for constants. Therefore, the kernel parameters of the SM3 algorithm need to determine the optimal block size. The optimal block size depends on the hardware. Therefore, after obtaining the information about the maximum number of work items in the work group of the GPU device, the optimal block size needs to be determined at runtime. For different GPUs, this value may vary, but the change is not large. Assuming that the GPU device supports a total of X parallel threads, and the block size is determined to be Y, that is, the data size of parallel execution, in order to hide the delay, multiple Z of this size need to be passed on the GPU, and their product must be less than the total amount of GPU memory supported, otherwise the compiler will have an error.

[0083] S4: Compare the password plaintext with the characteristic value, use the password plaintext consistent with the characteristic value as the cracked password corresponding to the encryption sample and store it in the device memory of the target device.

[0084] The step of obtaining the cracked password in step S4 further includes:

[0085] S411: Determine whether the password plaintext of the preset iterative compression rounds is cracked successfully. If cracked successfully, output the successfully cracked password plaintext as the cracked password. If cracked unsuccessfully, execute step S412;

[0086] S412: Determine whether the password plaintext after multiple rounds of iterative compression is consistent with the characteristic value. If they are consistent, output the password plaintext that is consistent as the cracked password.

[0087] In a specific embodiment, after the 61st round of compression, the output result is judged to check whether the output value meets the conditions. If it meets the conditions, it can be directly judged that the password cracking is successful. If it does not meet the conditions, the loop will judge after executing 2 rounds of compression and compare 4 of the data with the previous feature values. If they are consistent, the password is correct, otherwise continue to try the next password.

[0088] Wherein, in step S4, the step of storing the cracked password in the device memory of the target device further includes:

[0089] S421: Divide the cracked password into 32-bit units to obtain multiple grouping temporary variables;

[0090] S422: performing an XOR operation on the multiple grouping temporary variables and the initial state vector of SM3 to obtain a preprocessed sample;

[0091] S423: Transmit the preprocessed sample to a target device for storage.

[0092] Furthermore, the data is expanded during the iterative compression process, that is, it is filled into different 32-bit temporary variables, and then the data is calculated through operations such as XOR and circular left shift, and finally updated to IV (SM3's initial state vector). The clCreateBuffer() function is then used to transfer the processed SM3 crack sample data in the host memory to the device memory.

[0093] In a specific embodiment, the samples are divided into 32-bit groups, and then XORed with the corresponding initial value IV =7380166f 4914b2b9 172442d7 da8a0600 a96f30bc 163138aa e38dee4d b0fb0e4e, and the XORed pre-processed samples are passed to the GPU, and the dictionary file or password file in the host is passed to the memory in the GPU for use by the kernel.

[0094] Wherein, step S4 also includes:

[0095] S42: Release the pointer corresponding to the unused OpenCL object.

[0096] In a specific embodiment, the password cracking speed can reach 3.8GH / s by the above method, but it should be noted that when obtaining the plain text of the password, it is necessary to release the unused OpenCL pointer. Specifically, when the program is completed, clEnqueueReadBuffer needs to be used to obtain the password, pass it to the CPU, and clear the useless pointer.

[0097] like Figure 2 As shown, the second aspect of the present invention further provides an SM3 password cracking device based on OpenCL, comprising:

[0098] The encrypted sample acquisition module 100 is used to collect encrypted samples and extract features from the encrypted samples to obtain feature values;

[0099] Compression module 200: used to obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform cyclic compression on the prediction password through the OpenCL device to obtain an output value;

[0100] The cracking sample acquisition module 300 is used to compile the OpenCL object for the target device, and according to the output value, call the kernel function to crack the encrypted sample to obtain the password plain text;

[0101] Cracking module 400: used for comparing the password plaintext with the characteristic value, taking the password plaintext consistent with the characteristic value as the cracking password corresponding to the encryption sample and storing it in the device memory of the target device.

[0102] The present invention provides an SM3 password cracking method and device based on OpenCL, which utilizes the parallel computing capability of OpenCL, optimizes the allocation of computing tasks, and improves the speed of password cracking. According to the characteristics of the password, after inputting the sample length limit, the cracking algorithm can be 20% faster than the normal algorithm, reaching 3.8GH / s. In addition, parallel computing can be performed on multiple computers to improve the cracking efficiency. The present invention provides an SM3 password cracking method and device based on OpenCL, which can obtain the password by cracking the password encrypted by using the SM3 hash function, and achieve the purpose of cracking the password. The present invention not only combines the parallel computing capability of OpenCL, but also utilizes the collaborative computing between the CPU and the GPU to accelerate the speed of password cracking. The method provided by the present invention can be applied to the field of cryptography and other fields that require the use of hash functions.

[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed in the present invention should be covered within the protection scope of the present invention.

Claims

1. An SM3 password cracking method based on OpenCL, characterized in that: include: S1: Collecting encrypted samples, and performing feature extraction on the encrypted samples to obtain feature values; S2: Obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform cyclic compression on the prediction password through the OpenCL device to obtain an output value; Wherein, the kernel function in step S2 includes message filling, message expansion, iterative compression, and result output; Wherein, step S2 further comprises: S21: Expanding the SM3 algorithm to match the SM3 loop compression function to obtain an optimized SM3 algorithm; S22: Iteratively compressing the optimized SM3 algorithm through a cyclic compression function to obtain an output value; S3: compile an OpenCL object for the target device, and according to the output value, call a kernel function to crack the encrypted sample to obtain the password plaintext; S4: Compare the password plaintext with the characteristic value, use the password plaintext consistent with the characteristic value as the cracked password corresponding to the encryption sample and store it in the device memory of the target device; The step of obtaining the cracked password in step S4 further includes: S411: Determine whether the password plaintext of the preset iterative compression rounds is cracked successfully. If cracked successfully, output the successfully cracked password plaintext as the cracked password. If cracked unsuccessfully, execute step S412; S412: Determine whether the password plaintext after multiple rounds of iterative compression is consistent with the characteristic value, and if they are consistent, output the password plaintext that is consistent as the cracked password; Wherein, in step S4, the step of storing the cracked password in the device memory of the target device further includes: S421: Divide the cracked password into 32-bit units to obtain multiple grouping temporary variables; S422: performing an XOR operation on the multiple grouping temporary variables and the initial state vector of SM3 to obtain a preprocessed sample; S423: Transmit the preprocessed sample to a target device for storage.

2. The method for cracking SM3 password based on OpenCL according to claim 1, characterized in that: Step S1 also includes: S11: parsing the encrypted sample to obtain attribute data; The attribute data includes: sample direction, operation history data of other environments, and sample source.

3. The method for cracking SM3 password based on OpenCL according to claim 1, characterized in that: Step S1 also includes: S12: Determine whether the eigenvalue is a sample generated by the SM3 algorithm. If so, output the eigenvalue. If not, change the length of the eigenvalue to 256 bits so that the sample not generated by the SM3 algorithm can be used as the input value of the SM3 algorithm.

4. The method for cracking SM3 password based on OpenCL according to claim 1, characterized in that: Step S3 also includes: S31: Dividing the encrypted sample into a plurality of parallel data blocks according to the parallel execution capability of the target device; The expression of the parallel execution capability is: X*Y*Z, wherein X is the number of parallel threads supported by the target device, Y is the block size of the divided parallel data blocks, Z is the number of work groups simultaneously scheduled to execute on the target device, and S is the total memory of the target device. Step S4 also includes:

5. The method for cracking SM3 password based on OpenCL according to claim 1, characterized in that: S43: Release the pointer corresponding to the unused OpenCL object. include:

6. An SM3 password cracking device based on OpenCL, characterized in that: Encrypted sample acquisition module: used to collect encrypted samples and also used to extract features from the encrypted samples to obtain feature values; ​ Compression module: used to obtain an OpenCL device, use the SM3 algorithm as a kernel function called by the OpenCL main program, and perform cyclic compression on the prediction password through the OpenCL device to obtain an output value; Wherein, the kernel function includes message filling, message expansion, iterative compression, and result output; The compression module is further used to expand the SM3 algorithm to match the SM3 loop compression function to obtain an optimized SM3 algorithm; the optimized SM3 algorithm is iteratively compressed through the loop compression function to obtain an output value; the cracking sample acquisition module is used to compile an OpenCL object for a target device, and according to the output value, the kernel function is called to crack the encrypted sample to obtain the password plaintext; Cracking module: used for comparing the password plaintext with the characteristic value, taking the password plaintext consistent with the characteristic value as the cracking password corresponding to the encryption sample and storing it in the device memory of the target device; The cracking module is further used to determine whether the password plaintext of the preset iterative compression rounds is cracked successfully. If the cracking is successful, the successfully cracked password plaintext is output as the cracked password. If the cracking is unsuccessful, it is determined whether the password plaintext after multiple rounds of iterative compression is consistent with the characteristic value. If they are consistent, the password plaintext that is consistent with the comparison is output as the cracked password. The cracking module is further used to divide the cracking password into 32-bit units to obtain multiple group temporary variables; perform XOR operation on the multiple group temporary variables and the initial state vector of SM3 to obtain preprocessed samples; and transmit the preprocessed samples to the target device for storage.