Method and device for counting bus station transfer data based on homomorphic encryption

Through homomorphic encryption technology, the bus card swiping data is encrypted and processed and calculated, which solves the technical challenge of counting the number of bus stops transfers while ensuring data security and privacy, and achieves accurate and secure data statistics.

CN119740723APending Publication Date: 2025-04-01CHANGSHA UNIVERSITY OF SCIENCE AND TECHNOLOGY +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411451792.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

When counting the transfer data at bus stops, it is necessary to process card swiping records containing passengers' personal privacy information. How to accurately count the number of transfers while ensuring data security and privacy is a technical challenge.

Method used

Homomorphic encryption technology is used to encrypt the card swipe data, and the encrypted data is calculated without decryption. The encrypted data is aggregated and sorted by the server to count the number of transfers.

Benefits of technology

It realizes accurate statistics on the number of transfers at bus stops without revealing passenger privacy, improves data processing efficiency, and enhances data security, and resists security threats such as data tampering and man-in-the-middle attacks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740723A_ABST
    Figure CN119740723A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a method and equipment for counting bus station transfer data based on homomorphic encryption, so as to accurately count the transfer times of a target bus station in a target time period on the premise of protecting the privacy of passengers. The method comprises the following steps: acquiring a card swiping data ciphertext uploaded by a vehicle-mounted POS machine of each bus which only gets on a bus and swipes a card in a target area based on the same homomorphic encryption algorithm; aggregating all card swiping data ciphertexts of the same user in the target time period; determining that the aggregated card-swiping data ciphertext is a single piece of data as the card-swiping data of a non-transfer user, removing the card-swiping data, and sequencing at least two card-swiping data ciphertexts of any remaining passenger one by one according to time; judging whether the time interval based on the ciphertext between two adjacent card swiping data after the same user is sorted is smaller than a set time threshold value or not, and if yes, adding 1 to the transfer statistical data corresponding to the stations after sorting; and all the remaining passengers are traversed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for counting bus stop transfer data based on homomorphic encryption. Background Art

[0002] With the development of urban public transportation, accurately counting the number of passengers' transfers is of great significance for optimizing bus route planning, formulating fare policies, and evaluating the operational efficiency of the bus system. However, bus card swiping records contain passengers' personal privacy information, such as ID numbers, etc. When processing this data, it is necessary to ensure the security and privacy of the data.

[0003] In order to solve this problem, this patent application introduces homomorphic encryption technology, which has the characteristic of "computable but invisible". It can calculate the encrypted data without decrypting it, and the calculation result is equal to the same calculation result of the plaintext after decryption. Summary of the invention

[0004] The purpose of the present invention is to disclose a method for counting bus stop transfer data based on homomorphic encryption, so as to accurately count the number of transfers at a target bus stop within a target time period while protecting the privacy of passengers.

[0005] To achieve the above purpose, the method for collecting bus stop transfer data based on homomorphic encryption disclosed in the present invention includes:

[0006] Step S1: The server obtains the ciphertext of the card swiping data uploaded by the onboard POS machines of each bus in the target area based on the same homomorphic encryption algorithm; wherein each bus only swipes the card when the passenger gets on the bus;

[0007] Step S2, the server aggregates all ciphertexts of card swiping data of the same user within the target period;

[0008] Step S3, the server determines the data with a single ciphertext of the aggregated card swiping data as the card swiping data of users without transfers and removes it, and sorts at least two ciphertexts of the card swiping data of any remaining passengers one by one by time; determines whether the ciphertext-based time interval between two adjacent card swiping data of the same user after sorting is less than the set time threshold, and if so, adds 1 to the transfer statistical data corresponding to the sorted station; until all remaining passengers are traversed.

[0009] Preferably, the step S1 comprises:

[0010] Step S11: When a bus passenger swipes his card to board the bus, the POS machine encrypts the generated card swipe data using a homomorphic encryption algorithm and uploads it to the server. The uploaded encrypted data is as follows:

[0011] [Cidi ,T i ,Pid i ,Sid i ];

[0012] Wherein, Cid is the user ID, T is the card swiping timestamp, Pid is the POS machine ID, Sid is the site ID; subscript i is the sequence number of the encrypted data, i = 1, 2, ..., n;

[0013] The step S2 obtains the card swiping data of the target passenger in the target time period after aggregation as follows:

[0014]

[0015] Based on the step S3, [T1, T2, ..., T n ]The specific sub-steps for sorting include:

[0016] Step S31: Assume that U is the complete set of bus operation time periods arranged from left to right in the order of timestamps, and U = {d1, d2, .. ., d m}, then T i ∈{d1,d2,...d m}, for the ciphertext data T i (i=1,2,...,n) construct a vector X i =(x i1 ,x i2 ,...,x im ), the construction method is: if T i =d j , let x ij =1, otherwise x ij =0; we can get the n×m matrix I:

[0017]

[0018] Step S32, then I=(X1, X2, ..., X n ) T Summing each column yields a new vector O:

[0019]

[0020] Step S33: Set o which is not 0 i The corresponding position d i Arrange from left to right, and then i Press d i Sort them in order, and get [T1,T2,...,T n ]Arranged in order from morning to night.

[0021] To achieve the above objective, the present invention further discloses a server, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above method.

[0022] The present invention has the following beneficial effects:

[0023] 1. Use homomorphic encryption technology to encrypt bus card swiping records to ensure that passengers' personal information (such as card swiping time, location, etc.) remains encrypted during data collection, transmission and storage, effectively preventing personal privacy leakage.

[0024] 2. Homomorphic encryption technology allows direct operations (such as addition, multiplication, etc.) on encrypted data without decryption. This means that the number of transfers can be directly counted for encrypted card swipe records without exposing the original data, greatly improving data processing efficiency. Compared with traditional statistical methods, statistical methods based on homomorphic encryption can resist a variety of security threats, such as data tampering, man-in-the-middle attacks, etc., because even if the encrypted data is intercepted, the attacker cannot directly obtain useful information.

[0025] 3. Through homomorphic encryption technology, accurate statistics of the number of transfers are achieved without leaking the privacy of passengers. This helps public transportation operators better understand passengers' travel behavior and provide strong support for optimizing public transportation services.

[0026] The present invention will be further described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0028] Figure 1 It is a flowchart of a method for collecting statistics on bus stop transfer data based on homomorphic encryption disclosed in an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The embodiments of the present invention are described in detail below with reference to the accompanying drawings, but the present invention can be implemented in many different ways as defined and covered by the claims.

[0030] Example 1

[0031] This embodiment discloses a method for collecting bus stop transfer data based on homomorphic encryption. Figure 1 As shown, the process includes at least the following steps:

[0032] Step S1, the server obtains the ciphertext of card swiping data uploaded by the on-board POS machines of each bus in the target area based on the same homomorphic encryption algorithm; wherein each bus only swipes the card when the passenger gets on the bus.

[0033] Preferably, step S1 comprises:

[0034] Step S11: When a bus passenger swipes his card to board the bus, the POS machine encrypts the generated card swipe data using a homomorphic encryption algorithm and uploads it to the server. The uploaded encrypted data is as follows:

[0035] [Cid i ,T i ,Pid i ,Sid i ];

[0036] Wherein, Cid is the user ID, T is the card swiping timestamp, Pid is the POS machine ID, Sid is the site ID; subscript i is the serial number of the encrypted data, i = 1, 2, ..., n.

[0037] Step S2: The server aggregates all ciphertexts of the card swiping data of the same user within the target period.

[0038] Preferably, in step S2, after aggregation, the card swiping data of the target passenger in the target time period is obtained as follows:

[0039]

[0040] Step S3, the server determines the data with a single ciphertext of the aggregated card swiping data as the card swiping data of users without transfers and removes it, and sorts at least two ciphertexts of the card swiping data of any remaining passengers one by one by time; determines whether the ciphertext-based time interval between two adjacent card swiping data of the same user after sorting is less than the set time threshold, and if so, adds 1 to the transfer statistical data corresponding to the sorted station; until all remaining passengers are traversed.

[0041] Preferably, based on step S3, [T1, T2, ..., T n ]The specific sub-steps for sorting include:

[0042] Step S31: Assume that U is the complete set of bus operation time periods arranged from left to right in the order of timestamps, and U = {d1, d2, .. ., d m}, then T i ∈{d1,d2,...d m}, for the ciphertext data T i (i=1,2,...,n) construct a vector X i =(x i1 ,x i2,...,x im ), the construction method is: if T i =d j , let x ij =1, otherwise x ij =0; we can get the n×m matrix I:

[0043]

[0044] Step S32, then I=(X1, X2, ..., X n ) T Summing each column yields a new vector O:

[0045]

[0046] Step S33: Set o which is not 0 i The corresponding position d i Arrange from left to right, and then i Press d i Sort them in order, and get [T1,T2,...,T n ]Arranged in order from morning to night.

[0047] Preferably, the time threshold is less than the maximum one-way duration of each bus in the target area.

[0048] Optionally, in this embodiment, the timestamps of the bus operation time periods are arranged in steps of seconds. An example of the above ciphertext-based sorting process is as follows:

[0049] Assume that a user takes four buses on September 6, 2024, at the following times: 08:16:31, 08:35:09, 17:35:20, 17:58:50. The card swiping data of the user is as follows:

[0050]

[0051] Assuming that the bus operates from 6 am to 10 pm every day, then U = {1725573600, 1725573601, .. . , 1725631200}. According to the construction method in step 3, the matrix I can be obtained:

[0052]

[0053] Then for I=(X1,X2,...,X n ) T Summing each column yields a new vector O:

[0054] O=(o1,o2,...,o m)=(0...1...1...1...1...0).

[0055] From left to right, the first non-zero number in U = {1725573600, 1725573601, .. ., 1725631200} corresponds to the element 1725581791; the second non-zero number in U corresponds to the element 1725582909, and so on, to obtain the sorted time series [1725581791, 1725582909, 1725615320, 1725616730], and the corresponding ride data are arranged in time as follows:

[0056]

[0057] Then, the transfer calculation is performed. Two adjacent time records are taken from the front to the back, and the time interval between the two card swipes is subtracted. If the time interval is less than a certain set time, such as 7200 seconds, it is regarded as a transfer, and the number of transfer records for the transfer station ID is increased by one.

[0058] T2-T1=1725582909-1725581791=1118<7200.

[0059] T3-T2=1725615320-1725582909=32411

[0060] T4-T3=1725616730-1725615320=1410<7200

[0061] It can be seen that there is one transfer between T2 and T1, and the transfer station number is 5, so the number of transfers at this station is increased by 1. In addition, there is one transfer between T4 and T3, and the transfer station number is 7, so the number of transfers at this station is increased by 1. The number of transfers for this user on September 6, 2024 is calculated, and then the card swiping records of other users are calculated. Finally, the transfer record data is summarized to obtain the transfer data of each target station in the target period.

[0062] Example 2

[0063] This embodiment discloses a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above method.

[0064] In summary, the method and device (i.e., server) for collecting bus stop transfer data based on homomorphic encryption disclosed in the embodiments of the present invention respectively have at least the following beneficial effects:

[0065] 1. Use homomorphic encryption technology to encrypt bus card swiping records to ensure that passengers' personal information (such as card swiping time, location, etc.) remains encrypted during data collection, transmission and storage, effectively preventing personal privacy leakage.

[0066] 2. Homomorphic encryption technology allows direct operations (such as addition, multiplication, etc.) on encrypted data without decryption. This means that the number of transfers can be directly counted for encrypted card swipe records without exposing the original data, greatly improving data processing efficiency. Compared with traditional statistical methods, statistical methods based on homomorphic encryption can resist a variety of security threats, such as data tampering, man-in-the-middle attacks, etc., because even if the encrypted data is intercepted, the attacker cannot directly obtain useful information.

[0067] 3. Through homomorphic encryption technology, accurate statistics of the number of transfers are achieved without leaking the privacy of passengers. This helps public transportation operators better understand passengers' travel behavior and provide strong support for optimizing public transportation services.

[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations (the present invention is not only applicable to the existing bus card swiping system, but can also be extended to other public transportation fields to provide a unified transfer number statistics solution for the entire public transportation system). Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for collecting bus stop transfer data based on homomorphic encryption, characterized in that: include: Step S1: The server obtains the ciphertext of the card swiping data uploaded by the onboard POS machines of each bus in the target area based on the same homomorphic encryption algorithm; wherein each bus only swipes the card when the passenger gets on the bus; Step S2, the server aggregates all ciphertexts of card swiping data of the same user within the target period; Step S3, the server determines the data with a single ciphertext of the aggregated card swiping data as the card swiping data of users without transfers and removes it, and sorts at least two ciphertexts of the card swiping data of any remaining passengers one by one by time; determines whether the ciphertext-based time interval between two adjacent card swiping data of the same user after sorting is less than the set time threshold, and if so, adds 1 to the transfer statistical data corresponding to the sorted station; until all remaining passengers are traversed.

2. The method according to claim 1, characterized in that: The step S1 comprises: Step S11: When a bus passenger swipes his card to board the bus, the POS machine encrypts the generated card swipe data using a homomorphic encryption algorithm and uploads it to the server. The uploaded encrypted data is as follows: [Cid i ,T i ,Pid i ,Sid i ]; Where Cid is the user ID, T is the card swiping timestamp, Pid is the POS machine ID, Sid is the site ID; the subscript i is the sequence number of the encrypted data, i = 1, 2, ..., n; The step S2 obtains the card swiping data of the target passenger in the target time period after aggregation as follows: Based on the step S3, [T1, T2, ..., T n ]The specific sub-steps for sorting include: Step S31: Assume that U is the complete set of bus operation time periods arranged from left to right in the order of timestamps, and U = {d1, d2, .. ., d m }, then T i ∈{d1,d2,...d m }, for the ciphertext data T i (i=1,2,...,n) construct a vector X i =(x i1 ,x i2 ,...,x im ), the construction method is: if T i =d j , let x ij =1, otherwise x ij =0; we can get the n×m matrix I: Step S32, then I=(X1, X2, ..., X n ) T Summing each column yields a new vector O: Step S33: Set o which is not 0 i The corresponding position d i Arrange from left to right, and then i Press d i Sort them in order, and get [T1,T2,...,T n ]Arranged in order from morning to night.

3. The method according to claim 2, characterized in that The bus operation time period timestamps are arranged in steps of seconds.

4. The method according to claim 3, characterized in that The time threshold is less than the maximum one-way duration of each bus in the target area.

5. A server comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor executes the computer program to implement the method according to any one of claims 1 to 4.