Mobile phone number encryption and decryption method, application method and server
By performing serialization processing on mobile phone numbers through extended-bit encryption and decryption, the problems of low security and high computational resource consumption in mobile phone number storage are solved, achieving a secure and efficient encryption and decryption method.
Patent Information
- Application Number
- CN202411044252.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-29
AI Technical Summary
Existing methods for storing mobile phone numbers suffer from low security, high computational resource consumption, significant performance impact, and complex management.
The mobile phone number is encrypted using a serialization method. Random numbers are generated by setting a list of random number positions and inserted into the mobile phone number. Decryption is then performed by combining the random numbers with a decryption list.
It achieves secure protection for mobile phone numbers, simplifies the encryption and decryption process, saves computing resources, and does not affect usage efficiency.
Smart Images

Figure CN119051902A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of encryption and decryption, and in particular relates to a mobile phone number encryption and decryption method, application method and server. Background Art
[0002] The current mobile phone number database storage formats mainly include plain text storage and encrypted storage. Plain text storage is to directly store the user's mobile phone number in the database in plain text form; encrypted storage is to encrypt the user's mobile phone number through a certain encryption algorithm, and then store the encrypted data in the database.
[0003] The above method has obvious disadvantages, including: the security of plaintext storage is low. Once the database is hacked, the attacker can directly obtain the user's mobile phone number, which poses a great risk to user privacy; the risk of leakage is also high. If the database administrator or developer does not operate properly, the user's mobile phone number may be leaked; if the user's mobile phone number is leaked due to plaintext storage, the company may need to bear legal responsibility.
[0004] Encryption and decryption operations consume a lot of computing resources and have a certain impact on database performance. In addition, encrypted storage requires additional time and money to develop and maintain encryption systems, as well as to deal with performance issues caused by encryption.
[0005] In summary, there is an urgent need for a storage method for encryption and decryption of mobile phone numbers, which, together with relevant management methods, can solve the above problems. Summary of the invention
[0006] In order to address the deficiencies of the prior art, the present application provides a method for encrypting and decrypting a mobile phone number. The mobile phone number is expanded through a serialization method. When used, the expanded and encrypted mobile phone number is used, and the mobile phone number will not be obtained directly.
[0007] The technical effects to be achieved by this application are achieved through the following solutions:
[0008] According to a first aspect of the present application, a method for encrypting and decrypting a mobile phone number is provided, including a method for encrypting a mobile phone number and a method for decrypting a mobile phone number, wherein the method for encrypting a mobile phone number includes the following steps:
[0009] Step 1: Set up a random number location list for the mobile phone number;
[0010] Step 2: According to the position list, generate random numbers corresponding to the positions in the position list one by one;
[0011] Step 3: insert the corresponding random number into the position to complete the encryption of the mobile phone number;
[0012] The mobile phone number decryption method includes the following steps:
[0013] Step 4: Searching for the inserted random number according to the position list;
[0014] Step 5: After deleting the random numbers found, the returned string of numbers is the decrypted mobile phone number.
[0015] Preferably, in step 3, the positions in the position list are sorted in reverse order, and the random numbers are inserted in the sorted order.
[0016] Preferably, in step 3, after the mobile phone number encryption is completed, a decryption list is calculated based on the location list, and the decryption list is stored.
[0017] Preferably, in step 4, the inserted random number is searched according to the decryption list, specifically:
[0018] The encrypted mobile phone number is searched according to the decryption list, the inserted random numbers are found and sorted, and the numbers in the sort are verified.
[0019] Preferably, in step 5, the numbers in the sort are sorted in reverse order and then deleted according to the sorted order.
[0020] According to a second aspect of the present application, a method for storing mobile phone numbers is provided, which uses the above-mentioned method for encrypting and decrypting mobile phone numbers, including:
[0021] Encrypt the mobile phone number using a mobile phone number encryption method, and store the encrypted mobile phone number in a database;
[0022] For the original mobile phone number already in the database, the mobile phone number is encrypted using the mobile phone number encryption method and then replaced with the original mobile phone number in the database for storage.
[0023] According to the third aspect of the present application, a platform query and display method is provided, which adopts the above-mentioned mobile phone number encryption and decryption method, including:
[0024] When querying on the platform, the mobile phone number is processed using the mobile phone number encryption method to obtain the expanded number, and the query is performed using the expanded number;
[0025] If it is necessary to display on the platform, the expanded number is decrypted using the mobile phone number decryption method and displayed on the platform.
[0026] Preferably, when the platform needs to display it, the mobile phone number is decrypted using a mobile phone number decryption method, and then a fixed code position is hidden before displaying it.
[0027] According to a fourth aspect of the present application, a log printing and query method is provided, which adopts the above-mentioned mobile phone number encryption and decryption method, including:
[0028] The mobile phone number is encrypted using the mobile phone number encryption method and then printed in the log;
[0029] When querying the logs, the mobile phone number is processed using the mobile phone number encryption method to obtain the expanded number, and the log query is performed using the expanded number.
[0030] According to a fifth aspect of the present application, a server is provided, comprising: a memory and at least one processor;
[0031] The memory stores a computer program, and the at least one processor executes the computer program stored in the memory to implement the above-mentioned mobile phone number encryption and decryption method.
[0032] According to one embodiment of the present application, the beneficial effect of adopting the mobile phone number encryption and decryption method of the present application is that the encryption of the mobile phone number can be completed by simply expanding the digits of the mobile phone number, and the mobile phone number cannot be directly obtained, thereby protecting the mobile phone number; the encryption and decryption method is simpler and does not affect the efficiency of use. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the existing technical solutions, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 This is a flow chart of a method for encrypting and decrypting a mobile phone number in an embodiment of the present application;
[0035] Figure 2 This is a schematic diagram of the structure of a server in one embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0037] like Figure 1As shown, the mobile phone number encryption and decryption method in an embodiment of the present application includes a mobile phone number encryption method and a mobile phone number decryption method, wherein the mobile phone number encryption method includes the following steps:
[0038] Step 1: Set up a random number location list for the mobile phone number;
[0039] In this step, the location list is set manually, or the number of random numbers can be set according to the algorithm, and the insertion position can be set. In combination with relevant management systems, the storage location and use of the location list are guaranteed to ensure the relative security of the location list information.
[0040] Step 2: According to the position list, generate random numbers corresponding to the positions in the position list one by one;
[0041] In this step, the random numbers are randomly generated by a machine, or prohibited numbers are set manually in special positions to avoid distinguishing the added random numbers in special positions of the mobile phone number. For example, it is prohibited to set numbers other than 1 in the first position of the mobile phone number, which can easily identify that the position is an added random number.
[0042] Step 3: insert the corresponding random number into the position to complete the encryption of the mobile phone number;
[0043] During the insertion process, since the position index of the mobile phone number is performed from the front to the back, if the random number is inserted into the front position first, it may affect the subsequent position index.
[0044] Therefore, in this step, the positions in the position list are sorted in reverse order, and the random numbers are inserted in the sorted order, that is, the last random number is inserted first, ensuring that the insertion is carried out from the back to the front of the mobile phone number to avoid insertion errors caused by affecting the index.
[0045] For example, for the initial mobile phone number: 1860000XXXX, the list of positions to be inserted is: [1,3,4,6], and the mobile phone number obtained after encryption is: 16869090020XXXX.
[0046] After the mobile phone number is encrypted, the location list is deviated due to the expansion, and the original location list cannot be used for decryption. Therefore, a decryption list is calculated based on the location list and stored. By establishing a relevant management system, the relative security of the decryption list is ensured.
[0047] For example, for the encrypted mobile phone number above, the decryption list is: [2,5,7,10].
[0048] In one embodiment of the present application, the method for decrypting the above mobile phone number is: by serializing the expanded mobile phone number, the digits are reduced to obtain the mobile phone number, which specifically includes the following steps:
[0049] Step 4: Searching for the inserted random number according to the position list;
[0050] Find the inserted random number according to the decryption list generated above, specifically:
[0051] Initialize the numeric string and convert the index position to start from 0 to adapt to the string indexing rules in Python;
[0052] The encrypted mobile phone number is searched according to the decryption list, the inserted random numbers are found and sorted, and the numbers in the sort are verified to confirm that the number of digits and positions correspond to the positions in the encrypted mobile phone number.
[0053] Step 5: After deleting the random numbers found, the returned string of numbers is the decrypted mobile phone number.
[0054] In this step, the numbers in the sorting are sorted in reverse order and then deleted according to the sorted order, that is, the last random number is deleted first, ensuring that the deletion is done in order from the back to the front of the mobile phone number to avoid insertion errors caused by affecting the index.
[0055] In one embodiment of the present application, a method for storing mobile phone numbers is disclosed, which uses the above-mentioned method for encrypting and decrypting mobile phone numbers, including:
[0056] Encrypt the mobile phone number using a mobile phone number encryption method, and store the encrypted mobile phone number in a database;
[0057] For the original mobile phone number already in the database, the mobile phone number is encrypted using the mobile phone number encryption method and then replaced with the original mobile phone number in the database for storage.
[0058] In this step, the mobile phone number encryption method can be written into a batch update program, and the mobile phone numbers in the database can be updated in batches using the update program.
[0059] The location list used in the batch update process is the same to achieve the purpose of batch update and facilitate subsequent decryption.
[0060] In one embodiment of the present application, a platform query and display method is disclosed, which adopts the above-mentioned mobile phone number encryption and decryption method, including:
[0061] When querying on the platform, the mobile phone number encryption method is used to process the mobile phone number to be queried, and the expanded number is obtained, and the query is performed through the expanded number. Since the mobile phone number encryption method is used to expand the mobile phone number when it is stored, the mobile phone number to be queried needs to be processed in the same way before the corresponding stored mobile phone number can be queried. When querying, since the inserted random numbers are different from the encrypted mobile phone number in the storage, it is only necessary to query the numbers in the corresponding positions of the original mobile phone number after expansion, and the inserted random numbers are ignored;
[0062] If it is necessary to display on the platform, the expanded number is decrypted using the mobile phone number decryption method and displayed on the platform.
[0063] In this embodiment, when the platform needs to display, the mobile phone number is decrypted using the mobile phone number decryption method, and then a fixed code position can be hidden before displaying as needed.
[0064] In one embodiment of the present application, a log printing and query method is disclosed, which adopts the above-mentioned mobile phone number encryption and decryption method, including:
[0065] The mobile phone number is encrypted using the mobile phone number encryption method and then printed in the log;
[0066] When querying the logs, the mobile phone number is processed using the mobile phone number encryption method to obtain the expanded number, and the log query is performed using the expanded number.
[0067] In an embodiment of the present application, a server is disclosed, including: a memory 201 and at least one processor 202;
[0068] The memory 201 stores a computer program, and the at least one processor 202 executes the computer program stored in the memory 201 to implement the above-mentioned mobile phone number encryption and decryption method.
[0069] According to an embodiment of the present application, the beneficial effect of adopting the mobile phone number encryption and decryption method of the present application is that the encryption of the mobile phone number can be completed by simply expanding the digits of the mobile phone number, and the mobile phone number cannot be directly obtained, thereby protecting the mobile phone number. The method is simple and does not require complex calculations, so it saves more computing resources; the encryption and decryption method is simpler and does not affect the efficiency of use.
[0070] It should be noted that the above detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the art to which the present application belongs.
[0071] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should also be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.
[0072] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0073] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products, or apparatuses.
[0074] For ease of description, spatially relative terms, such as "above", "above", "on the upper surface of", "above", etc., may be used herein to describe the spatial positional relationship between a device or feature and other devices or features as shown in the figure. It should be understood that spatially relative terms are intended to include different orientations of the device in use or operation in addition to the orientation described in the figure. For example, if the device in the accompanying drawings is inverted, the device described as "above other devices or structures" or "above other devices or structures" will be positioned as "below other devices or structures" or "below other devices or structures". Thus, the exemplary term "above" may include both "above" and "below". The device may also be positioned in other different ways, such as rotated 90 degrees or in other orientations, and the spatially relative descriptions used herein are interpreted accordingly.
[0075] In the above detailed description, reference is made to the accompanying drawings, which form a part of this document. In the accompanying drawings, similar symbols typically identify similar components unless the context indicates otherwise. The illustrated embodiments described in the detailed description, drawings, and claims are not meant to be limiting. Other embodiments may be used, and other changes may be made, without departing from the spirit or scope of the subject matter presented herein.
[0076] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. 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 encrypting and decrypting a mobile phone number, characterized in that: The invention comprises a mobile phone number encryption method and a mobile phone number decryption method, wherein the mobile phone number encryption method comprises the following steps: Step 1: Set up a random number location list for the mobile phone number; Step 2: According to the position list, generate random numbers corresponding to the positions in the position list one by one; Step 3: insert the corresponding random number into the position to complete the encryption of the mobile phone number; The mobile phone number decryption method includes the following steps: Step 4: Searching for the inserted random number according to the position list; Step 5: After deleting the random numbers found, the returned string of numbers is the decrypted mobile phone number.
2. The method for encrypting and storing mobile phone numbers according to claim 1, characterized in that: In step 3, the positions in the position list are sorted in reverse order, and the random numbers are inserted in the sorted order.
3. The method for encrypting and storing mobile phone numbers according to claim 1, characterized in that: In step 3, after the mobile phone number encryption is completed, a decryption list is calculated based on the location list, and the decryption list is stored.
4. The method for encrypting and storing mobile phone numbers according to claim 3, characterized in that: In step 4, the inserted random number is searched according to the decryption list, specifically: The encrypted mobile phone number is searched according to the decryption list, the inserted random numbers are found and sorted, and the numbers in the sort are verified.
5. The method for encrypting and storing mobile phone numbers according to claim 4, characterized in that: In step 5, the numbers in the sorting are sorted in reverse order and then deleted according to the sorted order.
6. A method for storing mobile phone numbers, characterized in that: The method for encrypting and decrypting a mobile phone number according to any one of claims 1 to 5 comprises: Encrypt the mobile phone number using a mobile phone number encryption method, and store the encrypted mobile phone number in a database; For the original mobile phone number already in the database, the mobile phone number is encrypted using the mobile phone number encryption method and then replaced with the original mobile phone number in the database for storage.
7. A platform query and display method, characterized in that: The method for encrypting and decrypting a mobile phone number according to any one of claims 1 to 4 comprises: When querying on the platform, the mobile phone number is processed using the mobile phone number encryption method to obtain the expanded number, and the query is performed using the expanded number; If it is necessary to display on the platform, the expanded number is decrypted using the mobile phone number decryption method and displayed on the platform.
8. The method for storing and displaying mobile phone numbers according to claim 7, characterized in that: After decrypting the mobile phone number using the mobile phone number decryption method, a fixed code position is hidden before being displayed.
9. A log printing and query method, characterized in that: The method for encrypting and decrypting a mobile phone number according to any one of claims 1 to 5 comprises: The mobile phone number is encrypted using the mobile phone number encryption method and then printed in the log; When querying the logs, the mobile phone number is processed using the mobile phone number encryption method to obtain the expanded number, and the log query is performed using the expanded number.
10. A server, characterized in that: include: memory and at least one processor; The memory stores a computer program, and the at least one processor executes the computer program stored in the memory to implement the mobile phone number encryption and decryption method according to any one of claims 1 to 5.
