Data encryption method, permanent magnet synchronous motor controller and readable storage medium
By simulating the random motion of particles to generate encryption keys, the data of the permanent magnet synchronous motor controller is encrypted, which solves the problem of short key length and easy cracking in traditional encryption methods, and achieves fast encryption and high security.
Patent Information
- Application Number
- CN202311650942.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-04
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-12-04
AI Technical Summary
Traditional encryption methods for permanent magnet synchronous motor controllers use short and fixed encryption keys, making them vulnerable to brute-force attacks and slow to encrypt, requiring significant computational resources and time.
The random number seed is iteratively moved based on the principle of particle random motion to generate multiple motion coordinates. An encryption key is determined based on the motion coordinates and then used to encrypt the target data.
It achieves fast encryption speed, simple algorithm, unlimited number of generated keys, is difficult to crack by brute force, has high security, and consumes less computing resources and time.
Smart Images

Figure CN117675191B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data encryption for permanent magnet synchronous motor controllers, and more specifically, to a data encryption method, a permanent magnet synchronous motor controller, a computer-readable storage medium, and an electronic device. Background Technology
[0002] Electric motors are widely used as power sources in applications such as fans, aerators, and electric vehicles. Permanent magnet synchronous motors, a type of electric motor, use the magnetic interaction between the magnetic field generated by a coil through which current flows and the magnetic field generated by a permanent magnet to rotate the rotor.
[0003] With the mature development of home appliance technology and the rapid advancement of power electronics technology, permanent magnet synchronous motors (PMSMs) are becoming increasingly popular due to their advantages such as low cost, high efficiency, and low noise. Traditional PMSM controller program encryption methods include DES, RSA, AES, and hash algorithms. DES is simple and fast, but its short and fixed key length makes it vulnerable to brute-force attacks. While hash algorithms are efficient and easy to store, their irreversibility—meaning the original data cannot be derived from the hash value—makes them unsuitable for motor controller program encryption. RSA's security is based on the complexity of mathematical problems, offering high security, but it is slow and requires significant computational resources and time. Summary of the Invention
[0004] The main objective of this application is to provide a data encryption method, a permanent magnet synchronous motor controller, a computer-readable storage medium, and an electronic device, so as to at least solve the problems of traditional program encryption methods, such as short and fixed encryption key lengths, easy brute-force cracking, slow encryption speed, and the need to consume a lot of computing resources and time.
[0005] To achieve the above objectives, according to one aspect of this application, a data encryption method is provided, applied to a permanent magnet synchronous motor controller. The method includes: acquiring target data, the target data including data in the permanent magnet synchronous motor controller that needs to be encrypted; acquiring a random number seed, iteratively moving the random number seed based on the principle of particle random motion, and acquiring the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates; determining an encryption key based on each motion coordinate, and encrypting the target data using the encryption key to obtain encrypted data.
[0006] Optionally, the random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed at the end of each motion are recorded to obtain multiple motion coordinates, including: an acquisition step, acquiring the iteration number and the initial coordinates of the random number seed; a generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm, wherein the particle motion direction includes a horizontal direction and a vertical direction, and the particle motion distance includes a horizontal motion distance and a vertical motion distance; a motion step, controlling the random number seed to move according to the particle motion direction and the particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion; repeating the generation step and the motion step at least once until the number of motions of the random number seed reaches the iteration number.
[0007] Optionally, encrypting the target data using the encryption key includes: converting the target data into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; constructing an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key; and encrypting the target integer according to the encryption formula and the encryption key to encrypt the target data.
[0008] Optionally, determining the encryption key based on each of the motion coordinates includes: determining the encryption key by the sum of the Euclidean distances of the plurality of motion coordinates.
[0009] Optionally, determining the encryption key based on each of the motion coordinates includes: determining the final motion coordinates based on each of the motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the random number seed; determining the target angle based on the final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the target angle, and determining the arctangent value of the target angle as the encryption key.
[0010] Optionally, determining the encryption key based on each of the motion coordinates includes: determining multiple target distances based on the origin and each of the motion coordinates, wherein each target distance is a straight-line distance between a motion coordinate and the origin, and the target distances correspond one-to-one with the motion coordinates; comparing the values of the multiple target distances, and determining the target distance with the largest value as the encryption key.
[0011] Optionally, the method further includes: obtaining the data to be decrypted; obtaining the random number seed and the number of iterations; determining the decryption key based on the random number seed and the number of iterations; and constructing a decryption formula. Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key; the data to be decrypted is decrypted according to the decryption formula and the decryption key to obtain the decrypted data.
[0012] According to another aspect of this application, a permanent magnet synchronous motor controller is provided, comprising: a first acquisition unit for acquiring target data, the target data including data in the permanent magnet synchronous motor controller that needs to be encrypted; a second acquisition unit for acquiring a random number seed, iteratively moving the random number seed based on the principle of random particle motion, and acquiring the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates; and a determination unit for determining an encryption key based on each motion coordinate, and encrypting the target data using the encryption key to obtain encrypted data.
[0013] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein, when the program is executed, it controls the device where the computer-readable storage medium is located to perform any of the data encryption methods described above.
[0014] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing any of the data encryption methods described above.
[0015] Applying the technical solution of this application, the above-mentioned data encryption method is applied to a permanent magnet synchronous motor controller. First, target data is acquired, including the data in the permanent magnet synchronous motor controller that needs to be encrypted. Then, a random number seed is acquired, and iterative motion is performed on the random number seed based on the principle of particle random motion, obtaining the coordinates of the random number seed at the end of each iteration, resulting in multiple motion coordinates. Finally, an encryption key is determined based on each motion coordinate, and the encryption key is used to encrypt the target data to obtain the encrypted data. This method uses computer simulation of particle random motion to calculate the key for encrypting the permanent magnet synchronous motor controller program. It features fast encryption speed, simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. This solves the problems of traditional program encryption methods, which have short and fixed encryption key lengths, are easily cracked by brute force, and have slow encryption speeds, requiring significant computational resources and time. Attached Figure Description
[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 A hardware structure block diagram of a mobile terminal performing a data encryption method according to an embodiment of this application is shown;
[0018] Figure 2 A schematic flowchart of a data encryption method according to an embodiment of this application is shown;
[0019] Figure 3 A schematic diagram illustrating a simulated random motion of particles according to an embodiment of this application is shown;
[0020] Figure 4 A coordinate graph of a program-simulated random motion particle provided according to an embodiment of this application is shown;
[0021] Figure 5 A schematic diagram of a key generation process according to an embodiment of this application is shown;
[0022] Figure 6 A schematic flowchart of a data encryption process according to an embodiment of this application is shown;
[0023] Figure 7 A schematic flowchart of a data decryption process according to an embodiment of this application is shown;
[0024] Figure 8 A structural block diagram of a permanent magnet synchronous motor controller provided according to an embodiment of this application is shown.
[0025] The above figures include the following reference numerals:
[0026] 102. Processor; 104. Memory; 106. Transmission device; 108. Input / output device. Detailed Implementation
[0027] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] As described in the background section, traditional permanent magnet synchronous motor controller program encryption algorithms suffer from problems such as short and fixed key lengths, vulnerability to brute-force attacks, slow encryption speeds, and the consumption of significant computational resources and time. To address these issues, embodiments of this application provide a data encryption method, a permanent magnet synchronous motor controller, a computer-readable storage medium, and an electronic device.
[0031] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0032] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a data encryption method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0033] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the data encryption method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the aforementioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or send data via a network. Specific examples of the aforementioned networks may include wireless networks provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0034] This embodiment provides a data encryption method that runs on a mobile terminal, computer terminal, or similar computing device. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Also, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] Figure 2 This is a flowchart of a data encryption method according to an embodiment of this application. Figure 2 As shown, the method includes the following steps:
[0036] Step S201: Obtain target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted.
[0037] Specifically, before encryption, the target data needs to be converted into an integer using the MD5 algorithm, and then this integer is encrypted. MD5 can generate a 128-bit (16-byte) hash value from plain text of any length.
[0038] Step S202: Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion, and obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates;
[0039] Specifically, Figure 3 A schematic diagram simulating the random motion of particles, such as Figure 3 As shown, pollen and other particles suspended in a fluid undergo random motion, a phenomenon known as particle random motion. This motion is caused by the random collisions of molecules and atoms. In liquids or gases, molecules and atoms move at very high speeds and constantly collide. These collisions exert forces on the tiny particles, causing them to move randomly within the liquid or gas. This motion is characterized by its randomness and continuity. Randomness refers to the unpredictable trajectory of the particles in the liquid or gas, while continuity indicates that the motion is ongoing; the particles will continue their random motion until they are influenced by other substances or forces.
[0040] Figure 4 A coordinate diagram illustrating the random motion of particles in a program, such as... Figure 4 As shown, random numbers can be used in computer programs to simulate the random motion of particles. First, the initial coordinates of the particle are set to (0, 0). Then, the particle's direction and distance of motion are randomly generated. Assuming the current coordinates are (Xold, Yold), a random number generation algorithm is used to randomly generate the horizontal direction Dx from the set [-1, 1], where -1 represents a negative direction and 1 represents a positive direction. The horizontal distance Hx is randomly generated from the list [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], then Xnew = Xold + Dx × Hx. Similarly, for the Yold coordinate, the random number generation algorithm is used independently of Xold to select the direction Dy and distance Vy, resulting in Ynew = Yold + Dy × Vy. The particle will then move to the new coordinates (Xnew, Ynew). By repeating this process of randomly generating the particle's direction and distance of motion, the random motion of particles can be simulated.
[0041] The process involves iteratively moving the random number seed based on the principle of particle random motion, and recording the coordinates of the random number seed at the end of each motion to obtain multiple motion coordinates. This includes the following steps:
[0042] The steps involve obtaining the number of iterations and the initial coordinates of the random number seed mentioned above.
[0043] The generation step involves randomly generating the particle movement direction and particle movement distance based on a random number generation algorithm. The particle movement direction includes both horizontal and vertical directions, and the particle movement distance includes both horizontal and vertical movement distances.
[0044] The motion steps involve controlling the movement of the random number seed based on the particle's motion direction and distance, and determining the motion coordinates of the random number seed at the end of the current motion.
[0045] Repeat the above generation steps and the above movement steps at least once, until the number of times the above random number seed is moved reaches the above number of iterations.
[0046] Specifically, this allows us to obtain the motion coordinates of multiple random movements, laying the data foundation for subsequently determining the encryption key.
[0047] Among them, such as Figure 5 As shown, upon first entering the program, the initial coordinates of the particle are set to (0,0). A random number seed S is obtained from the key and used as the input parameter for the random number generation algorithm. The algorithm generates the horizontal direction Dx of the particle's movement and the horizontal distance Hx. Similarly, the algorithm generates the vertical direction Dy of the particle's movement and the vertical distance Vy. Xnew and Ynew are calculated. The particle is moved to the new coordinates (Xnew, Ynew), and the number of movements is incremented by 1. This process is repeated until the number of movements equals the set number of movements M (iterations). After the particle's movement is complete, the sum of the Euclidean distances of the coordinates formed by the particle's M random movements is calculated, and the result is output with two decimal places.
[0048] Step S203: Determine the encryption key based on the aforementioned motion coordinates, and use the encryption key to encrypt the aforementioned target data to obtain encrypted data.
[0049] Specifically, this method uses computer-simulated random particle motion as a key to encrypt and decrypt the permanent magnet synchronous motor controller program. It boasts advantages such as simple algorithm, fast encryption / decryption speed, and high security. This solves the problem of traditional permanent magnet synchronous motor controller program encryption algorithms having short and fixed key lengths, making them vulnerable to brute-force attacks.
[0050] Specifically, determining the encryption key based on the aforementioned motion coordinates includes: determining the encryption key by summing the Euclidean distances of the multiple aforementioned motion coordinates.
[0051] Specifically, this method of calculating encryption keys is not only simple in algorithm, but also fast in encryption and decryption and highly secure. It solves the problem that the encryption algorithm of traditional permanent magnet synchronous motor controllers has a short and fixed key length, making it easy to be cracked by brute force.
[0052] The process of determining the encryption key based on the aforementioned motion coordinates includes the following steps:
[0053] Step S301: Determine the final motion coordinates based on the aforementioned motion coordinates. The final motion coordinates are the coordinates at the end of the last motion of the aforementioned random number seed.
[0054] Step S302: Based on the final motion coordinates, determine the target angle, which is the angle formed by the target line and the target coordinate axis, and the target line is the line where the final motion coordinates and the origin of the coordinates are located.
[0055] Step S303: Calculate the arctangent value of the target angle and determine the arctangent value of the target angle as the encryption key.
[0056] Specifically, this key generation method offers fast encryption speed, simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. The target coordinate axis can be the x-axis.
[0057] The process of determining the encryption key based on the aforementioned motion coordinates includes the following steps:
[0058] Step S401: Based on the origin of the coordinate system and each of the above-mentioned motion coordinates, determine multiple target distances. Each of the above-mentioned target distances is the straight-line distance between the above-mentioned motion coordinates and the above-mentioned origin of the coordinate system. Each of the above-mentioned target distances corresponds one-to-one with the above-mentioned motion coordinates.
[0059] Step S402: Compare the numerical values of multiple target distances and determine the target distance with the largest value as the encryption key.
[0060] Specifically, the generated key length is not fixed and can be adjusted according to the encryption needs of the permanent magnet synchronous motor controller program, making it difficult to be cracked by brute force and thus providing high security.
[0061] The encryption of the target data using the aforementioned encryption key includes the following steps:
[0062] Step S501: The target data is converted into a target integer using a target algorithm, which is an algorithm that converts data into a hash value.
[0063] Step S502: Construct the encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key.
[0064] Step S503: Encrypt the target integer according to the above encryption formula and the above encryption key to encrypt the target data.
[0065] Specifically, this encryption method can be adjusted according to the encryption needs of the permanent magnet synchronous motor controller program, making it difficult to brute-force crack and providing high security. It also boasts fast encryption speed, a simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. The target algorithm can be MD5, which can generate a 128-bit (16-byte) hash value from a plaintext of any length.
[0066] The specific encryption process is as follows: Figure 6 As shown, firstly, the data to be encrypted can be converted into an integer x using the MD5 algorithm. Then, the key parameters required for encryption are input, namely the random number seed S and the number of iterations M. The key generation program generates the key k for this encryption. Finally, the original text x is encrypted into ciphertext c using the key k through mathematical calculation.
[0067] The above method also includes the following steps:
[0068] Step S601: Obtain the data to be decrypted;
[0069] Step S602: Obtain the random number seed and the number of iterations mentioned above;
[0070] Step S603: Determine the decryption key based on the random number seed and the number of iterations mentioned above;
[0071] Step S604, Construct the decryption formula Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key;
[0072] Step S605: Decrypt the data to be decrypted according to the above decryption formula and the above decryption key to obtain the decrypted data.
[0073] Specifically, this allows for direct decryption of the target data, improving system security.
[0074] The specific decryption process is as follows: Figure 7As shown, the decryption process, in contrast to the encryption process, requires first reading the key parameters, including the random number seed S and the number of iterations M. Since the random numbers in computer programs are pseudo-random numbers—a sequence of values generated through a mathematical formula or algorithm, typically obtained using linear congruence rules—the random number sequences generated by inputting the same random number seed S will be identical. Therefore, the key generation program can be executed again using the random number seed S and the number of iterations M from the key parameters to generate a new key k, which will be completely identical to the key used in the encryption process. Finally, mathematical calculations are performed using the key k to decrypt the ciphertext c back into the plaintext x.
[0075] Additionally, when encryption of the permanent magnet synchronous motor controller program is required, see the appendix. Figure 6 Input the program data to be encrypted, along with the key parameters, random number seed S, and number of motions M. The random number seed is used in the random number generation algorithm, and the number of motions M determines the number of times the program simulates random particle motion. After inputting the data to be encrypted and the required key parameters, the program converts the data into an integer x. Then, execute the key generation program (see appendix). Figure 5 A random number generation algorithm is used to generate the horizontal and vertical directions of particle motion, as well as the distance traveled, to obtain new particle coordinates. This process is repeated until the simulated random particle motion is complete. After the particle motion simulation is complete, the sum of the Euclidean distances of the coordinates formed by the M random motions of the particles is calculated and used as the key. After obtaining the encryption key, the original program data is encrypted into ciphertext through mathematical calculations. When the program is needed, the encrypted ciphertext must be decrypted, as shown in the appendix. Figure 7 First, obtain the key parameters: random number seed S and number of movements M. Then, execute the key generation program again to obtain the decryption key. After obtaining the decryption key, the ciphertext is decrypted into controller program data through calculation.
[0076] The data encryption method described in this application is applied to a permanent magnet synchronous motor controller. First, target data is acquired, including the data within the controller that needs to be encrypted. Then, a random number seed is obtained, and iterative motion is performed on the seed based on the principle of particle random motion. The coordinates of the seed are obtained at the end of each iteration, resulting in multiple motion coordinates. Finally, an encryption key is determined based on these coordinates, and the target data is encrypted using this key to obtain the encrypted data. This method uses computer simulation of particle random motion to calculate the key for encrypting the permanent magnet synchronous motor controller program. It offers fast encryption speed, a simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. This solves the problems of traditional program encryption methods, which suffer from short and fixed key lengths, susceptibility to brute-force attacks, slow encryption speed, and high computational resource and time consumption.
[0077] To enable those skilled in the art to better understand the technical solution of this application, the implementation process of the data encryption method of this application will be described in detail below with reference to specific embodiments.
[0078] This embodiment relates to a specific data encryption method, the specific implementation logic of which is as follows:
[0079] When encrypting the permanent magnet synchronous motor controller program, the main encryption program is entered first. The program converts the data to be encrypted into an integer x, and after inputting parameters, it enters the key generation subroutine, using random numbers to simulate the random motion of particles. The particle's random number seed S and the number of motions M are used as the key parameters and saved for subsequent decryption. The coordinates before key input are represented as (Xold, Yold), with the initial coordinates set to (0,0). After setting the initial coordinates of the particles, the random number generation algorithm is called, with the random number seed S as the input parameter. The algorithm first generates the horizontal direction Dx of the particle's motion, and then generates the horizontal distance Hx. Similarly, the algorithm generates the vertical direction Dy of the particle's motion, and then generates the vertical distance Vy. After generation, the new coordinates (Xnew, Ynew) of the particle are calculated using Xnew = Xold + Dx × Hx and Ynew = Yold + Dy × Vy. Simultaneously, the number of particle motions is incremented by 1, indicating that one simulated random motion has been completed. Repeat this process until the number of particle movements equals the set number of movements M, then exit the loop to complete the entire simulated motion process. Calculate the sum of the Euclidean distances of the coordinates formed by the M random movements of the particle, and output the result to two decimal places. This output result serves as the encryption key k. After obtaining the encryption key, return to the main encryption program. Use the obtained key k to encrypt the integer x into ciphertext c through mathematical calculation. When decrypting the permanent magnet synchronous motor controller program, first enter the main decryption program. Read the key parameters saved during encryption, such as the random number seed S and the number of movements M, and call the key generation subroutine again to generate the decryption key. The generated key k will be completely consistent with the key used in the encryption process. After obtaining the decryption key, use the obtained key k to calculate and restore the ciphertext c to the integer x. Finally, convert the obtained integer x into controller program data.
[0080] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0081] This application also provides a permanent magnet synchronous motor controller. It should be noted that the permanent magnet synchronous motor controller of this application embodiment can be used to execute the data encryption method provided in this application embodiment. This device is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0082] The permanent magnet synchronous motor controller provided in the embodiments of this application will be described below.
[0083] Figure 8 This is a schematic diagram of a permanent magnet synchronous motor controller according to an embodiment of this application. Figure 8 As shown, the permanent magnet synchronous motor controller includes a first acquisition unit 10, a second acquisition unit 20, and a determination unit 30. The first acquisition unit 10 is used to acquire target data, which includes data that needs to be encrypted in the permanent magnet synchronous motor controller. The second acquisition unit 20 is used to acquire a random number seed, iterate the random number seed based on the principle of random particle motion, and acquire the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates. The determination unit 30 is used to determine an encryption key based on each of the motion coordinates, and encrypt the target data using the encryption key to obtain encrypted data.
[0084] The permanent magnet synchronous motor controller described in this application includes a first acquisition unit, a second acquisition unit, and a determination unit. The first acquisition unit acquires target data, which includes data in the permanent magnet synchronous motor controller that needs to be encrypted. The second acquisition unit acquires a random number seed and iteratively moves the random number seed based on the principle of particle random motion, acquiring the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates. The determination unit determines an encryption key based on each motion coordinate and uses the encryption key to encrypt the target data to obtain encrypted data. This method uses computer simulation of particle random motion to calculate the key for encrypting the permanent magnet synchronous motor controller program. It offers fast encryption speed, a simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. This solves the problems of traditional program encryption methods, which have short and fixed encryption key lengths, are easily cracked by brute force, and are slow, requiring significant computational resources and time.
[0085] In some optional schemes, the second acquisition unit includes a first acquisition module, a first generation module, a first motion module, and a first execution module. The first acquisition module is used to perform the acquisition step, acquiring the iteration number and the initial coordinates of the random number seed. The first generation module is used to perform the generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm. The particle motion direction includes horizontal and vertical directions, and the particle motion distance includes horizontal and vertical motion distances. The first motion module is used to perform the motion step, controlling the random number seed to move according to the particle motion direction and particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion. The first execution module is used to repeatedly execute the generation step and the motion step at least once until the number of times the random number seed moves reaches the iteration number. This allows the acquisition of the motion coordinates of multiple random movements, laying the data foundation for subsequently determining the encryption key.
[0086] In some optional embodiments, the determining unit includes a conversion module, a first construction module, and a first encryption module. The conversion module is used to convert the target data into a target integer using a target algorithm, where the target algorithm is an algorithm that converts data into a hash value. The first construction module is used to construct an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key. The first encryption module is used to encrypt the target integer according to the encryption formula and the encryption key to encrypt the target data. This encryption method can be adjusted according to the encryption needs of the permanent magnet synchronous motor controller program, is difficult to crack by brute force, and has high security. Furthermore, it has a fast encryption speed, a simple algorithm, and consumes relatively few computing resources and time. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs.
[0087] In some optional instances, the determining unit includes a first determining module, which is used to determine the sum of the Euclidean distances of multiple of the aforementioned motion coordinates as the encryption key. This method of calculating the encryption key is not only simple in algorithm, but also fast in encryption and decryption and highly secure, solving the problem that the encryption algorithm of traditional permanent magnet synchronous motor controllers has a short and fixed key length, making it vulnerable to brute-force attacks.
[0088] In this embodiment, the determining unit includes a second determining module, a third determining module, and a fourth determining module. The second determining module is used to determine the final motion coordinates based on the aforementioned motion coordinates. The final motion coordinates are the coordinates at the end of the last motion of the random number seed. The third determining module is used to determine the target angle based on the final motion coordinates. The target angle is the angle formed by the target straight line and the target coordinate axis. The target straight line is the straight line where the final motion coordinates and the origin of the coordinate system are located. The fourth determining module is used to calculate the arctangent value of the target angle and determine the arctangent value of the target angle as the encryption key. This key generation method has a fast encryption speed, a simple algorithm, and consumes less computing resources and time. There is no upper limit to the total number of keys that can be generated, and it is possible to encrypt different programs individually. The target coordinate axis can be the x-axis.
[0089] An optional scheme includes a determining unit comprising a fifth determining module and a comparison module. The fifth determining module is used to determine multiple target distances based on the coordinate origin and each of the aforementioned motion coordinates. Each target distance is the straight-line distance between a given motion coordinate and the coordinate origin, and each target distance corresponds one-to-one with a given motion coordinate. The comparison module is used to compare the numerical values of the multiple target distances and determine the target distance with the largest value as the encryption key. The key length generated in this way is not fixed and can be adjusted according to the encryption needs of the permanent magnet synchronous motor controller program, making it difficult to brute-force crack and providing high security.
[0090] As an optional solution, the aforementioned permanent magnet synchronous motor controller further includes a second acquisition module, a third acquisition module, a sixth determination module, a second construction module, and a decryption module. The second acquisition module is used to acquire the data to be decrypted; the third acquisition module is used to acquire the random number seed and the number of iterations; the sixth determination module is used to determine the decryption key based on the random number seed and the number of iterations; and the second construction module is used to construct the decryption formula. Where x2 represents the decrypted data, c2 represents the data to be decrypted, and k2 represents the decryption key; the decryption module is used to decrypt the data to be decrypted according to the above decryption formula and the above decryption key to obtain the decrypted data. This allows for direct decryption of the target data, improving system security.
[0091] The aforementioned data encryption device includes a processor and a memory. The first acquisition unit and other components are stored as program units in the memory, and the processor executes these program units to achieve the corresponding functions. All of the above modules reside in the same processor; alternatively, the modules may be located in different processors in any combination.
[0092] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, the problems of traditional program encryption methods—such as short and fixed key lengths, vulnerability to brute-force attacks, slow encryption speeds, and the high consumption of computational resources and time—can be addressed.
[0093] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0094] This invention provides a computer-readable storage medium including a stored program, wherein the program, when running, controls the device containing the computer-readable storage medium to execute the data encryption method.
[0095] Specifically, data encryption methods include:
[0096] Step S201: Obtain target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted.
[0097] Specifically, before encryption, the target data needs to be converted into an integer using the MD5 algorithm, and then this integer is encrypted. MD5 can generate a 128-bit (16-byte) hash value from plain text of any length.
[0098] Step S202: Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion, and obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates;
[0099] Specifically, Figure 3 A schematic diagram simulating the random motion of particles, such as Figure 3 As shown, pollen and other particles suspended in a fluid undergo random motion, a phenomenon known as particle random motion. This motion is caused by the random collisions of molecules and atoms. In liquids or gases, molecules and atoms move at very high speeds and constantly collide. These collisions exert forces on the tiny particles, causing them to move randomly within the liquid or gas. This motion is characterized by its randomness and continuity. Randomness refers to the unpredictable trajectory of the particles in the liquid or gas, while continuity indicates that the motion is ongoing; the particles will continue their random motion until they are influenced by other substances or forces.
[0100] Step S203: Determine the encryption key based on the aforementioned motion coordinates, and use the encryption key to encrypt the aforementioned target data to obtain encrypted data.
[0101] Specifically, this method uses computer-simulated random particle motion as a key to encrypt and decrypt the permanent magnet synchronous motor controller program. It boasts advantages such as simple algorithm, fast encryption / decryption speed, and high security. This solves the problem of traditional permanent magnet synchronous motor controller program encryption algorithms having short and fixed key lengths, making them vulnerable to brute-force attacks.
[0102] Optionally, the random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed at the end of each motion are recorded to obtain multiple motion coordinates, including: an acquisition step, acquiring the iteration number and the initial coordinates of the random number seed; a generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm, wherein the particle motion direction includes horizontal and vertical directions, and the particle motion distance includes horizontal and vertical motion distances; a motion step, controlling the random number seed to move according to the particle motion direction and particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion; repeating the generation step and the motion step at least once until the number of times the random number seed moves reaches the iteration number.
[0103] Optionally, encrypting the target data using the aforementioned encryption key includes: converting the target data into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; constructing an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key; and encrypting the target integer according to the encryption formula and the encryption key to encrypt the target data.
[0104] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining the encryption key as the sum of the Euclidean distances of the multiple aforementioned motion coordinates.
[0105] Optionally, determining the encryption key based on the aforementioned motion coordinates includes: determining the final motion coordinates based on the aforementioned motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the aforementioned random number seed; determining the target angle based on the aforementioned final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the aforementioned final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the aforementioned target angle, and determining the arctangent value of the aforementioned target angle as the aforementioned encryption key.
[0106] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining multiple target distances based on the coordinate origin and each of the aforementioned motion coordinates, wherein each of the aforementioned target distances is a straight-line distance between a aforementioned motion coordinate and the aforementioned coordinate origin, and the aforementioned target distances correspond one-to-one with the aforementioned motion coordinates; comparing the numerical values of the multiple of the aforementioned target distances, and determining the aforementioned target distance with the largest numerical value as the aforementioned encryption key.
[0107] Optionally, the above method further includes: obtaining the data to be decrypted; obtaining the random number seed and the number of iterations; determining the decryption key based on the random number seed and the number of iterations; and constructing a decryption formula. Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key; according to the above decryption formula and the above decryption key, the data to be decrypted is decrypted to obtain the decrypted data.
[0108] This invention provides a processor for running a program, wherein the program executes the data encryption method described above.
[0109] Specifically, data encryption methods include:
[0110] Step S201: Obtain target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted.
[0111] Specifically, before encryption, the target data needs to be converted into an integer using the MD5 algorithm, and then this integer is encrypted. MD5 can generate a 128-bit (16-byte) hash value from plain text of any length.
[0112] Step S202: Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion, and obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates;
[0113] Specifically, Figure 3 A schematic diagram simulating the random motion of particles, such as Figure 3 As shown, pollen and other particles suspended in a fluid undergo random motion, a phenomenon known as particle random motion. This motion is caused by the random collisions of molecules and atoms. In liquids or gases, molecules and atoms move at very high speeds and constantly collide. These collisions exert forces on the tiny particles, causing them to move randomly within the liquid or gas. This motion is characterized by its randomness and continuity. Randomness refers to the unpredictable trajectory of the particles in the liquid or gas, while continuity indicates that the motion is ongoing; the particles will continue their random motion until they are influenced by other substances or forces.
[0114] Step S203: Determine the encryption key based on the aforementioned motion coordinates, and use the encryption key to encrypt the aforementioned target data to obtain encrypted data.
[0115] Specifically, this method uses computer-simulated random particle motion as a key to encrypt and decrypt the permanent magnet synchronous motor controller program. It boasts advantages such as simple algorithm, fast encryption / decryption speed, and high security. This solves the problem of traditional permanent magnet synchronous motor controller program encryption algorithms having short and fixed key lengths, making them vulnerable to brute-force attacks.
[0116] Optionally, the random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed at the end of each motion are recorded to obtain multiple motion coordinates, including: an acquisition step, acquiring the iteration number and the initial coordinates of the random number seed; a generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm, wherein the particle motion direction includes horizontal and vertical directions, and the particle motion distance includes horizontal and vertical motion distances; a motion step, controlling the random number seed to move according to the particle motion direction and particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion; repeating the generation step and the motion step at least once until the number of times the random number seed moves reaches the iteration number.
[0117] Optionally, encrypting the target data using the aforementioned encryption key includes: converting the target data into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; constructing an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key; and encrypting the target integer according to the encryption formula and the encryption key to encrypt the target data.
[0118] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining the encryption key as the sum of the Euclidean distances of the multiple aforementioned motion coordinates.
[0119] Optionally, determining the encryption key based on the aforementioned motion coordinates includes: determining the final motion coordinates based on the aforementioned motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the aforementioned random number seed; determining the target angle based on the aforementioned final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the aforementioned final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the aforementioned target angle, and determining the arctangent value of the aforementioned target angle as the aforementioned encryption key.
[0120] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining multiple target distances based on the coordinate origin and each of the aforementioned motion coordinates, wherein each of the aforementioned target distances is a straight-line distance between a aforementioned motion coordinate and the aforementioned coordinate origin, and the aforementioned target distances correspond one-to-one with the aforementioned motion coordinates; comparing the numerical values of the multiple of the aforementioned target distances, and determining the aforementioned target distance with the largest numerical value as the aforementioned encryption key.
[0121] Optionally, the above method further includes: obtaining the data to be decrypted; obtaining the random number seed and the number of iterations; determining the decryption key based on the random number seed and the number of iterations; and constructing a decryption formula. Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key; according to the above decryption formula and the above decryption key, the data to be decrypted is decrypted to obtain the decrypted data.
[0122] This invention provides a device including a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs at least the following steps:
[0123] Step S201: Obtain target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted.
[0124] Step S202: Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion, and obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates;
[0125] Step S203: Determine the encryption key based on the aforementioned motion coordinates, and use the encryption key to encrypt the aforementioned target data to obtain encrypted data.
[0126] Optionally, the random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed at the end of each motion are recorded to obtain multiple motion coordinates, including: an acquisition step, acquiring the iteration number and the initial coordinates of the random number seed; a generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm, wherein the particle motion direction includes horizontal and vertical directions, and the particle motion distance includes horizontal and vertical motion distances; a motion step, controlling the random number seed to move according to the particle motion direction and particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion; repeating the generation step and the motion step at least once until the number of times the random number seed moves reaches the iteration number.
[0127] Optionally, encrypting the target data using the aforementioned encryption key includes: converting the target data into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; constructing an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key; and encrypting the target integer according to the encryption formula and the encryption key to encrypt the target data.
[0128] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining the encryption key as the sum of the Euclidean distances of the multiple aforementioned motion coordinates.
[0129] Optionally, determining the encryption key based on the aforementioned motion coordinates includes: determining the final motion coordinates based on the aforementioned motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the aforementioned random number seed; determining the target angle based on the aforementioned final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the aforementioned final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the aforementioned target angle, and determining the arctangent value of the aforementioned target angle as the aforementioned encryption key.
[0130] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining multiple target distances based on the coordinate origin and each of the aforementioned motion coordinates, wherein each of the aforementioned target distances is a straight-line distance between a aforementioned motion coordinate and the aforementioned coordinate origin, and the aforementioned target distances correspond one-to-one with the aforementioned motion coordinates; comparing the numerical values of the multiple of the aforementioned target distances, and determining the aforementioned target distance with the largest numerical value as the aforementioned encryption key.
[0131] Optionally, the above method further includes: obtaining the data to be decrypted; obtaining the random number seed and the number of iterations; determining the decryption key based on the random number seed and the number of iterations; and constructing a decryption formula. Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key; according to the above decryption formula and the above decryption key, the data to be decrypted is decrypted to obtain the decrypted data.
[0132] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.
[0133] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program having at least the following method steps:
[0134] Step S201: Obtain target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted.
[0135] Step S202: Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion, and obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates;
[0136] Step S203: Determine the encryption key based on the aforementioned motion coordinates, and use the encryption key to encrypt the aforementioned target data to obtain encrypted data.
[0137] Optionally, the random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed at the end of each motion are recorded to obtain multiple motion coordinates, including: an acquisition step, acquiring the iteration number and the initial coordinates of the random number seed; a generation step, randomly generating the particle motion direction and particle motion distance based on a random number generation algorithm, wherein the particle motion direction includes horizontal and vertical directions, and the particle motion distance includes horizontal and vertical motion distances; a motion step, controlling the random number seed to move according to the particle motion direction and particle motion distance, and determining the motion coordinates of the random number seed at the end of the current motion; repeating the generation step and the motion step at least once until the number of times the random number seed moves reaches the iteration number.
[0138] Optionally, encrypting the target data using the aforementioned encryption key includes: converting the target data into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; constructing an encryption formula c1 = x1 × k1, where c1 is the encrypted data, x1 is the target integer, and k1 is the encryption key; and encrypting the target integer according to the encryption formula and the encryption key to encrypt the target data.
[0139] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining the encryption key as the sum of the Euclidean distances of the multiple aforementioned motion coordinates.
[0140] Optionally, determining the encryption key based on the aforementioned motion coordinates includes: determining the final motion coordinates based on the aforementioned motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the aforementioned random number seed; determining the target angle based on the aforementioned final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the aforementioned final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the aforementioned target angle, and determining the arctangent value of the aforementioned target angle as the aforementioned encryption key.
[0141] Optionally, determining the encryption key based on each of the aforementioned motion coordinates includes: determining multiple target distances based on the coordinate origin and each of the aforementioned motion coordinates, wherein each of the aforementioned target distances is a straight-line distance between a aforementioned motion coordinate and the aforementioned coordinate origin, and the aforementioned target distances correspond one-to-one with the aforementioned motion coordinates; comparing the numerical values of the multiple of the aforementioned target distances, and determining the aforementioned target distance with the largest numerical value as the aforementioned encryption key.
[0142] Optionally, the above method further includes: obtaining the data to be decrypted; obtaining the random number seed and the number of iterations; determining the decryption key based on the random number seed and the number of iterations; and constructing a decryption formula. Where x2 is the decrypted data, c2 is the data to be decrypted, and k2 is the decryption key; according to the above decryption formula and the above decryption key, the data to be decrypted is decrypted to obtain the decrypted data.
[0143] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0144] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0145] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0146] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0147] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0148] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0149] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0150] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0151] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0152] As can be seen from the above description, the embodiments of this application achieve the following technical effects:
[0153] 1) The data encryption method described in this application is applied to a permanent magnet synchronous motor controller. First, target data is acquired, including the data within the controller that needs to be encrypted. Then, a random number seed is obtained, and iterative motion is performed on the seed based on the principle of random particle motion. The coordinates of the seed are obtained at the end of each iteration, resulting in multiple motion coordinates. Finally, an encryption key is determined based on these coordinates, and the target data is encrypted using this key to obtain the encrypted data. This method uses computer simulation of random particle motion to calculate the key for encrypting the permanent magnet synchronous motor controller program. It offers fast encryption speed, a simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. This solves the problems of traditional program encryption methods, which suffer from short and fixed key lengths, susceptibility to brute-force attacks, slow encryption speed, and high computational resource and time consumption.
[0154] 2) The permanent magnet synchronous motor controller described in this application includes a first acquisition unit, a second acquisition unit, and a determination unit. The first acquisition unit acquires target data, which includes data in the permanent magnet synchronous motor controller that needs to be encrypted. The second acquisition unit acquires a random number seed and iteratively moves the random number seed based on the principle of random particle motion, acquiring the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates. The determination unit determines the encryption key based on each motion coordinate and uses the encryption key to encrypt the target data to obtain encrypted data. This method uses computer simulation of random particle motion to calculate the key for encrypting the permanent magnet synchronous motor controller program. It offers fast encryption speed, a simple algorithm, and low computational resource and time consumption. There is no upper limit to the total number of keys that can be generated, allowing for individual encryption of different programs. This solves the problems of traditional program encryption methods, which have short and fixed encryption key lengths, are easily cracked by brute force, and have slow encryption speeds, requiring significant computational resources and time.
[0155] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A data encryption method, characterized in that, The method, applied to a permanent magnet synchronous motor controller, includes: Acquire the target data, which includes the data in the permanent magnet synchronous motor controller that needs to be encrypted. Obtain a random number seed, and iterate over the random number seed based on the principle of random particle motion. Obtain the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates. The encryption key is determined based on the aforementioned motion coordinates, and the aforementioned encryption key is used to encrypt the aforementioned target data to obtain the encrypted data; Determining the encryption key based on the motion coordinates includes: determining the final motion coordinates based on the motion coordinates, wherein the final motion coordinates are the coordinates at the end of the last motion of the random number seed; determining the target angle based on the final motion coordinates, wherein the target angle is the angle formed by the target line and the target coordinate axis, and the target line is the line where the final motion coordinates and the origin of the coordinate system are located; calculating the arctangent value of the target angle, and determining the arctangent value of the target angle as the encryption key.
2. The data encryption method according to claim 1, characterized in that, The random number seed is iteratively moved based on the principle of particle random motion, and the coordinates of the random number seed are recorded at the end of each motion, resulting in multiple motion coordinates, including: The steps involve obtaining the number of iterations and the initial coordinates of the random number seed. The generation step involves randomly generating the particle movement direction and particle movement distance based on a random number generation algorithm. The particle movement direction includes both horizontal and vertical directions, and the particle movement distance includes both horizontal and vertical movement distances. The motion steps involve controlling the random number seed to move based on the direction and distance of the particle's movement, and determining the motion coordinates of the random number seed at the end of the current motion. Repeat the generation step and the movement step at least once until the number of times the random number seed is moved reaches the number of iterations.
3. The data encryption method according to claim 1, characterized in that, Encrypting the target data using the encryption key includes: The target data is converted into a target integer using a target algorithm, wherein the target algorithm is an algorithm that converts data into a hash value; Constructing the encryption formula ,in, The encrypted data, The target integer is... The encryption key; The target integer is encrypted according to the encryption formula and the encryption key to encrypt the target data.
4. The data encryption method according to claim 1, characterized in that, Based on the motion coordinates described, the encryption key is determined, including: The sum of the Euclidean distances of the multiple motion coordinates is used as the encryption key.
5. The data encryption method according to claim 1, characterized in that, Based on the motion coordinates described, the encryption key is determined, including: Based on the origin of the coordinate system and each of the motion coordinates, multiple target distances are determined. Each target distance is the straight-line distance between a motion coordinate and the origin of the coordinate system, and each target distance corresponds one-to-one with a motion coordinate. The numerical values of multiple target distances are compared, and the target distance with the largest value is determined as the encryption key.
6. The data encryption method according to claim 1, characterized in that, The method further includes: Obtain the data to be decrypted; Obtain the random number seed and the number of iterations; The decryption key is determined based on the random number seed and the number of iterations. Constructing the decryption formula ,in, For the decrypted data, The data to be decrypted, The decryption key; The data to be decrypted is decrypted according to the decryption formula and the decryption key to obtain the decrypted data.
7. A permanent magnet synchronous motor controller, characterized in that, include: The first acquisition unit is used to acquire target data, which includes data in the permanent magnet synchronous motor controller that needs to be encrypted. The second acquisition unit is used to acquire a random number seed, iterate the random number seed based on the principle of random particle motion, and acquire the coordinates of the random number seed at the end of each iteration to obtain multiple motion coordinates. The determining unit is used to determine an encryption key based on each of the motion coordinates, and to encrypt the target data using the encryption key to obtain encrypted data; The determining unit includes a second determining module, a third determining module, and a fourth determining module. The second determining module is used to determine the final motion coordinates based on each of the motion coordinates. The final motion coordinates are the coordinates at the end of the last motion of the random number seed. The third determining module is used to determine the target angle based on the final motion coordinates. The target angle is the angle formed by the target straight line and the target coordinate axis. The target straight line is the straight line where the final motion coordinates and the origin of the coordinates are located. The fourth determining module is used to calculate the arctangent value of the target angle and determine the arctangent value of the target angle as the encryption key.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the computer-readable storage medium to perform the data encryption method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including methods for performing the data encryption method according to any one of claims 1 to 6.
