Target code comparison method and device

By mapping the hash value of the target code into an English word sequence, the traditional hash value comparison is solved, and a more intuitive and efficient comparison process is achieved.

CN119556967APending Publication Date: 2025-03-04CHINA HELICOPTER RES & DEV INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411392633.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In traditional methods, there is a lack of readability in direct comparison of complex hash values, making it difficult to identify differences and similarities during manual review or manual comparison.

Method used

By generating the feature code of the file, it is divided into n groups and mapped in the preset thesaurus to obtain n words for comparison of the target code. The specific steps include using a hash algorithm to generate the feature code and dividing it into each n hexadecimal value, and each set of feature code values ​​is mapped into one English word.

Benefits of technology

The hash value is converted into an English word sequence that is easy to remember and recognize, making the comparison results more readable and memorable, and improving the efficiency of manual review and manual comparison.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119556967A_ABST
    Figure CN119556967A_ABST
Patent Text Reader

Abstract

The invention provides a target code comparison method and device. The method comprises the following steps: generating a feature code of a file; the feature code is an N-bit M-ary numerical value; the N-bit feature codes are divided into n groups to be mapped in a preset word bank, and n words are obtained and used for target code comparison; wherein N is the power number of times of 2, the value of N is larger than 4, the value of n is the power number of times of 2, and the value of n is larger than or equal to 2. The problem that the readability is poor when complex hash values are directly compared in a traditional method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of software engineering management, and in particular relates to a target code comparison method and device. Background Art

[0002] The airborne software configuration management process runs through the entire software life cycle and should provide the ability to completely copy the executable object code to ensure that the software can be rebuilt. The software executable object code is binary code, which is difficult to read and review its version, and it is easy to cause version confusion. Therefore, it is necessary to add a comparison and verification process for the executable object code in the model software configuration management method.

[0003] Using the principle of hash algorithm, we developed a complete "target code comparison tool", formulated unified usage requirements and process system, released it to each software development unit, and implemented it in the model software configuration management to ensure the correctness of the executable target code file version of each research unit's software.

[0004] The traditional method directly compares complex hash values. Although this method ensures the uniqueness and security of the data, the generated hash value itself is a string of characters that is difficult to intuitively understand or remember, which still has deficiencies in readability during manual review or direct comparison. Summary of the invention

[0005] The present invention provides a target code comparison method and device to solve the problem of poor readability of directly comparing complex hash values ​​in traditional methods.

[0006] The first aspect of the present invention provides a target code comparison method, comprising:

[0007] Generate a signature code for the file; the signature code is an N-digit M-ary value;

[0008] Divide the N-bit feature code into n groups and map them in the preset word library to obtain n words for target code comparison;

[0009] Among them, N is a power of 2, the value of N is greater than 4, the value of n is a power of 2, the value of n is greater than or equal to 2; the value of N is greater than n.

[0010] Optionally, the word is an English word, a Chinese character, a Chinese word, or a graphic symbol.

[0011] Optionally, generate a signature for the file, including:

[0012] Use hash algorithm to generate the signature code of the file.

[0013] Optionally, the values ​​of M and N are 16, and the value of n is 4.

[0014] A second aspect of the present invention provides a target code comparison device, comprising:

[0015] The signature code generation module is used to generate a signature code of a file; the signature code is an N-digit M-ary value;

[0016] A mapping module is used to divide the N-bit feature code into n groups and map them in a preset word library to obtain n words for target code comparison;

[0017] Among them, N is a power of 2, the value of N is greater than 4, and the value of n is a power of 2, the value of n is greater than or equal to 2.

[0018] Optionally, the word is an English word, a Chinese character, a Chinese word, or a graphic symbol.

[0019] Optionally, the signature generation module is used to generate a signature of the file using a hash algorithm.

[0020] Optionally, the values ​​of M and N are 16, and the value of n is 4.

[0021] Beneficial technical effects of this application:

[0022] The present invention proposes a target code comparison method and device, which can hash the target code and convert it into an easy-to-remember English word sequence, and can ensure

[0023] 1. Uniqueness and security

[0024] The target code is processed using the SHA-256 algorithm to generate a unique and secure hash value.

[0025] 2. Efficiency

[0026] The whole process was fast and efficient.

[0027] 3. Easy to remember and recognize

[0028] Converting the hexadecimal feature values ​​into English word sequences makes the comparison results more readable and memorable. Compared with directly comparing complex hash values, using English words for comparison is more intuitive, especially when manually reviewing or manually comparing, it is easier to identify differences and similarities. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a flow chart of the target code comparison method provided by the present invention. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0031] The features and illustrative embodiments of various aspects of the present invention will be described in detail below. In the detailed description below, many specific details are proposed to provide a comprehensive understanding of the present invention. However, it is obvious to those skilled in the art that the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention. The present invention is by no means limited to any specific settings and methods proposed below, but covers any improvements, replacements and modifications of structures, methods, devices without departing from the spirit of the present invention. In the accompanying drawings and the following description, known structures and technologies are not shown to avoid unnecessary ambiguity in the present invention.

[0032] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other, and the embodiments can refer to and quote each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0033] The specific contents of the technical solution provided by the present invention are introduced below in conjunction with the accompanying drawings.

[0034] See also Figure 1 The present invention provides a target code comparison method, the method comprising:

[0035] Generate a signature code for the file; the signature code is an N-digit M-ary value;

[0036] Divide the N-bit feature code into n groups and map them in the preset word library to obtain n words for target code comparison;

[0037] Among them, N is a power of 2, the value of N is greater than 4, and the value of n is a power of 2, the value of n is greater than or equal to 2.

[0038] Optionally, the word is an English word, a Chinese character, a Chinese word, or a graphic symbol.

[0039] Optionally, generate a signature for the file, including:

[0040] Use hash algorithm to generate the signature code of the file.

[0041] Optionally, the values ​​of M and N are 16, and the value of n is 4.

[0042] The present invention also provides a target code comparison device, comprising:

[0043] The signature code generation module is used to generate a signature code of a file; the signature code is an N-digit M-ary value;

[0044] A mapping module is used to divide the N-bit feature code into n groups and map them in a preset word library to obtain n words for target code comparison;

[0045] Among them, N is a power of 2, the value of N is greater than 4, and the value of n is a power of 2, the value of n is greater than or equal to 2.

[0046] Optionally, the word is an English word, a Chinese character, a Chinese word, or a graphic symbol.

[0047] Optionally, a signature generation module is used to generate a signature of a file using a hash algorithm.

[0048] Optionally, the values ​​of M and N are 16, and the value of n is 4.

[0049] Exemplarily, in the comparison method provided by the present invention, the software target code comparison tool uses the principle of hash algorithm to generate a (16-bit hexadecimal) feature code value by scanning the software target code file, which is equivalent to the identification mark of the target code file. That is, it can identify slight changes in the target code file and is conducive to the filling in and comparison and verification of the feature code value.

[0050] Furthermore, the signature value is divided into 4 groups of 4 hexadecimal numbers, and each group of signature values ​​is mapped to an English word. A predefined word library is constructed to map the signature value to a specific English word. Make sure that the word library contains enough words and that these words are easy to remember and distinguish.

[0051] The generated English word sequence is used for comparison with the target code.

[0052] For example: Scan the object.out file to generate the signature code 0xa9b43c10d83012fe, and divide the signature code value into 4 groups, namely 0xa9b4, 0x3c10, 0xd830, and 0x12fe.

[0053] Create a corresponding matrix between feature code values ​​and English words, for example:

[0054] 0xa9b4………………fox

[0055] 0x3c10………………rai n

[0056] 0xd830………………and

[0057] 0x12fe………………sunny

[0058] ……………………

[0059] The feature words corresponding to the above object.out file are fox, rain, and, sunny

[0060] When comparing, directly use the generated feature words to complete the file comparison.

[0061] Exemplarily, the present invention provides a method for generating a word library. The present invention designs a library consisting of 5000 common words. A 4-bit hexadecimal number (ranging from 0x0000 to 0xFFFF) is mapped to an integer range from 0 to 4999.

[0062] The specific steps are: directly convert the hexadecimal number into a decimal number, and then take the modulus of 5000 (p=hex_value%5000) to obtain an integer p between 0 and 4999.

[0063] The calculated integer p is used as an index to select the pth word in the word library, thus ensuring that each hexadecimal number corresponds to a word.

[0064] The probability of word group repetition is calculated as 1 / (16*16*16*16 / 5000) 4 ≈0.0000339. Since the number of software versions in engineering practice usually does not exceed 100 times, the number of words in the preset vocabulary is relatively small, but the word combination obtained by this method can meet the actual usage needs.

Claims

1. A target code comparison method, characterized in that: include: Generate a signature code for the file; the signature code is an N-digit M-ary value; Divide the N-bit feature code into n groups and map them in the preset word library to obtain n words for target code comparison; Among them, N is a power of 2, the value of N is greater than 4, the value of n is a power of 2, the value of n is greater than or equal to 2; the value of N is greater than n.

2. The target code comparison method according to claim 1, characterized in that: The words include English words, Chinese characters, Chinese words, and graphic symbols.

3. The target code comparison method according to claim 1, characterized in that: Generates the signature of the file, including: Use hash algorithm to generate the signature code of the file.

4. The target code comparison method according to claim 3, characterized in that: The values ​​of M and N are 16, and the value of n is 4.

5. A target code comparison device, characterized in that: include: The signature code generation module is used to generate a signature code of a file; the signature code is an N-digit M-ary value; A mapping module is used to divide the N-bit feature code into n groups and map them in a preset word library to obtain n words for target code comparison; Among them, N is a power of 2, the value of N is greater than 4, and the value of n is a power of 2, the value of n is greater than or equal to 2.

6. The target code comparison device according to claim 5, characterized in that: The words include English words, Chinese characters, Chinese words, and graphic symbols.

7. The target code comparison device according to claim 5, characterized in that: The signature generation module is used to generate the signature of the file using a hash algorithm.

8. The target code comparison device according to claim 7, characterized in that: The values ​​of M and N are 16, and the value of n is 4.