A reversible transformation method for symbol sequences using a history of inversion operations dependent on Hamming weights.
The reversible transformation method using Hamming weight-based self-referential inversion addresses key management and computational complexity issues, achieving maximum entropy and pattern concealment in symbol sequences with flexible scrambling and efficient data conversion.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- 宮原 稜人
- Filing Date
- 2026-01-30
- Publication Date
- 2026-04-28
AI Technical Summary
Conventional data transformation methods using pseudorandom number generators and exclusive OR (XOR) operations face challenges with complex key management and increased computational costs, and existing methods that utilize Hamming weight are limited to parity checks in error correction codes without effectively achieving statistical isotropy and maximum information entropy for data concealment and whitening.
A reversible transformation method is developed that utilizes self-referential inversion based on Hamming weights to increase information entropy without external keys, incorporating equivalent min-min, variable min-min, and cyclic min-min transformations to maintain or adjust bit length while enhancing whitening ability, allowing flexible data scrambling.
The method produces symbol sequences with maximum entropy, concealing original patterns from third parties and ensuring complete reversibility, enabling complex transformations with simple algorithms, and maintaining high entropy regardless of input data statistics.
Smart Images

Figure 2026071284000001_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to digital data conversion technology, and particularly to a reversible conversion technology of symbol sequences that can be used for information concealment, communication channel coding, or data whitening. The algorithm of the present invention is conveniently called equivalent minimum conversion.
Background Art
[0002] In advanced digital communication and storage technologies, statistical biases remaining in data (such as the continuity of specific bit patterns) can induce security vulnerabilities. Therefore, there is a need for a technology to reconstruct the original signal into a symbol sequence that is statistically isotropic and has a maximized information entropy. Conventionally, there are technologies that utilize the Hamming weight of symbol sequences, but many of them have been limited to applications in parity checks in error correction codes (ECC) and the like. An approach that actively utilizes the Hamming weight as the "conversion core" of information and simultaneously achieves concealment and statistical whitening while reducing the dependence on external keys has not yet been fully developed.
Prior Art Documents
Patent Documents
[0003]
Patent Document 1
Patent Document 2
Non-Patent Documents
[0004]
Non-Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0005] Conventional data transformation methods using pseudorandom number generators and exclusive OR (XOR) operations have suffered from the complexity of key management and increased computational costs. The present invention aims to provide a reversible transformation method that increases the information entropy of a symbol sequence without requiring an external key by repeatedly performing a self-referential inversion process based on the "Hamming weight," which is an internal feature of the input data. Furthermore, in addition to transformations that extend the bit length (hereinafter referred to as variable min-min transformation), the present invention aims to provide a method that performs a transformation while maintaining the bit length (hereinafter referred to as equivalent min-min transformation), as well as a method that performs a transformation that maintains the bit length while improving the whitening ability beyond that of equivalent min-min transformation (hereinafter referred to as cyclic min-min transformation), thereby realizing flexible data scrambling according to the application. [Brief explanation of the drawing]
[0006] [Figure 1] Forward Equivalent Minmi Transformation Flowchart [Modes for carrying out the invention]
[0007] The following describes one embodiment of the present invention (hereinafter referred to as "this embodiment"). The data conversion device according to this embodiment is implemented by a general information processing device such as a personal computer, smartphone, or server.
[0008] [Device configuration] The data conversion device comprises a control unit (CPU), a storage unit (memory, HDD, etc.), and an input / output interface. The control unit functions as the following functional blocks by executing programs stored in the storage unit. 1. Hamming Weight Calculation Unit: This unit calculates the number of symbols with a value of "1" (Hamming weight) in the input symbol sequence (bit sequence). 2. Inversion control unit: Inverts the bit at the position corresponding to the calculated Hamming weight (for example, the Hamming weight-th position from the beginning). Repeats this operation until the bit sequence reaches a predetermined convergence state (for example, all "0"). 3. Encoding section: During the inversion operation, the history of which bits of which value were inverted (for example, if 1 is inverted, it is recorded as 1), this is delta encoded, and then encoded using the Huffman transform. 4. Padding: The encoded data is padded with bits until it matches the original bit length, and the final converted data is output.
[0009] [Conversion process steps] Next, we will explain the specific processing steps for the data conversion method (equivalent min-min conversion). Here, we will use the example where the N bits of data before conversion are "10010" (N=5).
[0010] (Step 1: Inverted Loop Processing) First, the calculation of the Hamming weight and bit inversion are repeated until the data converges to "00000". Initial state: "10010" (Hamming weight = 2) → Invert the second "0" from the left → "11010" • Second attempt: "11010" (humming weight = 3) → Invert the third "0" from the left → "11110" • 3rd time: "11110" (humming weight = 4) → reverse the 4th "1" from the left → "11100" • 4th time: "11100" (humming weight = 3) → reverse the third "1" from the left → "11000" • 5th time: "11000" (humming weight = 2) → Invert the second "1" from the left → "10000" • 6th time: "10000" (Hamming weight = 1) → Invert the first "1" from the left → "00000" (Convergence)
[0011] (Step 2: Generate history information) In the process described above, arranging the values of the bits that were to be inverted (the values before inversion) in order yields the history "001111". Next, we focus on the run-length encoding (number of consecutive identical symbols) of this historical information and perform delta coding using the increment (difference) of that number. In the history "001111", "0" appears twice consecutively, followed by "1" appearing four times consecutively. · Number of the first "0": 2 · Number of the next "1": 4 (an increase of 2 from the previous 2) Therefore, the delta code sequence obtained by taking the number and its difference is "2,2".
[0012] (Step 3: Huffman conversion) Perform Huffman conversion on the obtained delta code sequence "2,2" based on a predetermined rule. Example of conversion rule: 1→1, 2→01, 3→001, 4→0001... Applying this rule, since "2" is converted to "01", the delta code sequence "2,2" becomes a Huffman code sequence "0101" (4 bits).
[0013] (Step 4: Generation of output data) For the Huffman code sequence "0101", perform bit padding (padding) to match the original data length N (=5). In an example of equivalent minimum-minimum conversion, pad the right side (end) with 0 to generate "01010". The leading bit of the history (here "0") is not required for restoration, but adding it to the end as identification information can shorten the restoration processing time, which is a variable minimum-minimum conversion. As a result of equivalent minimum-minimum conversion, 5-bit padded data "01010" is output. A conversion method that outputs the converted data "010100" with a total of 6 bits (N + 1 bits), which is obtained by adding 1-bit identification information "0" to the 5-bit padded data "01010", is variable minimum-minimum conversion. In equivalent minimum-minimum conversion, if the symbol sequence is all 0 from the beginning, it converges from the beginning, so a string of only 0 is output as it is. In variable minimum-minimum conversion, if the symbol sequence is all 0 from the beginning, it converges from the beginning, so a string of only 0 with 0 added (N + 1 bits) is output.
[0014] By using equivalent minimum conversion and combining bit operations that seemingly appear random with variable-length encoding, it is possible to scramble the original bit sequence and achieve reversible conversion without increasing the number of bits. Note that in restoration (inverse conversion), since the trailing identification information is unknown, either 1 or 0 is added to the original string, the padding is removed to extract the Huffman code sequence, the history information is restored in the reverse procedure, and the original data can be uniquely identified by tracing the history backward from the convergence state (00000). (It is known that if the identification information is one of 1 or 0, restoration will succeed, and if it is the other, restoration will fail due to an out-of-array error.)
[0015] [Procedure for Restoration Processing of Equivalent Minimum Conversion] Next, the procedure for restoring the original data (N bits) from the converted data (N bits) will be described. Here, as an example, the case of restoring the original "10010" from the "01010" (N = 5 bits) output in the above conversion example will be cited. (Step 1: Separation of Data) Arbitrarily predict the last 1 bit of the input converted data "01010". Separate the N bits as encoded data. In the equivalent minimum conversion of the present invention, since accessing outside the symbol sequence will always occur during inverse conversion when the identification information is inverted, a symbol that does not cause access outside the symbol sequence is used as the identification information for the last 1 bit. · Identification information (first bit of history): "0" at the end · Encoded data (including padding): "01010" (Step 2: Restoration of History Information) First, perform Huffman decoding on the encoded data "01010" using the same rules as during encoding (1→1, 2→01,...). · "01" → "2" · "01" → "2" · Ignore the remaining "0" as padding. Thereby, the delta code sequence "2,2" is obtained. Next, use the identification information (first bit of history "0") and the delta code sequence to reconstruct the original history information. · Identification information is "0". · The first delta code is "2" → "0" for two consecutive times: "00" The second delta code is "2" → add 2 to the previous number of 2 to get 4. The symbol is inverted to "1" → four "1"s in a row: "1111". These are combined to restore the history of the inversion operation "001111". (Step 3: Inverse transformation loop processing) Using the restored history, the original data is generated by performing the reverse operation from the convergence state "00000" (all zeros). The rules for the inverse operation here are as follows: Let W be the Hamming weight of the current bit sequence, and h be the bit extracted from the history (the value before inversion). If h=1 (there was a 1→0 inversion): the position to be inverted is W+1. • If h=0 (there was a 0→1 inversion): the position to be inverted is W-1. Note that the history is used in reverse order of its creation (from end to beginning). • Initial state: "00000" (weight 0) The history ends with "1". Target position = 0 + 1 = 1st. Reverse the first one → "10000" • Second time: "10000" (weight 1) The next in the history is "1". Target position = 1 + 1 = 2nd. Reverse the second one → "11000" • 3rd time: "11000" (weight 2) The next item in the history is "1". Target position = 2 + 1 = 3rd. Reverse the third one → "11100" • 4th time: "11100" (weight 3) The next item in the history is "1". Target position = 3 + 1 = 4th. Reverse the 4th character → "11110" • 5th time: "11110" (weight 4) The next entry in the history is "0". Target position = 4-1 = 3rd. Reverse the third one → "11010" • 6th time: "11010" (weight 3) The end (beginning) of the history is "0". Target position = 3-1 = 2nd. Reverse the second one → "10010" Through the above process, the original data "10010" is uniquely restored.
[0016] (Restoration including pre-processing) Furthermore, if preprocessing (block inversion every m bits) has been performed, the original data before preprocessing can be restored by applying the same block inversion process (inverting even-numbered blocks, etc.) again to the data obtained in step 3 above. Effects of the present invention
[0017] If the number of transformations (iterations) is hidden, the resulting symbol sequence of historical data will have maximum entropy. In other words, it will be indistinguishable from completely random noise to a third party, completely concealing the pattern of the original data. It is completely reversible: Starting from an all-zero state, the original symbol sequence can be completely restored by tracing the recorded history in reverse order (performing the reverse operation). It has unique transformation characteristics: Unlike single operations such as bus inversion coding or mathematical calculations such as enumeration coding, it undergoes a dynamic process of "transforming itself" based on its "shape (weight)," allowing it to realize complex transformation maps despite being a simple algorithm. Furthermore, by combining this with a preprocessing step that divides the input data into m blocks and performs partial inversion, the initial bit array can be agitated before the main transformation, even when the input data is flat (consecutively consisting of only "0"s or only "1"s). This makes it possible to obtain transformed data with consistently high entropy, regardless of the statistical properties of the input data. [Examples]
[0018] An example of the equivalent Minmi transformation is shown below. 1. Invert the sign of the Hamming weighted element and save the inverted sign as the history. 2. Delta-encode the history. 3. Perform a Huffman transform on the delta-coded data using specific rules. 4. Combine all generated elements according to specific rules. For example, to convert the string "10010", the following process would be performed. 1. "10010" → "11010" → "11110" → "11100" → "11000" → "10000" → "00000" 2. The history of the inverted bits will be "001111" (the string "001111" and "00000" can be used to calculate "10010"). 3. Taking the difference in the number of entries in the history will give you "2,2". (It starts with 0 or 1 and the number increases. There are two 0s and two 1s, so it becomes 2,2. For example, if it's "0011100000", it will be "2,1,2".) 4. We perform a Huffman transform on the data "2,2". In this case, we perform the Huffman transform as follows: 1→1, 2→01, 3→001, 4→0001, ... This results in the string "0101". The last character of the Huffman-transformed 01 data is 1. 5. The original 01 data can be calculated from the two pieces of information: "00000" from the bit history and "0101" after the Huffman transform. These two pieces of information are then combined. 6. Applying the Huffman transform results in a string that is the same length as or shorter than the original 01 data. We use this to create the string "01010" by padding the right side of "0101" with zeros. This is a reversible transformation because it uses the information that there are 5 zeros, and by removing the zeros from the right, we can extract the string "0101". 7. If we apply the Huffman transformation rules, 1→0, 2→10, 3→110, and 4→1110, the resulting string will be "10101". In one example of the embodiment of the present invention, the conversion is performed according to the above flow. The information "01010" and "Converted once in the forward direction using equivalent conversion" can be converted to the string "10010".
[0019] Furthermore, as a variation that increases entropy (irregularity) through equivalent minmi transformation, a "preprocessing step" may be added before the aforementioned transformation step, in which the input symbol sequence is divided into groups (blocks) of m symbols (where m is an integer greater than or equal to 1), and the bits are inverted according to a predetermined rule. (Pre-processing procedure) 1. Divide the input symbol sequence into m-bit blocks from the beginning. 2. Invert all bits in the even-numbered (or odd-numbered) block. 3. Perform the transformation process using the Hamming weights described above (Minmi transformation) on the pre-processed symbol sequence. (Specific example) If the input data is "000000" (N=6) and the block length is m=2: 1. Block division: "00", "00", "00" 2. Reverse even-numbered blocks: "00", "11", "00" → Preprocessed data: "001100" 3. A reversal operation is performed on this "001100" that depends on the Hamming weight. This preprocessing increases the entropy of the final output data because, even with input data that has extremely few patterns, such as "all 0s" or "all 1s," the initial values and subsequent transitions (history) of the Hamming weights become more complex. During restoration, the original input data can be completely restored by first performing an inverse transformation based on identification information to recover the pre-processed data, and then applying the same rule (block inversion every m elements) again.
[0020] By using the processor's name in this pattern data, it may be possible to record information about who performed the transformation.
[0021] Because the variable minmin transformation uses Hamming weights, when counting the number of 1s, transforming a symbol sequence consisting only of 0s does not change anything. By processing the symbol sequence consisting only of 0s with an IF statement so that it gains one 0 and loses one 0 when transformed in reverse, it becomes possible to reversibly transform all symbol sequences so that they gain 1 bit. By combining this with the method already shown, it is possible to increase the entropy of symbol sequences consisting only of 0s as well.
[0022] If a variable Minmi transformation increases the value by 1 bit, then a variable inverse Minmi transformation decreases it by 1 bit. Since the inverse Minmi transformation is determined by a 1-bit identification piece of information, by converting it to a symbol sequence indicating whether or not it can be transformed, it is possible to create reversible 01 data without increasing the value by 1 bit. For convenience, this is called a circular Minmi transformation. The simplest circular Minmi transformation can be converted back to the original state using only the information that "a circular Minmi transformation was performed," "whether the transformation was performed forward or backward," and "the number of transformations."
[0023] The variable Minmin inverse transformation, which reduces by one bit, determines whether it can reduce by one bit based on the terminating bit. In other words, by adding a bit that can be reduced by one bit to the original string and performing the variable Minmin inverse transformation, the original length can be maintained during the transformation. This is called the equivalent Minmin transformation. The equivalent Minmin transformation has the same ability to crumple data as the variable Minmin transformation, but is lighter, with a processing time of up to twice that of the Minmin transformation, and is reversible without adding one bit. The equivalent Minmin transformation adds one bit of random 01 data (e.g., 1) to the beginning, and if it can compress by one bit, that is the result; if not, it adds the opposite 0 and returns the compressed result. The inverse transformation is performed by performing the variable Minmin transformation and discarding one bit to return to the original. Variants of the variable Minmin transformation are the equivalent Minmin transformation and the cyclic Minmin transformation.
[0024] The following are VBA program examples for the Minmin transformation, inverse Minmin transformation, circular Minmin transformation, and circular inverse Minmin transformation. You can experience the equivalent Minmin transformation by pasting and running these programs in a standard module. The program code below is just an example; in actual operation, it is preferable to implement it using a language such as C++ or Python, employing high-speed bitwise operations. Option Explicit --- Sample for testing --- Public Sub Run Test() Dim SourceData As String Dim converted_data As String Original Data = Generate random 01 data of the specified length (100) 'Generate 100 bits of random 01 data 'Original Data = Range("A3").Value 'Use this if you want to try with your favorite 01 data. Converted data = Original data Range("A:A").ClearContents Range("A2").Value = "Data to be converted (1 character or more)" Range("A3").Value = "'" & converted data 'Converted data = Invert every specified number of elements(Converted data, 3)' If you want to enhance scrambling Converted data = Long equivalent Minmi conversion(True, Converted data, 1, 100) 'Process by dividing into 100-bit chunks only once in the forward direction Range("A5").Value = "Equivalent Minmi Algorithm Conversion Result" Range("A6").Value = "'" & converted data Converted data = Long equivalent Minmi conversion(False, Converted data, 1, 100) 'Perform the reverse conversion once 'Converted data = Invert every specified number of elements(Converted data, 3)' If you want to enhance scrambling Range("A8").Value = "Equivalent Minmi Inverse Transformation Result" Range("A9").Value = "'" & converted data End Sub '================================================================ '================================================================ A function to enable processing of long strings after equivalent conversion. '================================================================ '================================================================ Private Function LongEquivalentConversion(ByVal isForwardConversion As Boolean, ByVal StringToConvert As String, Optional ByVal NumberOfConversions As Long = 1, Optional ByVal HowManyBitsToDelimited As Long = 100) As String Dim conversion_string As Variant Dim i As Long Convert string = Split into specified number of bits (string to convert, number of bits to delimited) For i = LBound(converted string) To UBound(converted string) Convert string(i) = Equivalent Minmi conversion (perform is-order conversion, Convert string(i), Number of conversions) Next i Long equivalent conversion = concatenates separated data (converted string) End Function ' A function that splits a string by a specified number of bits and puts the result into a Variant array. Private Function Split by Specified Bit Count (ByVal Data to Split As String, ByVal Number of Bits to Split As Long) As Variant Dim result() As Variant Dim dataLength As Long Dim arraySize As Long Dim i As Long dataLength = Len(data to be divided) Error avoidance: If 0 or a negative number is specified, return an empty value. If the number of bits to divide into is less than 0, then Exit Function If dataLength = 0 Then Exit Function --- Calculates the size (number of elements) of the array --- The backslash (\) is used to find the quotient (the integer part of the answer to a division problem). arraySize = dataLength \ How many bits to divide into If there is a remainder, increase the number of elements by one (e.g., 230 ÷ 100 = 2 remainder 30 → number of elements becomes 3). If (dataLength Mod how many bits to divide into) > 0 Then arraySize = arraySize + 1 End By ReDim result(1 To arraySize) --- Cuts the data into segments of the specified number of bits and places them into an array --- For i = 1 To arraySize The Mid function does not produce an error even if the actual number of characters is shorter than the specified length. It retrieves everything up to the end. This automatically retrieves "30 bits" only at the end. result(i) = Mid(data to divide, (i - 1) * number of bits to divide into + 1, number of bits to divide into) Next i Divide into specified number of bits = result End Function A function that concatenates data in a Variant array into a single string. Private Function "Concatenate_Delimited_Data" (ByVal "Concatenate_Data" As Variant) As String Dim result As String Dim Element As Variant The contents of the array are concatenated in order. For Each Element In Connected Data result = result & element Next element Concatenating separated data = result End Function '================================================================ '================================================================ Equivalent Minmi Conversion '================================================================ '================================================================ '================================================================ '================================================================ Private Function EquivalentConversion(ByVal "Converts in order" As Boolean, ByVal "ConvertString" As String, Optional ByVal "NumberOfConversions" As Long = 1) As String Dim conversion_success_failure As Boolean Dim conversion_result As String, conversion_resultbuff As String Dim i As Long If conversion count = 0 Then Equivalent Minmi Conversion = Conversion String Exit Function ElseIf conversion count < 0 Then MsgBox "Please specify 0 or more times for the number of equivalent conversion operations." Exit Function End By If the string to be converted = "" Then Equivalent Minmi Transformation = "" Exit Function End By If is to perform forward conversion = True Then Conversion result = converted string For i = 1 To number of conversions 'Conversion result = Invert every specified number of items(conversion result, 1) Conversion result buff = Minmi conversion removes one bit (conversion result & "1", conversion success / failure) If conversion success = True Then 'Conversion successful Conversion result = Conversion result buff Else Conversion result = Remove one bit with Minmi conversion (Conversion result & "0") End By Next i Equivalent Minmi Conversion = Conversion Result Else Conversion result = converted string For i = 1 To number of conversions Conversion result = One bit added using Minmi conversion (conversion result) Conversion result = Right-hand bit reduced by 1 bit (conversion result) 'Conversion result = Invert every specified number of items(conversion result, 1) Next i Equivalent Minmi Conversion = Conversion Result End By End Function '================================================================ '================================================================ 'Circular Minmi conversion (conversion is performed using only information on whether it is forward or reverse and the number of times)' '================================================================ '================================================================ Public Function CircularConversion(ByVal isForwardConversion As Boolean, ByVal ConvertString As String, Optional ByVal NumberOfConversions As Long = 1) As String Dim conversion_history As String Dim buff1 As String, buff2 As String Dim i As Long If conversion count = 0 Then Circular Minmi Conversion = Conversion String Exit Function ElseIf conversion count < 0 Then MsgBox "Please specify 0 or more times for the number of cycle conversions." Exit Function End By If the string to be converted = "" Then Cyclic Minmi Conversion = "" Exit Function End By Conversion buff1 = conversion string If is to perform forward conversion = True Then For i = 1 To number of conversions Perform forward conversion conversion buff1 = cyclic minmi conversion sub(conversion buff1, conversion history) Conversion buff1 = Conversion history & Conversion buff1 Conversion history = "" Next i Else For i = 1 To number of conversions Perform the inverse transformation. Transform buff1 = Right-hand 1 bit reduction (Transform buff1, Transform buff2) Transform buff1 = Reverse cycle minmi transformation sub(Transform buff2, Transform buff1) Next i End By Circular Minmi Conversion = Conversion buff1 End Function '================================================================ '================================================================ 'Circular Minmi Conversion Auxiliary Function' '================================================================ '================================================================ '================================================================ A recursive function that repeatedly deletes and inverts bits until the conversion is successful. '================================================================ Private Function cyclic_minmi_conversion_sub(ByVal_conversion_string As String, ByRef_conversion_history As String, Optional ByVal_is_successful_previous_conversion As Boolean = True) As String Dim conversion_success_failure As Boolean Dim conversion_result As String ' --- Termination Conditions --- 'The process ends when it becomes 1 bit (this is the end point of compression).' If Len(converted string) = 1 Then Circular Minmi Conversion sub = Conversion String Exit Function End By 1. Attempt bit deletion Conversion result = Remove one bit using Minmi conversion (conversion string, conversion success / failure) If conversion success or failure Then ' -------------------------------------------------- (Branch on success) If the previous attempt was a "failure (reversal)," this success is considered a "confirmed event" and will not be recorded in the history. Only if the previous attempt was a "success" will it be recorded as a pure success with a value of "1". ' -------------------------------------------------- If is successful in the previous conversion = True Then Conversion history = Conversion history & "1" End By Recursive call (This time it was successful, so next time we'll pass True) Circular Minmi Conversion Sub = Circular Minmi Conversion Sub(Conversion Result, Conversion History, True) Else ' -------------------------------------------------- (Branch in case of failure) Since it failed, record "0" and reverse the data. 'For the next turn, as "processing after failure", pass is Success in the previous conversion = False. ' -------------------------------------------------- Conversion history = Conversion history & "0" Dim InvertedData As String Reversed data = Reversal of last 01 (converted string) Recursive call with inverted data (previous failure flag = False) cyclic minmi conversion sub = cyclic minmi conversion sub(inverted data, conversion history, False) End By End Function '================================================================ The Inverse Transform of the Circular Minmi Transform (Definitive Edition) '================================================================ Private Function ReverseCirculationMinmiConversionSub(ByVal ConversionResultString As String, ByVal ConversionHistory As String) As String Dim i As Long Dim currentStr As String Dim char As String currentStr = converted string By processing the history in reverse order, we can go back in time. For i = Len(Conversion History) To 1 Step -1 char = Mid(Conversion History, i, 1) If char = "1" Then "1" is a record of pure deletion. 'Reverse operation: Add 1 bit' currentStr = Add one bit using Minmi conversion (currentStr) ElseIf char = "0" Then "0" represents a set record of "failure (reversal) → forced success (deletion) immediately following." The reverse operation is to reverse the order: 1. First, undo the "forced success (deletion)" (add bit). currentStr = Add one bit using Minmi conversion (currentStr) 2. Next, undo the "failure (reversal)" (reversing it again will return it to its original state). currentStr = Reverse the last 01 (currentStr) End By Next i Reverse Cycle Minmi Transformation sub = currentStr End Function '================================================================ '================================================================ A program that performs compression and decryption in a single instruction. '================================================================ '================================================================ Public Function AddOneBitWithMinmiConversion(ByValOriginalDataAsString)AsString Dim myData As String Dim myLog As String Dim loopbuff As Boolean myData = Original Data myLog = "" ' The history is initially empty '================Compression Program================ If all is zero then true(myData) = True Then myData = OriginalData & "0" Adding one bit with Minmi conversion = myData Exit Function End By Encryption myData, mylog '============================================ Dim first bit As String Dim minmi_conversion_difference_data As String Dim minmi_data_before_conversion As String Difference data after Minmi transformation = Huffman transformation (convert to 01 data of the difference (myLog, first bit)) Minmi's data before conversion = myData Adding one bit with Minmi conversion = Right-hand zero padding (difference data after Minmi conversion, Len(data of length before Minmi conversion)) & first bit End Function 'Conversion feasibility check: Enter true if conversion is successful, enter false if conversion fails.' If it cannot be deleted as is, inverting the rightmost bit will make it possible to delete. The process that uses that history is called circular transformation. Public Function DeleteOneBitWithMinmiConversion(ByVal OriginalData As String, Optional ByRef ConversionValidityCheck_TrueIfSuccessful As Boolean) As String 'Range("A36").Value = "---The first bit of the difference in the number of 01s---" If the rightmost value is 1 and all others are zero, then true (original Data) = True Then If Not IsMissing(Conversion possibility determination_True if successful) Then Conversion feasibility check: True if successful = False End By Minmi conversion removes one bit = Original Data Exit Function End By Dim first bit 2 As String Dim minmi_conversion_difference_data2 As String Dim Minmi_Data_Before_Conversion_Length2 As String Minmi conversion difference data 2 = right-hand 1 bit reduction (original data, first bit 2) Data 2 (length before Minmi conversion) = Len(Difference Data 2 after Minmi conversion) Minmi conversion difference data 2 = Right-side zeros removed (Minmi conversion difference data 2) Dim Minmi_Converted_Data2 As String Data 2 after Minmi transformation = Reconstructed from the difference 01 data (Huffman decoding (difference data 2 after Minmi transformation), first bit 2) Dim Minmi_Data_Before_Conversion2 As String If Not IsMissing(Conversion possibility determination_True if successful) Then Minmi conversion removes one bit = Decryption (Create zero-padding string (data 2 of the length before Minmi conversion), data 2 of the length after Minmi conversion, conversion feasibility check_True if successful) Else Minmi conversion removes one bit = Decryption (Creates a zero-padding string (data 2 of the length before Minmi conversion), data 2 of the length after Minmi conversion) End By End Function '================================================================ '================================================================ 'A helper program for compression and decryption' '================================================================ '================================================================ Use this to add one character. ' bitString: The 01 string to manipulate (will be overwritten by passing by reference) ' logString: History of the reversed content (appended to the end by reference) Private Sub Encryption(ByRef bitString As String, Optional ByRef logString As String = "") Dim n As Long Dim targetChar As String Dim flippedChar As String Dim result As String 1. Count the number of "1"s, n. n = Len(bitString) - Len(Replace(bitString, "1", "")) If n is outside the range, do nothing. While n <> 0 2. Identify the nth character and reverse it. targetChar = Mid(bitString, n, 1) If targetChar = "0" Then Reconstruct the string and overwrite the original variable. bitString = Left(bitString, n - 1) & "1" & Mid(bitString, n + 1) Since it reversed from 0 to 1, "0" was added to the history. logString = logString & "0" n = n + 1 Else Reconstruct the string and overwrite the original variable. bitString = Left(bitString, n - 1) & "0" & Mid(bitString, n + 1) Since it reversed from 1 to 0, "1" was added to the history. logString = logString & "1" n = n - 1 'Add 1 to the Hamming weight because the number of '1's increases. End By Wend End Sub 'Used to remove one character' ' bitString: Current string 01 ' logString: Accumulated history string (all will be used up and then restored) 'Conversion feasibility check: Enter true if conversion is successful, enter false if conversion fails.' Return value: Initial string after going back through all operations Private Function Decryption(ByRef bitString As String, ByRef logString As String, Optional ByRef Convertibility As Boolean) As String Dim n As Long Dim i As Long Dim originalChar As String Dim buffData1 As String Dim buffData2 As String Dim myDatabuff As String 1. Count the number of "1"s in the current state to pinpoint their locations. n = Len(bitString) - Len(Replace(bitString, "1", "")) Loop from the end (latest) of the history to the beginning (oldest). For example, if logString is "10", first return "0", then return "1". For i = Len(logString) To 1 Step -1 2. Extract the i-th character from the history (the character to be restored). originalChar = Mid(logString, i, 1) 3. Rewrite that position with the original character. If originalChar = "0" Then On Error GoTo zero myDatabuff = Left(bitString, n - 2) & originalChar & Mid(bitString, n + 0) n = n - 1 Else On Error GoTo ichi myDatabuff = Left(bitString, n - 0) & originalChar & Mid(bitString, n + 2) n = n + 1 End By bitString = myDatabuff Next i If Not IsMissing (conversion possible / disabled determination) Then Conversion feasibility check = 1 'If 1, conversion is successful End By Decryption = bitString Exit Function If zero: If decryption is not possible If Not IsMissing (conversion possible / disabled determination) Then Conversion feasibility check = 0 End By Decryption = bitString In the case of ichi: If decryption is not possible If Not IsMissing (conversion possible / disabled determination) Then Conversion feasibility check = 0 End By Decryption = bitString End Function Returns True if all values are "0", otherwise returns False (if any "1" values are present). 'Determine whether the convergence condition has been reached' Private Function is true if all values are zero (ByVal bitString As String) As Boolean If the string is empty, it cannot be determined, so it will be set to False. If Len(bitString) = 0 Then If all values in is are zero, then true = False Exit Function End By Replace all instances of "0" with an empty string. If the result is an empty string, it means that originally there was only "0". If Len(Replace(bitString, "0", "")) = 0 Then If all is zero then true = True Else If all values in is are zero, then true = False End By End Function 'A bug that allows reverse conversion can be fixed by branching with an if statement' Private Function is true if the rightmost value is 1 and all others are zero (data As String) As Boolean ' "*" means "anything is fine", To achieve both "no non-zero values mixed in" and "only one 1" It's more reliable to check if the whole value is 1. If IsNumeric(data) Then It converts to a number and checks if it's 1, and also checks if the last character is "1". If the rightmost value of is is 1 and all other values are zero, then it's true = (val(data) = 1 And Right(data, 1) = "1") Else If the rightmost value of `is` is 1 and all other values are zero, then `true` = `False` End By End Function A function that inverts only the last bit from 0 to 1. Used in circular conversion Private Function Last01Reverse(bitString As String) As String If Len(bitString) = 0 Then Exit Function Dim result As String result = bitString I'll look at the last letter and rewrite it directly. If Right(result, 1) = "1" Then Mid(result, Len(result), 1) = "0" Else Mid(result, Len(result), 1) = "1" End By Last 01 inverted = result End Function '================================================================ '================================================================ Regarding compression after Minmi conversion '================================================================ '================================================================ What we know The number of 0s and 1s increases. It doesn't seem to decrease. The rule is that the larger the number, the longer the bit length, like this: 1=0, 2=10, 3=110, 4=1110... This allows the most frequent number, "1," to be represented with just one bit. Return value: Comma-separated string of differences Argument 1: Original bit string Argument 2: (Pass by reference) A variable to store the first bit. Private Function Convert Difference to 01 Data(ByVal inputData As String, ByRef outFirstBit As String) As String If Len(inputData) = 0 Then out FirstBit = "" Convert to difference 01 data = "" Exit Function End By Dim currentBit As String Dim count As Long Dim prevLength As Long Dim currentLength As Long Dim i As Long Dim deltaResult As String Dim isFirstBlock As Boolean Set the first bit to a variable passed by reference. outFirstBit = Left(inputData, 1) currentBit = outFirstBit DeltaResult = "" count = 0 prevLength = 0 isFirstBlock = True 'We will examine the bit string character by character. For i = 1 To Len(inputData) If Mid(inputData, i, 1) = currentBit Then count = count + 1 Else Calculate the difference if the block is interrupted. currentLength = count If isFirstBlock Then deltaResult = CStr(currentLength) isFirstBlock = False Else deltaResult = deltaResult & "," & CStr(currentLength - prevLength) End By 'Preparing for the next block' prevLength = currentLength currentBit = Mid(inputData, i, 1) count = 1 End By Next i 'Add the difference to the last block' If isFirstBlock Then DeltaResult = CStr(count) Else deltaResult = deltaResult & "," & CStr(count - prevLength) End By The function will return the final difference string. Convert to difference 01 data = deltaResult End Function 'This will reconstruct the original long string "01" from a comma-separated list of differences.' To prevent overflow during numerical calculations, we'll use the Variant type (Decimal) for the calculations. Private Function Restore from Difference 01 Data(ByVal deltaString As String, ByVal firstBit As String) As String Dim v() As String Dim i As Long We'll use Variant to handle Decimal types (up to 28 digits for integers!). Dim currentLength As Variant Dim prevLength As Variant Dim currentBit As String Dim result As String If DeltaString = "" Then Recover from the difference 01 data = "" Exit Function End By v = Split(deltaString, ",") powerBit = firstBit prevLength = CDec(0) ' Initially 0 result = "" For i = LBound(v) To UBound(v) We'll use CDec to perform calculations on a string as a decimal. If i = 0 Then currentLength = CDec(v(i)) Else currentLength = prevLength + CDec(v(i)) End By 'Concatenate them all at once using the String function result = result & String(currentLength, currentBit) 'Invert the bits for the next block If currentBit = "0" Then currentBit = "1" Else currentBit = "0" 'Remember this length for the next calculation' prevLength = currentLength Next i Reconstructing from the difference 01 data = result End Function This converts a comma-separated numeric string into a Huffman-code-like string of 0s and 1s. Rule: 1 -> "1", 2 -> "10", 3 -> "110", n -> (n-1) "0"s + "1" Private Function Huffman Transform(ByVal deltaString As String) As String Dim v() As String Dim i As Long Dim num As Long Dim result As String Dim j As Long Split by commas and create an array. v = Split(deltaString, ",") result = "" For i = LBound(v) To UBound(v) Remove leading and trailing spaces and convert to a number. num = CLng(Trim(v(i))) Huffman transformation rules ' If it's 1, then "1" ' 2 is "01" ' 3 is "001" The rule is to add a "1" after each of the (num-1) "0s". 1->1, 2->10, 3->110 If num >= 1 Then For j = 1 To num - 1 result = result & "0" Next j result = result & "1" End By Next i Huffman transform = result End Function Convert a Huffman-code-like string of 0s back to a comma-separated numeric string. Rule: "1" -> 1, "01" -> 2, "001" -> 3 ... (Number of zeros until "1" appears + 1) Private Function Huffman Decoder(ByVal huffmanBits As String) As String Dim i As Long Dim zeroCount As Long Dim result As String Dim char As String result = "" zeroCount = 0 Look at each character one by one, and count the "0"s until you get a "1". For i = 1 To Len(huffmanBits) char = Mid(huffmanBits, i, 1) If char = "0" Then zeroCount = zeroCount + 1 ElseIf char = "1" Then If you get "1", one number is confirmed! If result <> "" Then result = result & "," result = result & CStr(zeroCount + 1) Reset the count and move on to the next number. zeroCount = 0 End By Next i Huffman decoding = result End Function '================================================================ '================================================================ After compression, combine the three data into two. '================================================================ '================================================================ '01 When you pass data, zeros are added to the right until it reaches the specified length. Argument 1: The original bit string (e.g., "1101") Argument 2: Target length (e.g., 10) Return value: 0-padded string (e.g., "1101000000") Private Function Filled with 0 on the right side (ByVal inputBits As String, ByVal targetLength As Variant) As String Dim currentLen As Variant Dim diff As Variant currentLen = CDec(Len(inputBits)) targetLength = CDec(targetLength) If currentLen < targetLength Then diff = targetLength - currentLen 'Concatenate the missing parts using the String function Right-hand zero padding = inputBits & String(diff, "0") Else Right padding with 0 = inputBits End If End Function 'Use this function when padding the right side with 0. 'When padding with 1, remove the 1. Private Function RemoveRightZero(ByVal inputBits As String) As String Dim temp As String temp = inputBits 'As long as the rightmost character is "0" and the length of the string is greater than 0, keep removing one character from the right. Do While Right(temp, 1) = "0" And Len(temp) > 0 temp = Left(temp, Len(temp) - 1) Loop RemoveRightZero = temp End Function 'Remove the rightmost 1 bit from the 01 data and return the removed bit by reference. 'Return value: The remaining String data after removing the rightmost 1 bit. 'Argument 1: The original 01 data (String). 'Argument 2: (Optional / ByRef) A String variable to store the removed 1 bit. Optional. Private Function ReduceRightOneBit(ByVal inputBits As String, Optional ByRef outLastBit As String = "") As String Dim dataLength As Long dataLength = Len(inputBits) 'Check if the data is empty. If dataLength > 0 Then 'Get the rightmost 1 character. *If the argument is omitted, this assignment is performed on an internal temporary variable and is therefore harmless. outLastBit = Right(inputBits, 1) The return value will be the remaining part after removing the rightmost part. If dataLength > 1 Then Right-hand bit reduction = Left(inputBits, dataLength - 1) Else If there was originally only one character, it returns an empty string. Right-hand 1 bit reduction = "" End By Else If the data was empty from the start outLastBit = "" Right-hand 1 bit reduction = "" End By End Function This will return a String of the specified length, consisting entirely of zeros. Arguments: Desired length (e.g., 10) Return value: A string of all "0"s (e.g., "0000000000") Private Function CreateZeroPaddedString(ByVal targetLength As Variant) As String If targetLength <= 0 Then Create zero-padding string = "" Exit Function End By Create a zero-padding string = String(CLng(targetLength), "0") End Function '================================================================ '================================================================ 'An experimental function that's not related to the algorithm.' '================================================================ '================================================================ Private Function Generate random 01 data of a specified length (ByVal length As Long) As String Dim i As Long Dim result As String Randomize result = Space(length) ' The trick is to secure the size of the exit first! For i = 1 To length If Rnd < 0.5 Then Mid(result, i, 1) = "0" Else Mid(result, i, 1) = "1" End By Next i Generate random 01 data of a specified length = result End Function By inverting the data every specified number of times, the data can be efficiently crumpled up with just one Minmi conversion. Furthermore, due to the use of Hamming weights, in the Minmi conversion, data consisting only of zeros only changes in length. By reversing every minmin conversion, even data consisting only of 0s can be made jagged by minmin conversion. Private Function ReverseEverySpecifiedCount(dataString As String, groupSize As Long) As String Dim i As Long Dim result As String Dim currentChar As String Dim isInverting As Boolean ' If the specified count is 0 or less, return as is to avoid errors. If groupSize <= 0 Then ReverseEverySpecifiedCount = dataString Exit Function End If result = "" ' Initially, it is in a non-reversing (as-is) state. isInverting = False For i = 1 To Len(dataString) ' Switch the switch every groupSize. ' At the timing when (i - 1) is divisible by groupSize, switch between inversion and non-inversion. If (i - 1) Mod groupSize = 0 And i > 1 Then isInverting = Not isInverting End If currentChar = Mid(dataString, i, 1) If isInverting Then ' Inversion mode If currentChar = "0" Then result = result & "1" ElseIf currentChar = "1" Then result = result & "0" Else result = result & currentChar End By Else result = result & currentChar End By Next i Invert every specified number of items = result End Function Main analysis function Usage: Result = AnalyzeBinaryData("01010101...") Private Function Calculate Information Entropy(ByVal binaryStr As String) As Double Dim L As Long L = Len(binaryStr) If L = 0 Then Calculate information entropy = "Data is empty" Exit Function End By ' 1. Basic statistics Dim c0 As Long, c1 As Long, i As Long For i = 1 To L If Mid(binaryStr, i, 1) = "0" Then c0 = c0 + 1 Else c1 = c1 + 1 Next i Dim p0 As Double, p1 As Double p0 = c0 / L p1 = c1 / L 2. 1-bit entropy (H1) Dim h1 As Double h1 = CalculateEntropy(p0, p1) Calculate information entropy = CDbl(Format(h1, "0.000000000000000")) End Function 'Entropy calculation auxiliary function Private Function CalculateEntropy(ParamArray probs() As Variant) As Double Dim h As Double, p As Variant h = 0 For each p in probs If p > 0 Then h = h - (p * (Log(p) / Log(2))) End By Next p CalculateEntropy = h End Function [Explanation of Symbols]
[0025] 1 None
Claims
1. A data transformation method that calculates a Hamming weight, which is the number of predetermined symbols included in a symbol sequence, and inverts the symbol at the position corresponding to the Hamming weight index in the input symbol sequence until a predetermined convergence state is reached where all symbols in the input symbol sequence have the same value.
2. A data transformation method for transforming an input symbol sequence consisting of N symbols (where N is a natural number), A calculation step of calculating the Hamming weight, which is the number of predetermined symbols included in the input symbol sequence, A reversal step of reversing the symbol at the position corresponding to the Hamming weight index in the input symbol sequence, An inversion control step which repeats the calculation step and the inversion step until a predetermined convergence state is reached where all symbols in the input symbol sequence have the same value, The encoding process involves encoding the symbol history information at the time of inversion according to a delta transform and a Huffman transform based on the continuity or interval of occurrence of symbols, and generating encoded data. A padding step is performed on the encoded data, in which bits are filled based on the length N of the input symbol sequence. including The data conversion method described in claim 1.
3. A program for causing a computer to execute the data conversion method described in claim 1 or claim 2.
Citation Information
Patent Citations
Hardware acceleration of data reduction operations
US20240128982A1
Encoding and decoding apparatus and method with hamming weight enhancement
US7149955B1
Error correction device, encoder, decoder, method, and information storage device
JP4662278B2
Encryption and decryption techniques using shuffle function
US9635011B1