A 4-byte floating-point latitude and longitude offset method based on feistel network

CN122548770APending Publication Date: 2026-08-11SINOPEC OILFIELD SERVICE CORPORATION +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510143295.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

传统的对称加密算法如AES、DES等虽然安全性高,但加密后的数据完全失去原有的数值特征,无法支持数值计算和比较操作,给数据分析和检索带来不便

Benefits of technology

[0037]本发明的有益效果是:本发明适用于以4字节浮点数表示的经纬度值的模糊化加偏处理,该方法首先将浮点数转换为IEEE 754格式的二进制表示形式,根据阶码确定尾数部分的修改位,将修改位取反。根据阶码确定初始密钥,使用SHA256算法生成16轮密钥,再将修改位之后的一个字节的内容,进行16轮Feistel加密,最后转换为IEEE754浮点数,从而实现数据的加偏处理。Feistel网络通过非线性S盒子和多个密钥的多轮操作,确保加偏过程的安全性和复杂性。解偏过程为上述加偏过程的逆操作,能够精确恢复原始经纬度值。本发明采用16轮Feistel网络,可以高效完成相关操作,采用SHA-256哈希函数产生密钥流以增强安全特性,通过逆变换可以精确恢复原始数据,因此具有高效、安全和可逆的特点,适用于需要保护经纬度数据隐私和误差容忍的空间查询服务的应用场景。实验结果表明,本发明方法可实现有效的数据加偏,对GeoNames数据集中的城市坐标加偏后,平均偏移距离约为196.05米,本发明可广泛应用于对位置隐私敏感的移动应用、位置大数据分析等领域,在保护用户隐私的同时,又能支撑数据分析,具有重要的实用价值。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122548770A_ABST
    Figure CN122548770A_ABST
Patent Text Reader

Abstract

This invention discloses a method for biasing 4-byte floating-point latitude and longitude coordinates based on a Feistel network. The method first converts the floating-point number into a binary representation in IEEE 754 format. The modification bit of the mantissa is determined based on the exponent, and this modification bit is inverted. An initial key is determined based on the exponent, and a 16-round key is generated using the SHA256 algorithm. The content of the byte following the modification bit is then encrypted using Feistel for 16 rounds. Finally, the data is converted back to an IEEE 754 floating-point number, thus achieving biasing. This invention employs a 16-round Feistel network for efficient operation, uses the SHA-256 hash function to generate a keystream for enhanced security, and can accurately recover the original data through inverse transformation. Therefore, it is efficient, secure, and reversible, making it suitable for spatial query services that require protection of latitude and longitude data privacy and error tolerance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical fields of geographic information processing, information security and privacy protection, and in particular to a method for reversibly biasing 4-byte floating-point latitude and longitude values ​​based on the Feistel network. Background Technology

[0002] In the mobile internet era, with the widespread application of systems like BeiDou, GPS, and GIS, location-based services are becoming increasingly popular, leading to the collection and analysis of vast amounts of data containing user location information. However, location data is typically quite precise, making it vulnerable to privacy breaches. To protect privacy, location data needs to be obfuscated. While traditional symmetric encryption algorithms such as AES and DES offer high security, the encrypted data completely loses its original numerical characteristics, making numerical calculations and comparisons impossible and hindering data analysis and retrieval. Therefore, an encryption algorithm is needed that provides sufficient security while preserving the numerical characteristics of the data and allowing for a certain degree of numerical calculation and comparison.

[0003] Feistel networks are block cipher structures widely used in symmetric encryption algorithms such as DES, characterized by high encryption strength and reversibility. This invention utilizes the characteristics of the IEEE 754 floating-point binary representation; modifying a few bits of the mantissa can cause a slight positional shift. Combined with the Feistel network to offset latitude and longitude coordinates, this provides privacy protection while accurately recovering the original data and also satisfying basic data statistical analysis requirements. Summary of the Invention

[0004] The purpose of this invention is to provide a 4-byte floating-point latitude and longitude offset method based on the Feistel network for offsetting geographic coordinate data, ensuring that data can be protected in terms of privacy and accurate recovery during transmission or storage.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] A method for offsetting 4-byte floating-point latitude and longitude coordinates based on the Feistel network includes the following steps:

[0007] S1. Extract the binary representation of the floating-point number, including:

[0008] S101. Convert a 32-bit floating-point number to its IEEE 754 standard binary representation binF32;

[0009] S102. Extract the sign bit (bit 31, bit 1), the exponent part (bits 23-30, bit 8) and the mantissa part (bits 0-22, bit 23) from binF32;

[0010] S103. Subtract 127 from the extracted exponent to obtain the actual exponent value.

[0011] S2. Generate an encryption key, including:

[0012] S201. Take the first 8 bits (bits 24-31) of binF32 as the key key1;

[0013] S202. If the exponent is greater than -3, then take the 16th to 23rd bits of binF32 as the key key2; otherwise, take the 0th to 7th bits of binF32 as the key key2.

[0014] S203. Perform a SHA256 hash operation on key1 and key2 to obtain a 256-bit value. Only take the last 128 bits to form a 16-byte array keys, which will be used as the round key for Feistel encryption.

[0015] S3. Encrypt the mantissa portion, including:

[0016] S301. Take (13-exponent) as the update bit and ensure that its value is between 8 and 22. Invert the update bit of the mantissa in the mantissa.

[0017] S302. Extract the 8 bits after the updateBit bit as a byte, perform 16 rounds of Feistel encryption, and use the keys generated in S203 as the round keys;

[0018] The 8-bit data is divided into a left half and a right half, with each half consisting of 4 binary bits. This is achieved using a key K. i (i = 1 to n), perform 16 rounds of cross-iteration encryption on the two half blocks:

[0019] for i = 1 to 16:

[0020] L i =R i-1

[0021] R i =L i-1 ⊕F(R i-1 ,K i )

[0022] Where F is the nonlinear transformation function (round function), and ⊕ is the XOR operation;

[0023] S303. Merge the encrypted left and right halves to obtain a new byte, and replace the data in the original position of mantissa.

[0024] S4. Merge the encryption results to obtain the offset floating-point number, including:

[0025] S401. Add 127 to exponent to convert it to exponent representation;

[0026] S402. Converts sign, exponent, and mantissa to 4-byte floating-point representations according to the IEEE 754 standard and returns the result.

[0027] Furthermore, the SHA-256 hash function is used to generate a unique key sequence based on the input value.

[0028] Furthermore, the bits to be modified are dynamically determined based on the exponent to maintain a uniform distribution of the offset distance.

[0029] Furthermore, the debiasing process is similar to the biasing process, with the key difference being the use of reversed round keys for Feistel decryption.

[0030] An aberration-adding device for performing the above-described 4-byte floating-point latitude and longitude aberration-adding method, comprising:

[0031] a. Extraction unit, used to extract the binary representation of floating-point numbers;

[0032] b. Key generation unit, used to generate encryption keys;

[0033] c. Encryption unit, used to perform Feistel encryption on the mantissa portion;

[0034] d. Merging unit, used to merge the encryption results to obtain the offset floating-point number.

[0035] An electronic device for adding offset to floating-point numbers includes: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the above-described method for adding offset to 4-byte floating-point latitude and longitude numbers.

[0036] A computer-readable storage medium storing computer instructions for causing a computer to execute the above-described 4-byte floating-point latitude and longitude offset method.

[0037] The beneficial effects of this invention are as follows: This invention is applicable to the fuzzification and biasing processing of latitude and longitude values ​​represented by 4-byte floating-point numbers. The method first converts the floating-point number into a binary representation in IEEE 754 format, determines the modification bit of the mantissa based on the exponent, and inverts the modification bit. An initial key is determined based on the exponent, and a 16-round key is generated using the SHA256 algorithm. Then, the content of the byte following the modification bit is subjected to 16 rounds of Feistel encryption, and finally converted back to an IEEE 754 floating-point number, thus achieving the biasing processing of the data. The Feistel network ensures the security and complexity of the biasing process through nonlinear S-boxes and multiple rounds of key operations. The debiasing process is the inverse operation of the above biasing process, which can accurately recover the original latitude and longitude values. This invention uses a 16-round Feistel network, which can efficiently complete the relevant operations. It uses the SHA-256 hash function to generate a keystream to enhance security features, and the inverse transformation can accurately recover the original data. Therefore, it has the characteristics of high efficiency, security, and reversibility, and is suitable for application scenarios that require protection of latitude and longitude data privacy and error tolerance in spatial query services. Experimental results show that the method of the present invention can effectively bias the data. After biasing the city coordinates in the GeoNames dataset, the average offset distance is about 196.05 meters. The present invention can be widely used in mobile applications and location big data analysis that are sensitive to location privacy. It can protect user privacy while supporting data analysis and has important practical value.

[0038] In summary, the advantages of this method are:

[0039] Efficiency: This method mainly performs 16 rounds of Feistel encryption on the last 8 bits of data, which is more efficient than overall encryption.

[0040] Security: By using Feistel networks and nonlinear S-boxes, the security of latitude and longitude data can be effectively increased, preventing unauthorized data breaches.

[0041] Reversibility: This invention can accurately recover the original precise location data through the decryption process of the Feistel network, meeting the needs of data analysis. Attached Figure Description

[0042] Figure 1 This is the main flowchart of the bias addition method: First, extract the sign bit, exponent length, and mantissa from the IEEE 754 representation of the floating-point number. Subtract 127 from the exponent to obtain the exponent. Depending on the exponent, use different data to perform SHA256 hashing to generate the round key. Set the modification bit and the next byte to be encrypted according to the exponent. Invert the modification bit. The encrypted byte uses the 16-round Feistel algorithm. Finally, merge to generate a new floating-point number in IEEE 754 representation.

[0043] Figure 2 This is a schematic diagram of the biasing method.

[0044] Figure 3 This is the Feistel encryption process; the original data is one byte, with the left 4 bits designated LE0 and the right 4 bits designated RE0. After 16 rounds of encryption, a new byte is obtained. LE i and RE i (where i = 1 to 16) represents the left 4 bits and right 4 bits generated in each round, K i (i = 1 to 16) is the encryption key for each round. F is a nonlinear S-box transformation, and in this example, we only need to implement a one-to-one mapping from [0, 15] to [0, 15].

[0045] Figure 4 This is a distribution map of the locations of all cities with a population greater than 500 in the GeoNames geodatabase; there are a total of 209,967 cities. Gray dots represent cities with a deviation distance greater than 50 meters, and blue dots represent 1,535 cities with a deviation distance less than 50 meters.

[0046] Figure 5 This is a histogram of the offset distances of all cities with a population greater than 500 in the GeoNames geodatabase, after adding offsets to their coordinates; the offset distances are mainly between 60 meters and 400 meters. Detailed Implementation

[0047] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0048] Example 1:

[0049] Taking the floating-point number 42.57688 as an example, the detailed steps and results of the biasing process are explained.

[0050] S1. Extract the binary representation of the floating-point number.

[0051] S101. Convert the 32-bit floating-point number 42.57688 to its IEEE 754 standard binary representation binF32. 0100 0010 0010 1010 0100 1110 1011 1010

[0053] The hexadecimal representation is 0x422a4eba.

[0054] S102. Extract the sign bit, exponent, and mantissa from binF32. The sign bit is 0, indicating a positive number; the binary representation of exponent is 10000100, and the decimal representation is 132; the binary representation of mantissa is 01010100100111010111010, and the hexadecimal representation is 0x2a4eba.

[0055] S103. Subtract 127 from the extracted exponent to obtain the actual exponent value of 5.

[0056] S2. Generate encryption key.

[0057] S201. Take the first 8 bits (bits 24-31) of binF32 as the key key1, which is represented as 0x42 in hexadecimal.

[0058] S202. The exponent is 5, which is greater than -3. The 16th to 23rd bits of binF32 are taken as the key2, which is represented as 0x2a in hexadecimal.

[0059] S203. Perform a SHA256 hash operation on key1 and key2 to obtain a 256-bit value. Only take the last 128 bits to form a 16-byte array keys, which is: 0x42, 0xd6, 0x36, 0xc5, 0xf8, 0xb9, 0x45, 0x77, 0x20, 0x1a, 0x4e, 0x1c, 0xad, 0x63, 0xd3, 0x17.

[0060] S3. Encrypt the mantissa portion.

[0061] S301. Take (13-exponent) as the update bit, and ensure that its value is between 8 and 22, with updateBit being 8.

[0062] S302. Invert the updateBit of the mantissa portion, changing mantissa from 0x002a4eba to 0x002a4fba.

[0063] The 8-bit binary representation of 10111010 after the updateBit bit is extracted as a byte, which is 0xba in hexadecimal. This is then used for 16 rounds of Feistel encryption, using the keys from step S203. The non-linear S-boxes are: 0x6, 0x5, 0xA, 0x9, 0xC, 0x3, 0xB, 0x8, 0x7, 0x2, 0xF, 0x1, 0xE, 0x4, 0x0, 0xD. The encryption result is 0x0f.

[0064] S303. After encryption, a new byte 0x0f is obtained, which replaces the data at the original position of mantissa. The mantissa is 0x002a4f0f.

[0065] S4. Merge the encrypted results to obtain the offset floating-point number.

[0066] S401. Add 127 to exponent to get 132, which is the binary representation of the exponent: 0b1000 0100.

[0067] S402. Combine sign, exponent and mantissa into a 4-byte integer: 0x422a4f0f, which is converted to a floating-point number of 42.5772057 according to the IEEE 754 standard.

[0068] In summary, the floating-point number 42.57688, after being processed by the offset algorithm, becomes the offset floating-point number 42.5772057, with an offset value of 0.0003257. If both of these floating-point numbers are longitudes and latitudes located on the equator, the offset distance is approximately 36 meters.

[0069] Example 2:

[0070] Taking the floating-point number -0.03261 as an example, the detailed steps and results of the biasing process are explained.

[0071] S1. Extract the binary representation of the floating-point number.

[0072] S101. Convert the 32-bit floating-point number -0.03261 to its IEEE 754 standard binary representation binF32; 10111101 0000 0101 10010010 00010000

[0074] The hexadecimal representation is 0xbd059210.

[0075] S102. Extract the sign bit, exponent, and mantissa from binF32. The sign bit is 1, indicating a negative number; the binary representation of exponent is 01111010, and the decimal representation is 122; the binary representation of mantissa is 000 0101 10010010 00010000, and the hexadecimal representation is 0x059210.

[0076] S103. Subtract 127 from the extracted exponent to obtain the actual exponent value -5.

[0077] S2. Generate encryption key.

[0078] S201. Take the first 8 bits (bits 24-31) of binF32 as the key key1, which is represented as 0xbd in hexadecimal.

[0079] S202. The exponent is -5, which is less than -3. The last 8 bits of binF32 are taken as the key2, which is represented as 0x10 in hexadecimal.

[0080] S203. Perform a SHA256 hash operation on key1 and key2 to obtain a 256-bit value. Only take the last 128 bits to form a 16-byte array keys, which is: 0x17, 0x7c, 0x2b, 0x18, 0x59, 0x3a, 0x13, 0xba, 0xb3, 0xa7, 0x5e, 0x64, 0x5c, 0x4f, 0xa5, 0xec.

[0081] S3. Encrypt the mantissa portion.

[0082] S301. Take (13-exponent) as the update bit and ensure that its value is between 8 and 22, with updateBit being 18.

[0083] S302. Invert the updateBit bit of the mantissa portion, changing mantissa from 0x059210 to 0x019210.

[0084] The 8-bit binary representation (01100100) following the updateBit is extracted as a byte, which is 0x64 in hexadecimal. This byte is then used for 16 rounds of Feistel encryption, using the keys from step S203. The non-linear S-boxes are: 0x6, 0x5, 0xA, 0x9, 0xC, 0x3, 0xB, 0x8, 0x7, 0x2, 0xF, 0x1, 0xE, 0x4, 0x0, 0xD. The encryption result is 0xa1.

[0085] S303. After encryption, a new byte 0xa1 is obtained, which replaces the data in the original position of mantissa. The mantissa is 0x028610.

[0086] S4. Merge the encrypted results to obtain the offset floating-point number.

[0087] S401. Add 127 to exponent to get 122, which is the binary representation of the exponent: 0b01111010.

[0088] S402. Combine sign, exponent and mantissa into a 4-byte integer: 0xbd028610, which is converted to a floating-point number according to the IEEE 754 standard as -0.0318661332.

[0089] In summary, the floating-point number -0.03261, after being processed by the biasing algorithm, yields the biased floating-point number -0.0318661332, with a deviation of 0.0007438668. If both of these floating-point numbers are longitudes and latitudes located on the equator, the offset distance is approximately 82 meters.

[0090] Application examples:

[0091] First, the GeoNames geodatabase, containing all city locations with a population greater than 500, was used as the test dataset. This dataset contains 209,967 city locations. After applying the method described in this patent to offset both longitude and latitude, the distance between the two points was calculated. The average offset distance was 184.52 meters, the minimum offset distance was 3.47 meters, and the maximum offset distance was 833.51 meters. The number of cities with an offset distance less than 50 meters was 1,535, accounting for 0.73% of the total number of cities. Figure 4 The blue dots on the map show the distribution of these cities. Figure 5 The histogram shows that the deviation distance is mainly between 60 meters and 400 meters.

[0092] Secondly, the coordinates of 212,267 measured shot points in the DONG2 3D work area were subjected to latitude and longitude offset processing. The average offset distance was 196.48 meters, the minimum offset distance was 10.81 meters, and the maximum offset distance was 371.68 meters. There were 586 shot points with an offset distance of less than 50 meters, accounting for 0.28% of the total number of shot points.

[0093] Application examples show that the coordinate data can be offset by an average of about 190 meters, which satisfies the need to protect privacy, while also allowing for rough spatial location analysis.

[0094] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the scope of protection of the present invention in any way, and all technical solutions obtained by equivalent substitution or other means fall within the scope of protection of the present invention. Parts not covered in this invention are the same as or can be implemented using existing technology.

Claims

1. A 4-byte floating-point number longitude and latitude offset method based on Feistel network, characterized in that, Includes the following steps: S1. Extract the binary representation of the floating-point number; S2. Generate an encryption key, including: S201. Take the first 8 bits of binF32 as the key key1; S202. If the exponent is greater than -3, then the 16th to 23rd bits of binF32 are taken as the key key2; otherwise, the 0th to 7th bits of binF32 are taken as the key key2. S203. Perform a SHA256 hash operation on keys key1 and key2 to obtain a 256-bit value. Only take the last 128 bits to form a 16-byte array keys, which will be used as the round key for Feistel encryption. S3. Encrypt the mantissa portion, including: S301. Take (13-exponent) as the update bit and ensure that its value is between 8 and 22. Invert the update bit of the mantissa in the mantissa. S302. Extract the 8 bits after the updateBit bit as a byte and perform Feistel encryption; S303. After encryption, a new byte is obtained, replacing the data in the original position of mantissa; S4. Merge the encrypted results to obtain the offset floating-point number.

2. The 4-byte floating-point number meridian / latitude offset method based on Feistel network according to claim 1, characterized in that, Step S1 includes: S101. Convert the 32-bit floating-point number to the IEEE 754 standard binary representation binF32; S102, Extract the sign bit, exponent, and mantissa from binF32; S103. Subtract 127 from the extracted exponent to obtain the actual exponent value.

3. The 4-byte floating-point number meridian / latitude offset method based on Feistel network according to claim 1, characterized in that, Step S4 includes: S401. Add 127 to exponent to convert it into exponent representation; S402. Convert sign, exponent, and mantissa to 4-byte floating-point representations according to the IEEE 754 standard and return the result.

4. The 4-byte floating-point number meridian / latitude offset method based on Feistel network according to claim 1, characterized in that, Use the SHA-256 hash function to generate a unique key sequence based on the input value.

5. The 4-byte floating-point number meridian / latitude offset method based on Feistel network according to claim 1, characterized in that, The bits to be modified are dynamically determined based on the exponent to maintain a uniform distribution characteristic by keeping the offset distance constant.

6. A biasing device for performing the method of any one of claims 1 to 5, characterized by include: a. Extraction unit, used to extract the binary representation of floating-point numbers; b. Key generation unit, used to generate encryption keys; c. Encryption unit, used to perform Feistel encryption on the mantissa portion; d. Merging unit, used to merge the encryption results to obtain the offset floating-point number.

7. An electronic device for floating-point number addition with bias, the device comprising: include: The memory and the processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the 4-byte floating-point latitude and longitude offset as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the 4-byte floating-point latitude and longitude offset method according to any one of claims 1-5.