Method for improving the hash of a file
The method of generating multiple hashes using modifier codes and mixing numbers on a quantum computer enhances hash robustness and security by increasing unique hash generation, addressing vulnerabilities in existing hash functions.
Patent Information
- Application Number
- FR2022010136
- Authority / Receiving Office
- FR · FR
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-10-04
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2042-10-04
AI Technical Summary
Existing hash functions are vulnerable to creating the same hash from different but similar data, lacking robustness in identifying and securing data integrity.
A method involving the use of modifier codes and mixing numbers to generate multiple hashes of a file, utilizing a quantum computer for simultaneous calculations, and employing various modification and mixing functions to enhance hash diversity.
Increases the number of unique hashes generated, reducing the likelihood of guessing the hash of a file, thereby enhancing data integrity and security, particularly in financial transactions.
Smart Images

Figure 00000009_0000 
Figure 00000009_0001 
Figure 00000010_0000
Abstract
Description
Description Title of the invention: Method for improving the hashing of a file Technical field
[0001] The present invention relates to the field of information device security. matic and electronic, especially hashing. Prior art
[0002] = We call "hashed" the result of a hash function which, from a data initial input, calculates a fingerprint used to quickly identify, well that incompletely, the initial data.
[0003] — The quality of a hash function of a file F is often judged by the difficulty, in terms of calculation time, of calculating a file similar to file F but having an identical hash. This quality depends on the complexity of the function of hashing, but also the size of the calculated hash, and the possible existence of rules mathematics to reduce the number of calculations to be carried out to calculate a any similar files.
[0004] — Patent FR3092923 discloses a cryptographic method for verifying data in which a data is mixed with a mixing number, preferably initially a random number, before being hashed. So, in this case, the quality of the hash function of a given file depends on the cardinality of the set of numbers of different mixtures of given size which can be mixed in said pre-file lably to its hashing by said hash function and giving hashes different. The quality of the hash function is then proportional to this cardinality, because the larger the latter, the more likely it is to calculate different hashes with different mixing numbers. Statement of the invention
[0005] T1 therefore exists a need to improve the quality of hashing, particularly in terms robustness, to reduce the possibility of creating the same hash from data different but similar.
[0006] — The invention aims to meet this objective and has as its subject, according to one of its aspects, a method of calculating a modification code of a file or data, indif- commonly referred to as a file hereinafter, the process being implemented by at least one device, in particular with a view to increasing the number of possible hashes of the file mixed with different numbers of mixes, the file being mixed using a same mixing function, the minced being obtained using the same function of hashing, the process comprising the following steps: (a) establishing a list of a plurality of possible modifier codes taking into account the number of bits on which these codes are generated; b) establishing a list of a plurality of possible mixing numbers taking into account the number of bits on which these numbers are generated; (c) for each modifier code: 1) create a list of hashes of the file, preferably empty; ii) for each mixing number, calculate the hash of the file modified by the modifying code and then mixed with the mixing number, the modification of the file being carried out using the same modification function; iii) add each hash calculated in step ii) to the hash list in the file; iv) count the number of different elements N in the hash list; (v) store this number N, together with the associated modifier code, if N is the first to be counted or is greater than the number N previously stored; and d) return the last stored modifier code. A step vi) may be introduced in which the number N as well as the associated modifier are stored if N is equal to the number N previously stored. The device can be a personal computer, a smartphone, an email server, or a computer server, etc. The modification function, applied to the file, uses the modification code to alter the file. The file thus altered is then transmitted, in clear or encrypted form and accompanied by its electronic signature, preferably as defined in patent FR3092923. The invention makes it possible to increase the number of different hashes of the transmitted file and mixed with one of the possible numbers of mixtures, and thus reduce the probability of being able to guess the hash of the transmitted file and mixed with a number of mixtures. Advantageously, the calculation method according to the invention is implemented by a quantum computer. In a preferred embodiment, said plurality of modifier codes corresponds to at least 90% of all possible modifier codes given the number of bits on which these codes are generated. The plurality of modifier codes may correspond to all possible modifier codes given the number of bits on which these codes are generated. In a preferred embodiment, said plurality of mixing numbers corresponds to at least 90% of all possible mixing numbers given the number of bits on which these numbers are generated. The plurality of mixing numbers may correspond to all possible mixing numbers given the number of bits on which these numbers are generated. Preferably, the calculation of the hashes in step ii) is carried out simultaneously, using of a quantum computer, for said plurality of mixing numbers. Preferably, step c) is carried out using a quantum computer, simultaneously for said plurality of modifying codes. The mixing function, respectively the modification function, can be chosen from: - a logical function of type XOR adding all or certain bits of the file and those of the mixing number, respectively of the modifier code, one by one, - a suffix function adding the mix number, respectively the modifier code, to the end of the file, - a prefix function adding the mix number, respectively the modifier code, to the beginning of the file, - a function adding the mix number, respectively the modifier code, to the file at a predefined position, - an encryption function using the mixing number, respectively the modifier code, as the file encryption key. Preferably, the modification function is chosen from: - a suffix function adding the modifier code to the end of the file, - a prefix function adding the modifier code to the beginning of the file, - a function adding the modifier code to the file at a predefined position, - an encryption function using the modifier code as the file encryption key, the modifier code being for example added as a suffix or prefix to the encrypted file. The mixing function is for example, and in a non-limiting manner, a suffix function adding the mixing number to the end of the file, a prefix function adding the mixing number to the beginning of the file, a function adding the mixing number to the file at a predefined position, a symmetric or asymmetric encryption function using the mixing number as the encryption key of the file, or an XOR type logical function adding all or some bits of the file and those of the mixing number one by one. In one embodiment, the mixing function is different from the modifying function. In another embodiment, the mixing function is identical to the modifying function. The hash function is preferably chosen from SHA1, SHA2, SHA256, MDS5 and the Jenkins function, or truncations of the results of these functions. The modifier code can serve as a parameter to the hash function, in particular by modifying its internal mechanisms or by being one of the internal parameters. The modifier code is then, for example, added to the beginning of the file and serves as parameter to the hash function as a key for a keyed hash function, as for example described in the article "One-way hash functions with changeable parameters" published in 1999 in issue 188 of the journal "information sciences". The modifier code can also be or be part of the file to be modified, especially when this file is multimedia data such as an image. For example, in this case, the modifier code can modify certain attributes of certain elements of the image such as a color, a tone, a spacing, etc., or the attributes of a sound for an audio file. The mix number and modifier code can be the same size. Alternatively, the mix number and modifier code are of different sizes. If the modifier code is n-bit, the list established in step a) can include up to 2 modifier codes. Similarly, if the mixing number is m-bit, the list established in step b) can include up to 2 mixing numbers. The invention also relates, according to another of its aspects, to a computer program product comprising instructions readable by the processor of an apparatus for implementing the method according to the invention. Brief description of the drawings The invention may be better understood by reading the detailed description which follows, non-limiting examples of its implementation, and by examining the attached drawing, in which: [Fig.1] [Fig.1] schematically represents an example of file hashing according to the invention; [Fig.2] [Fig.2] schematically illustrates an example of implementation of the invention; and [Fig.3] [Fig.3] schematically represents an example of implementation of a method for verifying the integrity of a modified file according to the invention. Detailed description [Fig.1] schematically illustrates the steps for obtaining a hash H of a file F. In this example, the file F is modified by a modifier code CM using a modification function 105 and then mixed with a mixture number NM with a mixture function 104. The mixture and modification functions may be the same or different. For example, it may be a suffix function adding the modifier code CM or the mixture number NM, to the end of the file F. The mixture number and the modifier code may have the same size, for example 56 bits, or be of different sizes. Finally, the modified and then mixed file is hashed using a 106 hash function to give the hash H. An objective of the invention is to increase the number of possible hashes H of the file F mixed with different numbers of mixtures NM, the file being mixed using the same mixing function 104, the hashes H being obtained using the same hashing function 106. [Fig.2] is a block diagram illustrating the different steps of an example of a method according to the invention implemented on a device A. In step a), an exhaustive list of modifier codes CM of given size is established. If the modifier code CM is on n bits, this list includes 2 modifier codes. In step b), an exhaustive list of mixing numbers NM of given size is established. If the mixing number NM is on m bits, this list includes 2m mixing numbers. In step c), for each modifier code CM in the list established in step a), steps i) to v) are implemented. First, an empty list of hashes is created in step i). Then, in step ii), for each mix number NM in the list established in step b), the hash H of the file F modified by the modifier code CM and then mixed with the mix number NM is calculated, the modification being carried out by the same modification function 105. In step iii), each hash H calculated in the previous step is added to the list of hashes H of the file F if the latter does not already contain it. In step iv), the number of elements N in the list of hashes is counted. In step v), this number N and the associated modifier code CM are retained, if N is the first to be counted or is greater than the number N previously retained. In step d), the last retained CM modifier code is returned, as corresponding to the most robust hash operation. For example, if we consider a 2-bit modifier code, the set of modifier codes contains 4 constituent elements of the list established in step a) = {CM1, CM2, CM3, CM4}. Let us suppose that, for CM1, we obtain 3 different hashes (after mixing and modification), i.e. N=3. It is this number N which is retained initially in step v) since it is the first to have been calculated, with the associated modifier code CM1. Then, let us suppose that, for CM2, we obtain 4 different hashes, i.e. N=4. For this iteration, in step v), it is N=4 which will be retained with CM2 as the associated modifier code. Then, let us suppose that, for CM3, we obtain 2 different hashes, i.e. N=2 which will not be retained, because it is less than the previous one. Finally, let us suppose that for CM4, we obtain 1 different hash, i.e. N=1. It is this number N, with CM2, which will be retained.At the end, in step d), CM2 is returned as the modifier code corresponding to the most robust hash operation. [Fig.3] schematically represents an example of implementation of a method for verifying the integrity of a modified file according to the invention: Step 201: The message is received by device A Step 202: The modifier code is calculated Step 203: The mixing number, secret shared with the recipient B of the message is extracted from the memory Step 204: The file is modified with the modifier code, and mixed with the mix number Step 205: The hash of the file modified in step 204 using the modifier code and mixed using the mixing number is encrypted by a one-time key Step 206: the file obtained in step 204 is sent, in clear text with the encrypted hash obtained in step 205 to recipient B Step 207: Recipient B receives the file and verifies that the hash of the file mixed with the mixing number and then encrypted by the one-time key used in step 205 is equal to the encrypted hash transmitted with said received file. The invention is not limited to the exemplary embodiments described above. The calculation of the modifier code can be used within the framework of patent FR3092923, by adding the modifier code to data for which an electronic signature must be determined, and thus reducing the probability of allowing the undetected transmission of different data. The invention can be used in particular to secure financial transactions.
Claims
Claims
1. Method for calculating a modifier code (CM) of a file (F), implemented implemented by at least one device (A), in particular with a view to increasing the number of possible hashes (H) of the file mixed with numbers of different mixtures (NM), the file (F) being mixed using a same mixing function (104), the hashed (H) being obtained using of the same hash function (106), the method comprising the next steps: (a) establish a list of a plurality of modifier codes (MC) possible given the number of bits on which these codes are generated; b) establishing a list of a plurality of mixing numbers (NM) possible given the number of bits on which these numbers are generated; (c) for each modifier code (MC): 1) create a list of hashes (H) of the file (F), preferably empty; 11) for each mixture number (NM), calculate the minced (H) of the file (F) modified by the modifier code (CM) then mixed with the mixing number (NM), file modification (F) being carried out using the same modification function (105); iii) add each hash (H) calculated in step ii) to the list of hashes (H) from the file (F); iv) count the number of different elements N of the hash list (H); v) memorize this number N, as well as the modifier code (CM) associated, if N is the first to be counted or is greater than the number N previously stored; and d) returning the last stored modifier code (CM).
2. Method according to the preceding claim, said plurality of mod- (CM) corresponding to at least 90% of all modification codes possible (CM) given the number of bits on which these codes are generated.
3. Method according to one of the two preceding claims, said plurality of mixing numbers (MN) corresponding to at least 90% of all the possible mixing numbers (NM) given the number of bits on which these numbers are generated.
4. A method according to any preceding claim, the calculation minced meats (H) in step ii) carried out simultaneously for said plurality of mixing numbers (NM).
5. A method according to any preceding claim, wherein step (c) being carried out simultaneously for said plurality of modi- codes (CM).
6. A method according to any preceding claim, the mixing function (104), respectively the modification function (105), being chosen from: - a logic function of type XOR adding all or certain bits of the file (F) and those of the mixing number (NM), respectively of the code modifier (CM), one by one, - a suffix function adding the mixing number (NM), respec- tively the modifier code (CM), at the end of the file, - a prefix function adding the mixing number (NM), respec- tively the modifier code (CM), at the beginning of the file, - a function adding the mixing number (NM), respectively the modifier code (MC), to the file at a predefined position, - an encryption function using the mixing number (NM), respect- tively the modifier code (MC), as the encryption key of the file.
7. A method according to any preceding claim, the mixing function (104) being different from the modi- function fication (105).
8. A method according to any one of claims 1 to 6, the function of mixing (104) being identical to the modification function (105).
9. A method according to any preceding claim, the hash function (106) being chosen from SHA1, SHA2, SHA256, MDS5 and Jenkins function.
10. A method according to any preceding claim, the mixing number (NM) and modifier code (CM) having the same size.
11. | A method according to any one of claims 1 to 9, the number of mixture (NM) and the modifier code (CM) being of different sizes.
12. | Computer program product comprising instructions readable by the processor of a device (A) for implementing the method according to any one of the preceding claims.
