CN109324920A - A kind of pair of byte arrays carry out verifying modified method and smart machine - Google Patents
A kind of pair of byte arrays carry out verifying modified method and smart machine Download PDFInfo
- Publication number
- CN109324920A CN109324920A CN201811174926.7A CN201811174926A CN109324920A CN 109324920 A CN109324920 A CN 109324920A CN 201811174926 A CN201811174926 A CN 201811174926A CN 109324920 A CN109324920 A CN 109324920A
- Authority
- CN
- China
- Prior art keywords
- byte
- copy
- original
- arrays
- length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/08—Error detection or correction by redundancy in data representation, e.g. by using checking codes
- G06F11/10—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
- G06F11/1008—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
- G06F11/1012—Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices using codes or arrangements adapted for a specific type of error
- G06F11/102—Error in check bits
Abstract
Byte arrays are carried out to verify modified method and smart machine, comprising: obtain target byte array;Target byte array includes original byte arrays, copy byte arrays and error correcting code byte arrays;According to the corresponding original length of original byte arrays, the corresponding copy length of copy byte arrays and the corresponding error correction code length of error correcting code byte arrays, reserved copy and duplicate byte arrays length is determined;Blunt end random number is carried out to original byte arrays and/or copy byte arrays according to reserved copy and duplicate byte arrays length, so that original length is equal to copy length;According to byte in the middle part of the original data header byte of original byte arrays, positive notebook data, copy data header byte, copy data middle part byte and the corresponding error correcting code byte of copy byte arrays carry out verification operation and obtain check results;It is corrected to obtain correct raw bytes array according to check results.Realize it is succinct, efficiently, verify and correct byte arrays, calculating restores correct raw bytes array.
Description
Technical field
The present invention relates to data processing field, espespecially a kind of pair of byte arrays carry out verifying modified method and intelligence is set
It is standby.
Background technique
With the development of network technology and the aggravation of market competition, requirement of the people to data accuracy is higher and higher,
But there are many disturbing factor in actual environment, can inevitably have an impact to data accuracy.
In order to monitor the accuracy of the data in data transmission, data storage procedure, first way is by initial data
It is directly compared with data to be compared, whether just the same sees, however this data check mode efficiency is extremely low, can only be again
Storage transmits data and is unable to error correction modification.The second way is additionally to increase by one in byte in data store and transmit
Bit is examined mistake for transmitting even odd check bit, however cannot be entangled after this verification mode verification discovery corrupt data
Mistake modification.
It is how succinct, efficiently, verification data and error data is quickly corrected, even if going out to reach in data
It staggers the time, can also calculate and restore the problem of correct initial data is urgent need to resolve.
Summary of the invention
It carries out verifying modified method and smart machine the object of the present invention is to provide a kind of pair of byte arrays, realizes letter
Clean, efficient, check byte array and bytes in error data are quickly corrected, even if malfunctioning to reach in byte data
When, it can also calculate and restore correct raw bytes array.
Technical solution provided by the invention is as follows:
The present invention provides a kind of pair of byte arrays and carries out verifying modified method, comprising steps of
Obtain target byte array;The target byte array includes original byte arrays, copy byte arrays and entangles
Error code byte arrays;
According to the corresponding original length of the original byte arrays, the corresponding copy length of copy byte arrays and error correction
The corresponding error correction code length of code byte arrays, determines the length of reserved copy and duplicate byte arrays length and the error correcting code byte arrays
Degree;
End is carried out to the original byte arrays and/or the copy byte arrays according to reserved copy and duplicate byte arrays length
Polishing random number, so that original length is equal to copy length;The random number is constant;
According to byte in the middle part of the original data header byte of the original byte arrays, positive notebook data, the copy byte
Copy data header byte, copy data middle part byte and the corresponding error correcting code byte of array carry out verification operation and obtain school
Test result;
It is corrected to obtain correct raw bytes array according to the check results.
Further, the acquisition target byte array specifically includes:
Byte arrays to be processed are handled to obtain original byte arrays and copy byte arrays;
Error correcting code byte arrays are obtained according to the original byte arrays or the copy byte arrays operation;The error correction
Code byte arrays include several tactic error correcting code bytes;
The original byte arrays, the copy byte arrays and the error correcting code byte arrays are dressed up into target word joint number
Group, so as to carry out data transmission or data save.
Further, described to obtain error correcting code byte according to the original byte arrays or the copy byte arrays operation
Before array comprising steps of
Byte quantity is carried out to the original byte arrays or the copy byte arrays to count to obtain byte quantity result;
When the byte quantity result is odd number, end is carried out to the original byte arrays or the copy byte arrays
Polishing default value is held, so that the byte quantity of the original byte arrays or the copy byte arrays is even number;It is described pre-
If numerical value is zero.
Further, described to obtain error correcting code byte according to the original byte arrays or the copy byte arrays operation
Array specifically includes step:
The original byte arrays or the copy byte arrays are subjected to symmetry division, obtain the original data header
Byte arrays in the middle part of byte arrays, the positive notebook data, the copy data header byte array and copy data middle part
Byte arrays;
According to byte in the middle part of the original data header byte, the positive notebook data, the copy data header byte and
Byte carries out XOR operation and obtains the error correcting code byte in the middle part of the copy data;
The error correcting code byte that operation is obtained corresponds to the arrangement of the original byte arrays or the copy byte arrays
Sequence is arranged to obtain the error correcting code byte arrays.
Further, it is described according to the original data header byte, byte, the number of copies in the middle part of the positive notebook data
The error correcting code byte is obtained according to byte progress XOR operation in the middle part of header byte and the copy data to specifically include:
Carrying out XOR operation to the original data header byte and byte in the middle part of the positive notebook data, to obtain first undetermined
Error correcting code byte;
Carrying out XOR operation to the original data header byte and byte in the middle part of the copy data, to obtain second undetermined
Error correcting code byte;
Carrying out XOR operation to the copy data header byte and byte in the middle part of the positive notebook data, to obtain third undetermined
Error correcting code byte;
Carrying out XOR operation to the copy data header byte and byte in the middle part of the copy data, to obtain the 4th undetermined
Error correcting code byte;
The corresponding frequency of occurrence of each error correcting code byte undetermined is counted, determines the most error correcting code byte undetermined of frequency of occurrence
For final error correcting code byte.
Further, the original data header byte according to the original byte arrays, positive notebook data middle part byte,
Copy data header byte, copy data middle part byte and the corresponding error correcting code byte of the copy byte arrays carry out school
It tests operation and obtains check results and specifically include step:
Byte XOR operation result is equal to error correction code word in the middle part of the original data header byte and the positive notebook data
Section, and byte XOR operation result is equal to the copy data head in the middle part of the original data header byte and the copy data
In the middle part of portion's byte and the positive notebook data when byte XOR operation result, the original data header byte, the original are determined
Byte is normal in the middle part of byte, the copy data header byte and the copy data in the middle part of data;
Byte XOR operation result is not equal to error correcting code in the middle part of the original data header byte and the positive notebook data
Byte, and the copy data header byte is equal to error correcting code byte phase with byte XOR operation result in the middle part of the copy data
Together, the original data header byte, the positive notebook data middle part byte error, the copy data header byte and institute are determined
It is normal to state byte in the middle part of copy data;
Byte XOR operation result is equal to error correction code word in the middle part of the original data header byte and the positive notebook data
Section, and byte XOR operation result is not equal to error correcting code byte in the middle part of the copy data header byte and the copy data
When, determine the copy data header byte, the byte error of copy data middle part, the original data header byte, institute
It is normal to state byte in the middle part of positive notebook data;
Byte XOR operation result is not equal to error correcting code in the middle part of the original data header byte and the copy data
Byte, and byte XOR operation result is equal to error correcting code byte in the middle part of the copy data header byte and the positive notebook data
When, determine the original data header byte, the byte error of copy data middle part, the copy data header byte, institute
It is normal to state byte in the middle part of positive notebook data;
Byte XOR operation result is not equal to error correcting code in the middle part of the copy data header byte and the positive notebook data
Byte, and byte XOR operation result is equal to error correcting code byte in the middle part of the original data header byte and the copy data
When, determine the copy data header byte, the positive notebook data middle part byte error, the original data header byte, institute
It is normal to state byte in the middle part of copy data;
Byte XOR operation result is equal to error correction code word in the middle part of the original data header byte and the positive notebook data
Section, and byte XOR operation result is equal to the copy data head in the middle part of the original data header byte and the copy data
In the middle part of portion's byte and the positive notebook data when byte XOR operation result, the original data header byte, the original are determined
Byte is normal in the middle part of byte, the copy data header byte and the copy data in the middle part of data, and the error correcting code byte goes out
It is wrong.
Further, it is described correct to obtain correct raw bytes array according to the check results specifically include step:
The byte error in the middle part of the original data header byte, the positive notebook data, the copy data header byte
With when byte is normal in the middle part of the copy data, the original data header byte is replaced with into copy data head word
Section, by the positive notebook data middle part byte of byte replacement in the middle part of the copy data;
The byte error in the middle part of the copy data header byte, the copy data, the original data header byte,
When byte is normal in the middle part of the positive notebook data, the copy data header byte is replaced with into the original data header byte,
Byte in the middle part of the copy data is replaced with into byte in the middle part of the positive notebook data;
The byte error in the middle part of the original data header byte, the copy data, the copy data header byte,
When byte is normal in the middle part of the positive notebook data, the original data header byte is replaced with into the copy data header byte,
Byte in the middle part of the positive notebook data is replaced with into byte in the middle part of the copy data;
The byte error in the middle part of the copy data header byte, the positive notebook data, the original data header byte,
When byte is normal in the middle part of the copy data, the copy data header byte is replaced with into the original data header byte,
Byte in the middle part of the copy data is replaced with into byte in the middle part of the positive notebook data;
Byte, the copy data header byte and institute in the middle part of the original data header byte, the positive notebook data
It is normal to state byte in the middle part of copy data, when the error correcting code byte malfunctions, reruns and determines new error correcting code byte.
Further, described long according to the corresponding original length of original byte arrays, the corresponding copy of copy byte arrays
Degree and the corresponding error correction code length of error correcting code byte arrays, determine reserved copy and duplicate byte arrays length and the error correction code word
The length of joint number group specifically includes step:
Compare the original length, copy length and error correction code length and obtains corresponding comparison result;The error correction code length
Degree is the physical length of error correcting code byte arrays;
When the original length is equal to the copy length, determine that reserved copy and duplicate byte arrays length is the original length
Or the copy length, the length of the error correcting code byte arrays are (original length+1)/2 or (copy length+1)/2;
When the original length be not equal to the copy length, and (original length+1)/2 be equal to the error correction code length
When spending, determine that reserved copy and duplicate byte arrays length is the original length;The length of the error correcting code byte arrays is (original length
+1)/2;
When the original length be not equal to the copy length, and (copy length+1)/2 be equal to the error correction code length
When spending, determine that reserved copy and duplicate byte arrays length is the copy length, the length of the error correcting code byte arrays is (copy length
+1)/2;
When the original length be greater than the copy length, and (original length+1)/2 be not equal to the error correction code length
Degree when (copy length+1)/2 are not equal to the error correction code length, determines that reserved copy and duplicate byte arrays length is the original
Length, the length of the error correcting code byte arrays are (original length+1)/2;
When the original length be less than the copy length, and (original length+1)/2 be not equal to the error correction code length
Degree when (copy length+1)/2 are not equal to the error correction code length, determines that reserved copy and duplicate byte arrays length is the copy
Length, the length of the error correcting code byte arrays are (copy length+1)/2;
Wherein, the length of the error correcting code byte arrays is rounded the numerical value of numerical digit.
The present invention also provides a kind of pair of byte arrays to carry out verifying modified smart machine, comprising:
Module is obtained, for obtaining target byte array;The target byte array includes original byte arrays, copy word
Joint number group and error correcting code byte arrays;
Length determination modul is connect with the acquisition module, for long according to the corresponding original of the original byte arrays
Degree, the corresponding copy length of copy byte arrays and the corresponding error correction code length of error correcting code byte arrays, determine reserved copy and duplicate word
Save the length of array length and the error correcting code byte arrays;
Data-parallel language module is connect with the length determination modul, is used for according to reserved copy and duplicate byte arrays length to described
Original byte arrays and/or the copy byte arrays carry out blunt end random number, so that original length is long equal to copy
Degree;The random number is constant;
Computing module is connect with the Data-parallel language module, for the original data head according to the original byte arrays
Portion's byte, byte in the middle part of positive notebook data, in the middle part of the copy data header bytes of the copy byte arrays, copy data byte with
And corresponding error correcting code byte carries out verification operation and obtains check results;
Processing module is connect with the computing module, obtains correct original word for correcting according to the check results
Joint number group.
Further, the acquisition module includes:
Processing unit obtains original byte arrays and copy byte arrays for handling byte arrays to be processed;
Arithmetic element is connect with the processing unit, for according to the original byte arrays or the copy byte number
Group operation obtains error correcting code byte arrays;The error correcting code byte arrays include several tactic error correcting code bytes;
Acquiring unit is connect with the arithmetic element, for by the original byte arrays, the copy byte arrays and
The error correcting code byte arrays dress up target byte array, so as to carry out data transmission or data save.
A kind of pair of byte arrays provided through the invention verify modified method and smart machine, realize it is succinct,
Efficiently, check byte array and bytes in error data are quickly corrected, even if to reach in byte data error,
Also it can calculate and restore correct raw bytes array.
Detailed description of the invention
Below by clearly understandable mode, preferred embodiment is described with reference to the drawings, a kind of pair of byte arrays are carried out
Above-mentioned characteristic, technical characteristic, advantage and its implementation for verifying modified method and smart machine are further described.
Fig. 1 is the flow chart that a kind of pair of byte arrays of the invention verify one embodiment of modified method;
Fig. 2 is the flow chart that a kind of pair of byte arrays of the invention verify another embodiment of modified method.
Specific embodiment
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, Detailed description of the invention will be compareed below
A specific embodiment of the invention.It should be evident that drawings in the following description are only some embodiments of the invention, for
For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other
Attached drawing, and obtain other embodiments.
To make simplified form, part related to the present invention is only schematically shown in each figure, they are not represented
Its practical structures as product.In addition, there is identical structure or function in some figures so that simplified form is easy to understand
Component only symbolically depicts one of those, or has only marked one of those.Herein, "one" is not only indicated
" only this ", can also indicate the situation of " more than one ".
The embodiment of the present invention, a kind of pair of byte arrays carry out verifying modified method, as shown in Figure 1, comprising:
S100 obtains target byte array;The target byte array include original byte arrays, copy byte arrays with
And error correcting code byte arrays;
S200 according to the corresponding original length of the original byte arrays, the corresponding copy length of copy byte arrays and
The corresponding error correction code length of error correcting code byte arrays determines reserved copy and duplicate byte arrays length and the error correcting code byte arrays
Length;
Specifically, byte arrays to be processed are handled to obtain original byte arrays, copy byte arrays and error correcting code byte
After array, be assembled into target byte array, thus by target byte array carry out data transmission or data save.For example,
Byte arrays to be processed in mobile phone are saved into computer, it is necessary first to handle the pending data in mobile phone to obtain target
Then byte arrays read the target byte array that mobile phone imports by computer, then according to the corresponding original of original byte arrays
The corresponding copy length of length, copy byte arrays and the corresponding error correction code length of error correcting code byte arrays, determine original word
The length of the length and error correcting code byte arrays of joint number group and copy byte arrays.
S300 carries out the original byte arrays and/or the copy byte arrays according to reserved copy and duplicate byte arrays length
Blunt end random number, so that original length is equal to copy length;The random number is constant;
S400 is described according to byte Bi in the middle part of the original data header byte Ai of the original byte arrays, positive notebook data
In the middle part of the copy data header byte Ai ' of copy byte arrays, copy data byte Bi ' and corresponding error correcting code byte Ci into
Row verification operation obtains check results;
S500 corrects to obtain correct raw bytes array according to the check results.
Specifically, when the length of original byte arrays and copy byte arrays is even number, not making to locate in the present embodiment
Reason.When the length of original byte arrays and copy byte arrays is odd number, to original byte arrays or copy byte arrays, or
Person's original byte arrays and copy byte arrays carry out blunt end random number, so that original length is equal to copy length.Directly
It connects and defines the first half original bytes of original byte arrays and be positive notebook data header byte Ai, after defining original byte arrays
Half part original byte is positive byte Bi in the middle part of notebook data.Similarly, the first half copy of copy byte arrays can also be defined
Byte is copy data header byte Ai ', and the latter half copy byte for defining copy byte arrays is word in the middle part of copy data
Save Bi '.In this way, to byte Bi, copy data header byte Ai ', number of copies in the middle part of original data header byte Ai, positive notebook data
Corresponding error correcting code byte Ci is obtained with the XOR operation of middle part byte according to middle part byte Bi ' carry out header byte, so that it is determined that
Error correcting code byte Ci.Further according to byte Bi in the middle part of determining error correcting code byte Ci and original data header byte Ai, positive notebook data,
The XOR operation of byte Bi ' carry out header byte and middle part byte obtains in the middle part of copy data header byte Ai ', copy data
As a result it is successively compared, so that corresponding check results are obtained, according to check results to the error correcting code byte Ci of corresponding error
With byte Bi in the middle part of original data header byte Ai, positive notebook data, copy data header byte Ai ', copy data middle part byte
Bi ' is modified.
For the technical program after practical application, the data greatly improved in data transmission or in data preservation are quasi-
True property, to reduce the number that data are transmitted or saved again, the number transmitted again due to reducing data be can reduce
The Internet resources that data transfer communications occupy, to promote communication quality and network transmission quality indirectly.Due to reducing data again
The number of secondary preservation promotes the efficiency of data backup copy.Also, realize succinct, efficient, check byte array and to error
Byte data is quickly corrected, even if thus reach byte data error when, can also calculate restore correctly it is original
Byte arrays solve the problems, such as that raw bytes array after malicious modification, destruction, is reached without transmitting original word joint number again
Group, or preservation raw bytes array can quickly restore to obtain the purpose of raw bytes array again.In addition, using exclusive or
The reversible particular principles of operation, there's almost no performance bottleneck, there is very big functional promotion than traditional completeness check.
Based on previous embodiment, as shown in Fig. 2, in the present embodiment, comprising:
S110 handles byte arrays to be processed to obtain original byte arrays and copy byte arrays;
The either data flow of digital communication or network protocol transmission, or the data storage occurred with document form
Is defined as: byte arrays.Firstly, defining " original byte arrays " is srcdata, which is srcLen.Secondly, fixed
Adopted " copy byte arrays " are cpydata, which is cpyLen.Then, defining " error correcting code byte arrays " is
Corrdata, the array length are corrLen.After obtaining byte data to be processed, byte data to be processed is saved respectively
Original byte arrays and copy byte arrays are obtained to two storage addresses.
S120 obtains error correcting code byte arrays according to the original byte arrays or the copy byte arrays operation;It is described
Error correcting code byte arrays include several tactic error correcting code bytes;
Specifically, original byte arrays include several original bytes, copy byte arrays include several copy bytes.
According to putting in order for original byte in original byte arrays exclusive or is successively carried out according to digit corresponding error correcting code is calculated
After byte, successively arrange error correcting code byte order to obtain error correcting code according to the corresponding digit of original byte in original byte arrays
Byte arrays.Similarly, according to putting in order for copy byte in copy byte arrays exclusive or is successively carried out according to digit calculate
To after corresponding error correcting code byte, according to the corresponding digit of copy byte in copy byte arrays successively by error correcting code byte order
Arrangement obtains error correcting code byte arrays.
The original byte arrays, the copy byte arrays and the error correcting code byte arrays are dressed up target word by S130
Joint number group, so as to carry out data transmission or data save;
S200 according to the corresponding original length of the original byte arrays, the corresponding copy length of copy byte arrays and
The corresponding error correction code length of error correcting code byte arrays determines reserved copy and duplicate byte arrays length and the error correcting code byte arrays
Length;
S300 carries out the original byte arrays and/or the copy byte arrays according to reserved copy and duplicate byte arrays length
Blunt end random number, so that original length is equal to copy length;The random number is constant;
S400 is described according to byte Bi in the middle part of the original data header byte Ai of the original byte arrays, positive notebook data
In the middle part of the copy data header byte Ai ' of copy byte arrays, copy data byte Bi ' and corresponding error correcting code byte Ci into
Row verification operation obtains check results;
S500 corrects to obtain correct raw bytes array according to the check results.
Based on previous embodiment, in the present embodiment, comprising:
S110 handles byte arrays to be processed to obtain original byte arrays and copy byte arrays;
S111 carries out byte quantity to the original byte arrays or the copy byte arrays and counts to obtain byte quantity
As a result;
S112 when the byte quantity result is odd number, to the original byte arrays or the copy byte arrays into
Row blunt end default value, so that the byte quantity of the original byte arrays or the copy byte arrays is even number;Institute
Stating default value is zero;
Specifically, when original byte arrays or copy byte arrays carry out byte quantity and count to obtain byte quantity result be
When even number, the first half original byte for directly defining original byte arrays is positive notebook data header byte Ai, defines original word
The latter half original byte of joint number group is positive byte Bi in the middle part of notebook data.Similarly, before copy byte arrays can also being defined
Half part copy byte is copy data header byte Ai ', and the latter half copy byte for defining copy byte arrays is copy
Byte Bi ' in the middle part of data.
When original byte arrays or copy byte arrays carry out byte quantity to count to obtain byte quantity result being odd number,
If the byte quantity result of original byte arrays is odd number, blunt end zero is carried out to original byte arrays, so that original
The byte quantity of byte arrays is even number.Similarly, if the byte quantity result of copy byte arrays is odd number, to copy word
Joint number group carries out blunt end zero, so that the byte quantity of copy byte arrays is even number.
Illustratively, if the byte quantity result of original byte arrays is 9, the byte quantity result of copy byte arrays
It is 8, illustrates that the header byte digit of original byte arrays and middle part byte digit differ, lead to not exact arithmetic and obtain original
The header byte of byte arrays error correcting code byte corresponding with middle part byte, accordingly, it is determined that the header byte of original byte arrays
After the first byte digit to the 5th byte digit, it is used for for adding one after the 9th byte digit of original byte arrays
The present count value zero of even number polishing.
The original byte arrays or the copy byte arrays are carried out symmetry division by S121, obtain the positive notebook data
Byte arrays { B1 ... ..., Bi } in the middle part of header byte array { A1 ... ..., Ai }, the positive notebook data, the copy data head
Byte arrays { B1 ' ... ..., Bi ' } in the middle part of portion's byte arrays { A1 ' ... ..., Ai ' } and the copy data;I is more than or equal to 1,
It and is even number;
S122 is according to byte Bi in the middle part of the original data header byte Ai, the positive notebook data, the copy data head
Portion byte Ai ' and copy data middle part byte Bi ' carry out XOR operation obtain the error correcting code byte Ci;
The error correcting code byte Ci that S123 obtains operation corresponds to the original byte arrays or the copy byte arrays
Put in order and arranged to obtain the error correcting code byte arrays;
Further, the S122 is according to byte Bi in the middle part of the original data header byte Ai, the positive notebook data, institute
It states byte Bi ' carry out XOR operation in the middle part of copy data header byte Ai ' and the copy data and obtains the error correcting code byte
Ci is specifically included:
S1221 carries out XOR operation with byte Bi in the middle part of the positive notebook data to the original data header byte Ai and obtains
First error correcting code byte Ci1 undetermined;
S1222 obtains the original data header byte Ai and byte Bi ' carry out XOR operation in the middle part of the copy data
To the second error correcting code byte Ci2 undetermined;
S1223 carries out XOR operation with byte Bi in the middle part of the positive notebook data to the copy data header byte Ai ' and obtains
To third error correcting code byte Ci3 undetermined;
S1224 obtains the copy data header byte Ai ' and byte Bi ' carry out XOR operation in the middle part of the copy data
To the 4th error correcting code byte Ci4 undetermined;
S1225 counts the corresponding frequency of occurrence of each error correcting code byte undetermined, determines the most error correction undetermined of frequency of occurrence
Code word section is final error correcting code byte.
Specifically, assuming original data header byte arrays { A1 ... ..., A4 }, the positive notebook data middle part byte arrays
Byte arrays in the middle part of { B1 ... ..., B4 }, the copy data header byte array { A1 ' ... ..., A4 ' } and the copy data
{ B1 ' ... ..., B4 ' };The error correction code word undetermined of XOR operation available first is so carried out according to header byte and middle part byte
Save C11=A1^B1, the second error correcting code byte C12=A1^B1 ' undetermined, third error correcting code byte C13=A1 ' ^B1 undetermined, the 4th
Error correcting code byte C14=A1 ' ^B1 ' undetermined.If A1=1, A1 '=1, B1=5, B1 '=5, then C11=C12 can be determined
=C13=C14, so determine error correcting code byte C1=1^5.^ represents XOR operation.It is only exemplary herein and illustrates first
The middle part byte of the header byte of digit and the first digit is the first digit occurred in the case that malice is distorted or destroyed
Error correcting code byte.It is other then be that the error correcting code byte Ci1 undetermined of statistics first, the second error correcting code byte Ci2 undetermined, third wait for
Determine the corresponding numerical value frequency of occurrence of the error correcting code byte Ci4 undetermined of error correcting code byte Ci3 and the 4th, determine frequency of occurrence it is most to
Determining error correcting code byte is final error correcting code byte.For example, it is assumed that three-figure header byte (A3 and A3 ') and third digit
Middle part byte (B3 and B3 ') carry out the first error correcting code byte C31=a undetermined, the second error correcting code undetermined that XOR operation obtains
Byte C32=a, third the error correcting code byte C34=b undetermined of error correcting code byte C33=a and the 4th undetermined, then determining that final
Three-figure error correcting code byte C3=a.
In the technical program, corresponding undetermined entangle is obtained according to statistical comparison header byte and the XOR operation of middle part byte
The number that the numerical value of error code byte occurs, so that it is determined that the error correcting code byte undetermined of frequency of occurrence at most is final error correction code word
Section, is able to ascend the confidence level of error correcting code byte, so that the reliability of error correcting code byte arrays increases, and then in root in this way
The operation of mutually verification integrality and accuracy is carried out according to original byte arrays, copy byte arrays and error correcting code byte arrays
When, the probability for needing to change error correcting code byte arrays is reduced, to reduce operand, promotes integrality, accuracy arithmetic check
Efficiency.
Further, the original data header byte Ai according to the original byte arrays, positive notebook data middle part word
Save Bi, copy data header byte Ai ', copy data middle part byte Bi ' and the corresponding error correction of the copy byte arrays
Code word section Ci carries out verification operation and obtains check results and specifically include step:
Byte Bi XOR operation result is equal to error correction in the middle part of the original data header byte Ai and the positive notebook data
Code word section Ci, and byte Bi ' XOR operation result is equal to institute in the middle part of the original data header byte Ai and the copy data
When stating byte Bi XOR operation result in the middle part of copy data header byte Ai ' and the positive notebook data, the positive notebook data is determined
Byte Bi, the copy data header byte Ai ' and copy data middle part word in the middle part of header byte Ai, the positive notebook data
It is normal to save Bi ';
It is entangled when the original data header byte Ai is not equal to byte Bi XOR operation result in the middle part of the positive notebook data
Error code byte Ci, and the copy data header byte Ai ' is equal to byte Bi ' XOR operation result in the middle part of the copy data
Error correcting code byte Ci is identical, determines the original data header byte Ai, the positive notebook data middle part byte Bi error, the pair
Notebook data header byte Ai ' and copy data middle part byte Bi ' are normal;
Byte Bi XOR operation result is equal to error correction in the middle part of the original data header byte Ai and the positive notebook data
Code word section Ci, and the copy data header byte Ai ' is not equal to byte Bi ' XOR operation result in the middle part of the copy data
When error correcting code byte Ci, determine the copy data header byte Ai ', byte Bi ' error in the middle part of the copy data, it is described just
Byte Bi is normal in the middle part of notebook data header byte Ai, the positive notebook data;
It is entangled when the original data header byte Ai is not equal to byte Bi ' XOR operation result in the middle part of the copy data
Error code byte Ci, and the copy data header byte Ai ' is equal to byte Bi XOR operation result in the middle part of the positive notebook data
When error correcting code byte Ci, the original data header byte Ai, copy data middle part byte Bi ' error, the pair are determined
Byte Bi is normal in the middle part of notebook data header byte Ai ', the positive notebook data;
It is entangled when the copy data header byte Ai ' is not equal to byte Bi XOR operation result in the middle part of the positive notebook data
Error code byte Ci, and the original data header byte Ai is equal to byte Bi ' XOR operation result in the middle part of the copy data
When error correcting code byte Ci, determine the copy data header byte Ai ', byte Bi error in the middle part of the positive notebook data, it is described just
Byte Bi ' is normal in the middle part of notebook data header byte Ai, the copy data;
Byte Bi XOR operation result is equal to error correction in the middle part of the original data header byte Ai and the positive notebook data
Code word section Ci, and byte Bi ' XOR operation result is equal to institute in the middle part of the original data header byte Ai and the copy data
When stating byte Bi XOR operation result in the middle part of copy data header byte Ai ' and the positive notebook data, the positive notebook data is determined
Byte Bi, the copy data header byte Ai ' and copy data middle part word in the middle part of header byte Ai, the positive notebook data
It is normal to save Bi ', the error correcting code byte Ci error.
Further, it is described correct to obtain correct raw bytes array according to the check results specifically include step:
The byte Bi error in the middle part of the original data header byte Ai, the positive notebook data, the copy data head
When byte Ai ' and copy data middle part byte Bi ' normal, the original data header byte Ai is replaced with into the copy
Data header byte Ai ', by the positive notebook data middle part byte Bi ' of byte Bi replacement in the middle part of the copy data;
Byte Bi ' the error in the middle part of the copy data header byte Ai ', the copy data, the original data head
When byte Bi is normal in the middle part of portion byte Ai, the positive notebook data, the copy data header byte Ai ' is replaced with into the original
Byte Bi ' in the middle part of the copy data is replaced with byte Bi in the middle part of the positive notebook data by data header byte Ai;
Byte Bi ' the error in the middle part of the original data header byte Ai, the copy data, the copy data head
When byte Bi is normal in the middle part of byte Ai ', the positive notebook data, the original data header byte Ai is replaced with into the number of copies
According to header byte Ai ', byte Bi ' in the middle part of the positive notebook data is replaced with into byte Bi in the middle part of the copy data;
The byte Bi error in the middle part of the copy data header byte Ai ', the positive notebook data, the original data header
When byte Bi ' is normal in the middle part of byte Ai, the copy data, the copy data header byte Ai ' is replaced with into the original
Byte Bi in the middle part of the copy data is replaced with byte Bi ' in the middle part of the positive notebook data by data header byte Ai;
Byte Bi, the copy data header byte in the middle part of the original data header byte Ai, the positive notebook data
Ai ' and copy data middle part byte Bi ' are normal, when the error correcting code byte Ci malfunctions, rerun and determine new error correction
Code word section Ci.
Further, described long according to the corresponding original length of original byte arrays, the corresponding copy of copy byte arrays
Degree and the corresponding error correction code length of error correcting code byte arrays, determine reserved copy and duplicate byte arrays length and the error correction code word
The length of joint number group specifically includes step:
Compare the original length, copy length and error correction code length and obtains corresponding comparison result;The error correction code length
Degree is the physical length of error correcting code byte arrays;
When the original length is equal to the copy length, determine that reserved copy and duplicate byte arrays length is the original length
Or the copy length, the length of the error correcting code byte arrays are (original length+1)/2 or (copy length+1)/2;
When the original length be not equal to the copy length, and (original length+1)/2 be equal to the error correction code length
When spending, determine that reserved copy and duplicate byte arrays length is the original length;The length of the error correcting code byte arrays is (original length
+1)/2;
When the original length be not equal to the copy length, and (copy length+1)/2 be equal to the error correction code length
When spending, determine that reserved copy and duplicate byte arrays length is the copy length, the length of the error correcting code byte arrays is (copy length
+1)/2;
When the original length be greater than the copy length, and (original length+1)/2 be not equal to the error correction code length
Degree when (copy length+1)/2 are not equal to the error correction code length, determines that reserved copy and duplicate byte arrays length is the original
Length, the length of the error correcting code byte arrays are (original length+1)/2;
When the original length be less than the copy length, and (original length+1)/2 be not equal to the error correction code length
Degree when (copy length+1)/2 are not equal to the error correction code length, determines that reserved copy and duplicate byte arrays length is the copy
Length, the length of the error correcting code byte arrays are (copy length+1)/2;
Wherein, the length of the error correcting code byte arrays is rounded the numerical value of numerical digit.
Firstly, realizing that defining srcdata is original byte arrays, srcLen is positive notebook data length.Cpydata is copy
Byte arrays, cpyLen are copy data length.Corrdata is error correcting code byte arrays, and corrLen is error correction code length.Ai
Byte, Ai ' copy byte arrays header byte, Bi ' copy word in the middle part of original byte arrays header byte, Bi original byte arrays
Byte, Ci are error correcting code byte in the middle part of joint number group.
IF1=0;/ * does not need modified byte quantity */512 normally after comparing statistics.Whether original byte arrays or
Person's copy byte arrays byte number is up to 512 bytes.
IF2=0;/ * using the byte quantity * in the byte amendment original byte arrays in copy byte arrays/
IF3=0;/ * using the byte quantity * in the byte amendment copy byte arrays in original byte arrays/
IF4=0;/ * corrects the middle part byte in copy byte arrays using the middle part byte in original byte arrays, with
And the byte quantity * of the header byte in the header byte amendment copy byte arrays in use copy byte arrays/
IF5=0;/ * corrects the header byte in copy byte arrays using the header byte in original byte arrays, with
And the byte quantity * of the middle part byte in the middle part byte amendment copy byte arrays in use copy byte arrays/
IF6=0;The byte quantity * of/* reconstruction error correcting code byte/
IF7=0;The other situation false alarms of/*, can not correct */
The step of realizing above-described embodiment according to following code:
/ * corrLen takes the actual length of error correcting code byte arrays, but be up to (defaultMaxLen+1)/2*/
The value of/* reserved copy and duplicate byte arrays length is extremely important, otherwise memory overflow */
/ * 0, first compare original length and copy length, if original length=copy length, takes reserved copy and duplicate byte number
Group length=original length or copy length */
/ * 1, first compare original length and copy length, if original length be not equal to copy length, and (original length+
1) when/2 being equal to error correction code length, then reserved copy and duplicate byte arrays length=original length is taken;
/ * 2, first compare original length and copy length, if original length be not equal to copy length, and (copy length+
1) when/2 being equal to error correction code length, then reserved copy and duplicate byte arrays length=copy length is taken;
/ * 3, first compare original length and copy length, if 0,1,2 is invalid, then take reserved copy and duplicate byte arrays length=
The relatively rear biggish length of MAX { original length, copy length }, i.e. original length and copy length.*/
/ * 4, error correcting code byte arrays length corrLen takes the actual length of error correcting code byte arrays, but is up to
(defaultMaxLen+1)/2*/
Specifically, if defaultMaxLen be odd number when, i.e., reserved copy and duplicate byte arrays length be odd number when, then error correction
Code byte length, which is less than, is equal to (defaultMaxLen+1)/2.If defaultMaxLen is even number, error correction code word
Section length, which is less than, is equal to (defaultMaxLen)/2.
Original length, copy length and error correction code length are obtained, can be compared and judge whether because outer between each other
There is mistake in factor influence in boundary's.Such as when original length be 20, copy length be 28, and error correction code length be 100 when, Ke Yigen
It is that reserved copy and duplicate byte arrays length knows that error correction code length maximum value is 28, therefore illustrates error correcting code according to error correction code length maximum value
Byte arrays are wrong, need to be recalculated according to original byte arrays to obtain new error correcting code byte arrays.
Specifically, raw bytes array is saved in different storage paths simultaneously when obtaining raw bytes array
Obtain corresponding original byte arrays and copy byte arrays.Even number polishing is carried out to original byte arrays, then to original word
Joint number group reclinates.Even number polishing is carried out to copy byte arrays, is then reclinated to copy byte arrays.Defining A is
Array header byte, defining B is byte in the middle part of array, it may be assumed that
For (i=0;i<(srcLen+1)/2;I++) { A=srcdata [i];B=srcdata [(srcLen+1)/2+
i];}
Definition C is error correcting code byte, then error correcting code byte C=A^B can be calculated;
To obtain original data header byte arrays { A1 ... ..., Ai }, positive notebook data middle part byte arrays
Byte arrays in the middle part of { B1 ... ..., Bi }, copy data header byte array { A1 ' ... ..., Ai ' } and copy data
{ B1 ' ... ..., Bi ' };I is more than or equal to 1, and is even number;Calculate Ci1=Ai^Bi, Ci2=Ai^Bi ', Ci1=Ai ' ^Bi, Ci1
=Ai ' ^Bi ' successively obtains C1, is arranged after C2 ... ..., Ci according to sequence and obtain error correcting code byte to obtain final Ci
Array.It is assembled according to original byte arrays, copy byte arrays, error correcting code byte arrays, obtains target byte array
Data[(original byte arrays) (copy byte arrays) (error correcting code byte arrays)], and carry out data transmission or data save.
Target byte array Data[(original byte arrays are obtained in transmission) (copy byte arrays) (error correcting code byte arrays)], or
Read and obtain target byte array Data[(original byte arrays) (copy byte arrays) (error correcting code byte arrays)] after, according to
Original data header byte Ai, the positive notebook data middle part byte Bi of original byte arrays, the copy data head of copy byte arrays
Byte Bi ' and corresponding error correcting code byte Ci carries out verification operation and obtains check results in the middle part of portion byte Ai ', copy data,
To correct to obtain correct raw bytes array according to the check results, so ensure raw bytes array integrality,
Consistency and accuracy.
The embodiment of the present invention, a kind of pair of byte arrays carry out verifying modified smart machine, comprising:
Module is obtained, for obtaining target byte array;The target byte array includes original byte arrays, copy word
Joint number group and error correcting code byte arrays;
Length determination modul is connect with the acquisition module, for long according to the corresponding original of the original byte arrays
Degree, the corresponding copy length of copy byte arrays and the corresponding error correction code length of error correcting code byte arrays, determine reserved copy and duplicate word
Save the length of array length and the error correcting code byte arrays;
Data-parallel language module is connect with the length determination modul, is used for according to reserved copy and duplicate byte arrays length to described
Original byte arrays and/or the copy byte arrays carry out blunt end random number, so that original length is long equal to copy
Degree;The random number is constant;
Computing module is connect with the Data-parallel language module, for the original data head according to the original byte arrays
Portion's byte, byte in the middle part of positive notebook data, in the middle part of the copy data header bytes of the copy byte arrays, copy data byte with
And corresponding error correcting code byte carries out verification operation and obtains check results;
Processing module is connect with the computing module, obtains correct original word for correcting according to the check results
Joint number group.
Specifically, smart machine includes that there is data-transformation facility or data to save the mobile phone of function, computer, intelligence
Phone wrist-watch etc..In addition, the present embodiment is the corresponding Installation practice of above method embodiment, specific effect is referring to above-mentioned side
Method embodiment, this is no longer going to repeat them.
Preferably, the acquisition module includes:
Processing unit obtains original byte arrays and copy byte arrays for handling byte arrays to be processed;
Arithmetic element is connect with the processing unit, for according to the original byte arrays or the copy byte number
Group operation obtains error correcting code byte arrays;The error correcting code byte arrays include several tactic error correcting code bytes;
Acquiring unit is connect with the arithmetic element, for by the original byte arrays, the copy byte arrays and
The error correcting code byte arrays dress up target byte array, so as to carry out data transmission or data save.
The present embodiment is the corresponding Installation practice of above method embodiment, specific effect referring to above method embodiment,
This is no longer going to repeat them.
It should be noted that above-described embodiment can be freely combined as needed.The above is only of the invention preferred
Embodiment, it is noted that for those skilled in the art, in the premise for not departing from the principle of the invention
Under, several improvements and modifications can also be made, these modifications and embellishments should also be considered as the scope of protection of the present invention.
Claims (10)
1. a kind of pair of byte arrays carry out verifying modified method, which is characterized in that comprising steps of
Obtain target byte array;The target byte array includes original byte arrays, copy byte arrays and error correcting code
Byte arrays;
According to the corresponding original length of the original byte arrays, the corresponding copy length of copy byte arrays and error correction code word
The corresponding error correction code length of joint number group determines the length of reserved copy and duplicate byte arrays length and the error correcting code byte arrays;
Blunt end is carried out to the original byte arrays and/or the copy byte arrays according to reserved copy and duplicate byte arrays length
Random number, so that original length is equal to copy length;The random number is constant;
According to byte in the middle part of the original data header byte of the original byte arrays, positive notebook data, the copy byte arrays
Copy data header byte, byte and corresponding error correcting code byte carry out verification operation and obtain verification knot in the middle part of copy data
Fruit;
It is corrected to obtain correct raw bytes array according to the check results.
2. according to claim 1 carry out byte arrays to verify modified method, which is characterized in that the acquisition target
Byte arrays specifically include:
Byte arrays to be processed are handled to obtain original byte arrays and copy byte arrays;
Error correcting code byte arrays are obtained according to the original byte arrays or the copy byte arrays operation;The error correction code word
Joint number group includes several tactic error correcting code bytes;
The original byte arrays, the copy byte arrays and the error correcting code byte arrays are dressed up into target byte array,
So as to carry out data transmission or data save.
3. according to claim 2 carry out byte arrays to verify modified method, which is characterized in that described according to
Original byte arrays or the copy byte arrays operation obtain before error correcting code byte arrays comprising steps of
Byte quantity is carried out to the original byte arrays or the copy byte arrays to count to obtain byte quantity result;
When the byte quantity result is odd number, end benefit is carried out to the original byte arrays or the copy byte arrays
Neat default value, so that the byte quantity of the original byte arrays or the copy byte arrays is even number;The present count
Value is zero.
4. according to claim 3 carry out byte arrays to verify modified method, which is characterized in that described according to
Original byte arrays or the copy byte arrays operation obtain error correcting code byte arrays and specifically include step:
The original byte arrays or the copy byte arrays are subjected to symmetry division, obtain the original data header byte
Byte arrays in the middle part of array, the positive notebook data, the copy data header byte array and copy data middle part byte
Array;
According to byte in the middle part of the original data header byte, the positive notebook data, the copy data header byte and described
Byte carries out XOR operation and obtains the error correcting code byte in the middle part of copy data;
Error correcting code byte that operation obtains is corresponded into putting in order for the original byte arrays or the copy byte arrays
It is arranged to obtain the error correcting code byte arrays.
5. according to claim 4 carry out byte arrays to verify modified method, which is characterized in that described according to
Byte in the middle part of original data header byte, the positive notebook data, the copy data header byte and copy data middle part
Byte progress XOR operation obtains the error correcting code byte and specifically includes:
XOR operation is carried out to byte in the middle part of the original data header byte and the positive notebook data and obtains the first error correction undetermined
Code word section;
XOR operation is carried out to byte in the middle part of the original data header byte and the copy data and obtains the second error correction undetermined
Code word section;
XOR operation is carried out to byte in the middle part of the copy data header byte and the positive notebook data and obtains third error correction undetermined
Code word section;
XOR operation is carried out to byte in the middle part of the copy data header byte and the copy data and obtains the 4th error correction undetermined
Code word section;
The corresponding frequency of occurrence of each error correcting code byte undetermined is counted, determines that the most error correcting code byte undetermined of frequency of occurrence is most
Whole error correcting code byte.
6. according to claim 1 carry out byte arrays to verify modified method, which is characterized in that described according to
Original data header byte, the positive notebook data middle part byte of original byte arrays, the copy data head of the copy byte arrays
Portion's byte, byte and corresponding error correcting code byte carry out verification operation and obtain check results specifically including step in the middle part of copy data
It is rapid:
Byte XOR operation result is equal to error correcting code byte in the middle part of the original data header byte and the positive notebook data, and
Byte XOR operation result is equal to copy data head word in the middle part of the original data header byte and the copy data
When section is with the positive notebook data middle part byte XOR operation result, the original data header byte, the positive notebook data are determined
Byte is normal in the middle part of middle part byte, the copy data header byte and the copy data;
Byte XOR operation result is not equal to error correcting code byte in the middle part of the original data header byte and the positive notebook data,
And the copy data header byte and byte XOR operation result in the middle part of the copy data are identical equal to error correcting code byte, really
Byte error, the copy data header byte and the pair in the middle part of the fixed original data header byte, the positive notebook data
Byte is normal in the middle part of notebook data;
Byte XOR operation result is equal to error correcting code byte in the middle part of the original data header byte and the positive notebook data, and
When byte XOR operation result is not equal to error correcting code byte in the middle part of the copy data header byte and the copy data, determine
Byte error, the original data header byte, the original number in the middle part of the copy data header byte, the copy data
It is normal according to middle part byte;
Byte XOR operation result is not equal to error correcting code byte in the middle part of the original data header byte and the copy data,
And when byte XOR operation result is equal to error correcting code byte in the middle part of the copy data header byte and the positive notebook data, determine
Byte error, the copy data header byte, the original number in the middle part of the original data header byte, the copy data
It is normal according to middle part byte;
Byte XOR operation result is not equal to error correcting code byte in the middle part of the copy data header byte and the positive notebook data,
And when byte XOR operation result is equal to error correcting code byte in the middle part of the original data header byte and the copy data, determine
Byte error in the middle part of the copy data header byte, the positive notebook data, the original data header byte, the number of copies
It is normal according to middle part byte;
Byte XOR operation result is equal to error correcting code byte in the middle part of the original data header byte and the positive notebook data, and
Byte XOR operation result is equal to copy data head word in the middle part of the original data header byte and the copy data
When section is with the positive notebook data middle part byte XOR operation result, the original data header byte, the positive notebook data are determined
Byte is normal in the middle part of middle part byte, the copy data header byte and the copy data, the error correcting code byte error.
7. according to claim 6 carry out byte arrays to verify modified method, which is characterized in that described according to
Check results, which are corrected to obtain correct raw bytes array, specifically includes step:
Byte error, the copy data header byte and institute in the middle part of the original data header byte, the positive notebook data
State byte in the middle part of copy data it is normal when, the original data header byte is replaced with into the copy data header byte, will
Byte in the middle part of the byte replacement positive notebook data in the middle part of the copy data;
It is the original data header byte, described when the copy data header byte, byte error in the middle part of the copy data
When byte is normal in the middle part of positive notebook data, the copy data header byte is replaced with into the original data header byte, by institute
It states byte in the middle part of copy data and replaces with byte in the middle part of the positive notebook data;
It is the copy data header byte, described when the original data header byte, byte error in the middle part of the copy data
When byte is normal in the middle part of positive notebook data, the original data header byte is replaced with into the copy data header byte, by institute
It states byte in the middle part of positive notebook data and replaces with byte in the middle part of the copy data;
The byte error in the middle part of the copy data header byte, the positive notebook data, it is the original data header byte, described
When byte is normal in the middle part of copy data, the copy data header byte is replaced with into the original data header byte, by institute
It states byte in the middle part of copy data and replaces with byte in the middle part of the positive notebook data;
Byte, the copy data header byte and the pair in the middle part of the original data header byte, the positive notebook data
Byte is normal in the middle part of notebook data, when the error correcting code byte malfunctions, reruns and determines new error correcting code byte.
8. according to claim 1-7 carry out byte arrays to verify modified method, which is characterized in that described
According to the corresponding original length of original byte arrays, the corresponding copy length of copy byte arrays and error correcting code byte arrays pair
The error correction code length answered determines that reserved copy and duplicate byte arrays length and the length of the error correcting code byte arrays specifically include step
It is rapid:
Compare the original length, copy length and error correction code length and obtains corresponding comparison result;The error correction code length is
The physical length of error correcting code byte arrays;
When the original length is equal to the copy length, determine reserved copy and duplicate byte arrays length for the original length or institute
Copy length is stated, the length of the error correcting code byte arrays is (original length+1)/2 or (copy length+1)/2;
When the original length be not equal to the copy length, and (original length+1)/2 be equal to the error correction code length
When, determine that reserved copy and duplicate byte arrays length is the original length;The length of the error correcting code byte arrays be (original length+
1)/2;
When the original length be not equal to the copy length, and (copy length+1)/2 be equal to the error correction code length
When, determine that reserved copy and duplicate byte arrays length is the copy length, the length of the error correcting code byte arrays be (copy length+
1)/2;
When the original length be greater than the copy length, and (original length+1)/2 be not equal to the error correction code length,
When (copy length+1)/2 are not equal to the error correction code length, determine that reserved copy and duplicate byte arrays length is that the original is long
Degree, the length of the error correcting code byte arrays are (original length+1)/2;
When the original length be less than the copy length, and (original length+1)/2 be not equal to the error correction code length,
When (copy length+1)/2 are not equal to the error correction code length, determine that reserved copy and duplicate byte arrays length is that the copy is long
Degree, the length of the error correcting code byte arrays are (copy length+1)/2;
Wherein, the length of the error correcting code byte arrays is rounded the numerical value of numerical digit.
9. a kind of pair of byte arrays carry out verifying modified smart machine characterized by comprising
Module is obtained, for obtaining target byte array;The target byte array includes original byte arrays, copy byte number
Group and error correcting code byte arrays;
Length determination modul is connect with the acquisition module, for according to the corresponding original length of the original byte arrays, pair
The corresponding copy length of this byte arrays and the corresponding error correction code length of error correcting code byte arrays, determine reserved copy and duplicate byte arrays
The length of length and the error correcting code byte arrays;
Data-parallel language module is connect with the length determination modul, is used for according to reserved copy and duplicate byte arrays length to the original
Byte arrays and/or the copy byte arrays carry out blunt end random number, so that original length is equal to copy length;Institute
Stating random number is constant;
Computing module is connect with the Data-parallel language module, for the original data header word according to the original byte arrays
Section, byte in the middle part of positive notebook data, byte and right in the middle part of the copy data header bytes of the copy byte arrays, copy data
The error correcting code byte answered carries out verification operation and obtains check results;
Processing module is connect with the computing module, obtains correct original word joint number for correcting according to the check results
Group.
10. according to claim 9 carry out byte arrays to verify modified method, which is characterized in that the acquisition mould
Block includes:
Processing unit obtains original byte arrays and copy byte arrays for handling byte arrays to be processed;
Arithmetic element is connect with the processing unit, for being transported according to the original byte arrays or the copy byte arrays
Calculation obtains error correcting code byte arrays;The error correcting code byte arrays include several tactic error correcting code bytes;
Acquiring unit is connect with the arithmetic element, for by the original byte arrays, copy byte arrays and described
Error correcting code byte arrays dress up target byte array, so as to carry out data transmission or data save.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811174926.7A CN109324920B (en) | 2018-10-09 | 2018-10-09 | Method for checking and correcting byte array and intelligent equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811174926.7A CN109324920B (en) | 2018-10-09 | 2018-10-09 | Method for checking and correcting byte array and intelligent equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109324920A true CN109324920A (en) | 2019-02-12 |
CN109324920B CN109324920B (en) | 2022-03-04 |
Family
ID=65261152
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811174926.7A Active CN109324920B (en) | 2018-10-09 | 2018-10-09 | Method for checking and correcting byte array and intelligent equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109324920B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02309821A (en) * | 1989-05-25 | 1990-12-25 | Fujitsu Ltd | Fano type successive decoder |
CN102356384A (en) * | 2011-08-23 | 2012-02-15 | 华为技术有限公司 | Method and device for data reliability detection |
CN103744750A (en) * | 2014-01-13 | 2014-04-23 | 杭州华为数字技术有限公司 | Method and device for recovering data |
CN104052576A (en) * | 2014-06-07 | 2014-09-17 | 华中科技大学 | Data recovery method based on error correcting codes in cloud storage |
CN106844098A (en) * | 2016-12-29 | 2017-06-13 | 中国科学院计算技术研究所 | A kind of fast data recovery method and system based on right-angled intersection erasure code |
-
2018
- 2018-10-09 CN CN201811174926.7A patent/CN109324920B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02309821A (en) * | 1989-05-25 | 1990-12-25 | Fujitsu Ltd | Fano type successive decoder |
CN102356384A (en) * | 2011-08-23 | 2012-02-15 | 华为技术有限公司 | Method and device for data reliability detection |
CN103744750A (en) * | 2014-01-13 | 2014-04-23 | 杭州华为数字技术有限公司 | Method and device for recovering data |
CN104052576A (en) * | 2014-06-07 | 2014-09-17 | 华中科技大学 | Data recovery method based on error correcting codes in cloud storage |
CN106844098A (en) * | 2016-12-29 | 2017-06-13 | 中国科学院计算技术研究所 | A kind of fast data recovery method and system based on right-angled intersection erasure code |
Also Published As
Publication number | Publication date |
---|---|
CN109324920B (en) | 2022-03-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11102322B2 (en) | Data processing method and apparatus, server, and controller | |
CN110196759B (en) | Distributed transaction processing method and device, storage medium and electronic device | |
US8581751B2 (en) | Multi-cell voltage secure data encoding in hybrid vehicles | |
CN107707619A (en) | Distributed storage method and device | |
Ducourthial et al. | Self-stabilization with r-operators | |
CN112380046A (en) | Calculation result checking method, system, device, equipment and storage medium | |
CN110297764B (en) | Vulnerability test model training method and device | |
CN115953172A (en) | Fraud risk identification method and device based on graph neural network | |
JP2017005692A (en) | Method and system for restoring packet | |
CN109324920A (en) | A kind of pair of byte arrays carry out verifying modified method and smart machine | |
US4661980A (en) | Intercept resistant data transmission system | |
CN112835719B (en) | Method and device for task processing, many-core system and computer readable medium | |
CN110502432A (en) | Intelligent test method, device, equipment and readable storage medium storing program for executing | |
CN115567167B (en) | Bus transmission data error correction method and device | |
CN101001089B (en) | Money search method and device in error correction decode | |
CN115174237A (en) | Method and device for detecting malicious traffic of Internet of things system and electronic equipment | |
CN111679791B (en) | Storage position selection method and device, terminal equipment and storage medium | |
CN108710557B (en) | Method and system for judging data consistency of distributed software program | |
CN115129509A (en) | Data transmission method, device and medium | |
CN110585717B (en) | Information processing method and device | |
CN113760367A (en) | Data processing method and device, electronic equipment and storage medium | |
JP7170886B2 (en) | Image transmission device, image reception device, image transmission program and image reception program | |
CN110244903A (en) | A kind of date storage method and device | |
CN117763376A (en) | Data aggregation method and device | |
CN106254026B (en) | Spectrum spreading method, spread spectrum control method and its device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20200108 Address after: 310051 room 906, North block, building 9, No. 88, Jiangling Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province Applicant after: Hangzhou rabbit small two Technology Industry Co., Ltd Address before: Room 418, 123 Building No. 1 Fengcheng Road, Yangpu District, Shanghai Applicant before: Shanghai Rabbit Little Two Technology Co., Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |