A simple encryption method

By generating a long random number array and combining it with a custom algorithm and the microcontroller's unique ID to form an encrypted data array, the encryption problem of embedded devices is solved, ensuring device security and uniqueness, and protecting the interests of device developers.

CN115795500BActive Publication Date: 2026-03-06LUOYANG LONGSHENG SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211413142.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2026-03-06
Estimated Expiration
2042-11-11

AI Technical Summary

Technical Problem

The hardware of existing embedded devices typically uses common components, making it difficult to prevent copying. The encryption methods used to control the software programs are insufficient to protect the interests of device developers.

Method used

By generating a long array of random numbers and using a custom algorithm, combined with the microcontroller's unique ID, an encrypted data array is formed and stored in the application's storage area, ensuring that the device can only function fully after successful encryption.

Benefits of technology

This enhances the security of device encryption, making it impossible for the program to function properly even if copied to other microcontrollers, increasing the difficulty of cracking and protecting the rights of device developers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115795500B_ABST
    Figure CN115795500B_ABST
Patent Text Reader

Abstract

This invention introduces a simple encryption method. A host computer sends a command to the device to read the relevant information required for device encryption. The device's microcontroller distributes its unique ID array into a long random number array 1 and uploads the final array to the host computer. The host computer reconstructs the microcontroller's unique ID array. The host computer swaps the byte order of the unique ID array to form a new ID array and calculates a key array 1. This key array 1 is then distributed into the random number array 2 to form an encrypted data array. The host computer sends the encrypted data array to the device's microcontroller, which calculates key array 2 and compares it with key array 1. This invention uses multiple long random number arrays as interference data, greatly increasing the difficulty of cracking. The encrypted data array is stored within the application's storage area, making it difficult to identify. Furthermore, its association with the microcontroller's unique ID ensures that even if the encrypted microcontroller program is copied to another microcontroller, it cannot run fully.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded programming methods, and in particular to a simple encryption method. Background Technology

[0002] Embedded devices are becoming increasingly common in our daily lives, such as balance scooters and smart bracelets. Developing a mature product requires significant financial, human, and time resources. To protect their interests, companies need to implement protective measures for their products. Since most devices use generic components, making them difficult to copy, solutions must be found in the device's control software. Summary of the Invention

[0003] The purpose of this invention is to overcome the shortcomings of the prior art and provide a simple encryption method. The device can only operate normally with full functionality after encryption, thus preventing the device from being cracked and copied, and ensuring the rights and interests of the device product developers.

[0004] The technical solution adopted in this invention is:

[0005] A simple encryption method, the specific steps are as follows:

[0006] S1: The encryption process is initiated by the host computer, which sends a command to the device to read the relevant information required for device encryption;

[0007] S2: After receiving the command, the device's microcontroller reads its own unique ID array, then generates a long random number array 1, and then distributes its own unique ID array into the long random number array 1 according to a specific rule, and uploads the final array to the host computer as the response to the host computer's read command.

[0008] S3: After receiving the final array uploaded by the device's microcontroller, the host computer reconstructs the microcontroller's unique ID array using the same rules as S2;

[0009] S4: The host computer swaps the byte order of the unique ID array to form a new ID array;

[0010] S5: The host computer uses a custom algorithm to calculate key array 1 from the new ID array;

[0011] S6: The host computer generates a long random number array 2, and distributes the key array 1 into the random number array 2 according to a specific rule to form an encrypted data array;

[0012] S7: The host computer sends the encrypted data array to the device microcontroller. After receiving the encrypted data array, the microcontroller extracts the key array 1 according to the rules in S6. The microcontroller then calculates the key array 2 according to its own unique ID array using the same method as in S4 and S5, and compares the key array 2 with the extracted key array 1. If they are equal, proceed to step S8; if they are not equal, proceed to step S9.

[0013] S8: The microcontroller compares key array 2 and key array 1 and finds they are equal, indicating that the device has been successfully encrypted and can work in full functionality; the microcontroller saves the encrypted data array sent by the host computer to the local application storage area. The next time the device starts up, the microcontroller can determine whether the device has been correctly encrypted based on the contents of the saved encrypted data array.

[0014] S9: If the microcontroller finds that key array 2 and key array 1 are not equal, it indicates that the device encryption has failed and cannot function fully.

[0015] Due to the adoption of the technical solution described above, the present invention has the following advantages:

[0016] This invention uses multiple long random number arrays as interference data, making each communication transmission data different, greatly increasing the difficulty of cracking; the encrypted data array is stored inside the application storage area, making it difficult to identify; and it is associated with the microcontroller's unique ID, ensuring that the encrypted microcontroller program cannot run at full functionality even if copied to other microcontrollers, thus providing strong security. Attached Figure Description

[0017] Figure 1 This is a flowchart of the present invention.

[0018] Figure 2 This is a schematic diagram of the microcontroller's unique ID array being distributed into a random number array 1 in an embodiment of the present invention.

[0019] Figure 3 This is a schematic diagram illustrating the byte order of the unique ID array of the microcontroller in an embodiment of the present invention.

[0020] Figure 4 This is a schematic diagram of the storage of key array 1 in random number array 2 in an embodiment of the present invention. Detailed Implementation

[0021] The present invention will be further explained and described below with reference to the accompanying drawings and embodiments. However, this should not be construed as limiting the scope of protection of the present invention. The purpose of disclosing the present invention is to protect all technical improvements within the scope of the present invention.

[0022] In this embodiment, the processor used in the device is an STM32 series ARM processor, and each processor has a unique 12-byte ID; the encrypted data array is stored in the application storage area, with a storage address of 0x08000A00 and a length of 128 bytes.

[0023] Combined with appendix Figure 1-4 A simple encryption method, the specific steps are as follows:

[0024] S1: The encryption process is initiated by the host computer, which sends a command to the device to read the relevant information required for device encryption.

[0025] S2: After receiving the command, the device's microcontroller reads its own unique ID array and then generates a 128-byte random number array 1. Random number array 1 is divided into three parts. The first part is 12 bytes, and the lower three bits of each byte represent the offset address of each byte of its own unique ID array in the scattered storage, ranging from 0 to 7. The second part is divided into groups of 8 bytes, which are used to store the data of its own unique ID array in sequence. Each group stores one byte of the unique ID array, and the storage position is determined by each byte in the first part. The third part is the extra bytes, which retain the original random numbers. The final array is uploaded to the host computer as the response to the read command.

[0026] S3: After receiving the final array uploaded by the device's microcontroller, the host computer reconstructs the microcontroller's unique ID array using the same rules as S2.

[0027] S4: The host computer swaps the byte order of the unique ID array, such as... Figure 3 As shown, the values ​​of the 12-byte ID array are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 in sequence. Bytes 2 and 7 are swapped, as are bytes 4 and 6, bytes 8 and 10, and bytes 11 and 12. The final new ID array values ​​are 1, 7, 3, 6, 5, 4, 2, 10, 9, 8, 12, 11 in sequence.

[0028] S5: The host computer uses a 16-bit CRC calculation method with a custom polynomial to calculate the 2-byte key array 1 for the new ID array.

[0029] S6: The host computer generates a 128-byte long random number array 2, and then... Figure 4 The rule shown distributes the key array 1 into the random number array 2. The first two bytes of the random number array 2 are divided by 60 and the remainder is taken. The results are the storage offset addresses of the two bytes of key array 1. The two key data bytes replace the original data at the corresponding addresses in the random number array 2 to form an encrypted data array.

[0030] S7: The host computer sends the encrypted data array to the device microcontroller. After receiving the encrypted data array, the microcontroller extracts the key array 1 according to the rules in S6. The microcontroller then calculates the key array 2 according to its own unique ID array using the same method as in S4 and S5, and compares the key array 2 with the extracted key array 1. If they are equal, proceed to step S8; if they are not equal, proceed to step S9.

[0031] S8: The microcontroller compares key array 2 and key array 1 and finds they are equal, indicating that the device has been successfully encrypted and can work in full functionality; the microcontroller saves the encrypted data array sent by the host computer to the local application storage area. The next time the device starts, the microcontroller can determine whether the device has been correctly encrypted based on the contents of the saved encrypted data array.

[0032] S9: If the microcontroller finds that key array 2 and key array 1 are not equal, it indicates that the device encryption has failed and cannot function fully.

[0033] The parts of this invention not described in detail are prior art.

[0034] The embodiments selected herein for the purpose of disclosing the inventive objectives are currently considered suitable; however, it should be understood that the invention is intended to include all variations and modifications of the embodiments that fall within the scope of this concept and invention.

Claims

1. A simple encryption method, characterized by, The method comprises the following specific steps: S1: the encryption process is started by the upper computer, and the upper computer sends a command to the device to read the relevant information required for the device encryption; S2: the microcontroller of the device reads its own unique ID array after receiving the command, then generates a long random number array 1, disperses the unique ID array into the long random number array 1 according to a specific rule, and uploads the final array to the upper computer as a response to the reading command; S3: the upper computer restores the unique ID array of the microcontroller according to the same rule as S2 after receiving the final array uploaded by the microcontroller of the device; S4: the upper computer exchanges the byte order of the unique ID array to form a new ID array; S5: the upper computer calculates a secret key array 1 using a self-defined algorithm on the new ID array; S6: the upper computer generates a long random number array 2, disperses the secret key array 1 into the random number array 2 according to a specific rule two, and forms an encryption data array; S7: the upper computer sends the encryption data array to the microcontroller of the device, and the microcontroller extracts the secret key array 1 according to the rule in S6 after receiving the encryption data array; the microcontroller calculates a secret key array 2 according to the same method as S4 and S5 based on its own unique ID array, and compares the secret key array 2 with the extracted secret key array 1; If they are equal, go to step S8; If they are not equal, go to step S9; S8: the microcontroller compares the secret key array 2 and the secret key array 1, and if they are equal, it means that the device has been successfully encrypted and can work in full function; The microcontroller saves the encryption data array sent by the upper computer in the local application storage area, and next time the device starts, the microcontroller can judge whether the device has been correctly encrypted according to the content of the saved encryption data array; S9: the microcontroller compares the secret key array 2 and the secret key array 1, and if they are not equal, it means that the device encryption fails and cannot work in full function.

Citation Information

Patent Citations

  • Data encryption method, data query method, device, equipment and storage medium

    CN108632248A

  • Encryption and decryption method and system, electronic equipment and storage medium

    CN112887402A