Coding method and device for specified code segment configuration and electronic equipment
Through the encoding method of specifying the code segment configuration, the encoding of the signature area and business field is dynamically generated, which solves the problem of fixed structure of the traditional one-object and one-code system, realizes a flexible encoding scheme, improves security and adaptability, and simplifies processing Process and reduce costs.
Patent Information
- Application Number
- CN202410977617.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-12
AI Technical Summary
The fixed structure of the QR code encoding scheme of the traditional one-item one-code system is difficult to adapt to the flexible demands of information capacity and security levels in different business scenarios, making it difficult to quickly adjust and expand the coding scheme, increasing operating costs and technical upgrade pressure, and lacking Inline business field design limits the richness of information and the diversity of marketing strategies.
A coding method for specifying code segment configuration is proposed. By obtaining the preset encoding rule configuration, determining the length and position of the signature area, dynamically generating the signature value, and combining the unique code and business fields to calculate hash value to realize the signature area Flexible configuration and coding processing of business fields, supporting data transmission of different lengths and security levels.
It improves the universality, security and adaptability of encoding, simplifies encoding logic processing, reduces maintenance costs, and the automated verification mechanism reduces manual intervention, improves the efficiency and accuracy of data processing, and enhances anti-counterfeiting capabilities.
Smart Images

Figure CN118944890A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of one-object-one-code, and in particular to a coding method, device and electronic device for specifying a code segment configuration. Background Art
[0002] In the current market environment, the one-to-one-code technology is widely used to achieve unique identification, tracking and tracing, and anti-counterfeiting verification of goods. Traditional one-to-one-code systems mostly rely on fixed-format QR codes, which are easy to copy or forge. There is no variable signature bit, which means that the verification method of each code is consistent, which reduces the difficulty of forgery and gives criminals the opportunity to copy valid QR codes in batches, damaging brand interests and consumer rights. In addition, ordinary QR code encoding schemes often focus on identification uniqueness while ignoring the richness of information. The QR code lacks the design of embedded business fields, making it difficult for a single QR code to carry more data about product information, promotional activities or customer interactions, limiting the diversity of marketing strategies and personalized promotion capabilities, and unable to efficiently integrate inventory monitoring and logistics tracking information.
[0003] In summary, traditional one-to-one-code solutions often have a fixed coding structure and are difficult to adapt to the flexible requirements of different business scenarios for information capacity and security levels. In the face of business growth and changes in market demand, there is no flexible coding solution to support rapid adjustment and expansion. Enterprises may need to frequently iterate hardware and software systems, increasing operating costs and pressure on technology upgrades. Summary of the invention
[0004] In view of this, the present application proposes an encoding method for specifying code segment configuration to solve the problems embodied in the above-mentioned background technology.
[0005] According to one aspect of the present application, there is provided a coding method for specifying a code segment configuration, comprising:
[0006] Get the preset encoding rule configuration;
[0007] Read the preset encoding rule configuration to obtain the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit;
[0008] Determine the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit and the value configuration of the signature indication bit;
[0009] After acquiring a signature value of a corresponding length according to the length of the signature area, the numerical configuration of the signature indicator bit at one end of the signature area is configured to overwrite the signature value according to the length configuration of the signature indicator bit.
[0010] As an optional implementation scheme of the present application, obtaining a signature value of a corresponding length according to the length of the signature area includes:
[0011] Obtain the code segment of the unique code and the code segment of the business field respectively;
[0012] Combining and calculating the code segment of the unique code and the code segment of the business field to obtain a hash value result;
[0013] The hash value result is intercepted according to the length of the signature area to obtain a signature value of the corresponding length.
[0014] As an optional implementation scheme of the present application, after configuring the value of the signature indicator bit to cover the signature value according to the length configuration of the signature indicator bit, the method further includes:
[0015] Get the identification code to be verified;
[0016] Scan the identification code to be verified, and determine the value configuration of the signature indicator bit according to the preset encoding rule configuration;
[0017] Determine the length of the signature to be parsed according to the numerical configuration of the signature indicator bit, and restore and parse the signature to be parsed corresponding to the length of the signature to be parsed according to the position configuration of the signature indicator bit to obtain the signature to be verified;
[0018] The signature to be verified is verified with the signature value. When the signature to be verified is equal to the signature value, the identification code to be verified is determined to be a correct code.
[0019] As an optional implementation scheme of the present application, after determining that the scanned code to be verified is a correct code, the method further includes:
[0020] At one end of the signature to be verified, the value configuration of the signature indication bit is again configured to overwrite the signature to be verified according to the length configuration of the signature indication bit to obtain the signature to be parsed.
[0021] As an optional implementation scheme of the present application, the code segment for obtaining the unique code includes:
[0022] Read the preset coding rule configuration to obtain a code segment configuration of the unique code, wherein the code segment configuration of the unique code includes a length configuration of the unique code;
[0023] The snowflake algorithm is used to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code.
[0024] As an optional implementation scheme of the present application, the method of using the snowflake algorithm to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code includes:
[0025] Use the snowflake algorithm to generate a globally unique ID;
[0026] Performing code conversion on the globally unique ID to obtain a code conversion result;
[0027] According to the length configuration of the unique code, the encoding conversion result is intercepted with a corresponding length to obtain a code segment of the unique code.
[0028] As an optional implementation scheme of the present application, the code segment of obtaining the service field includes:
[0029] Read the preset coding rule configuration to obtain the code segment configuration of the service field;
[0030] Receive business fields;
[0031] According to the code segment configuration of the service field, the service field is encoded to obtain the code segment of the service field.
[0032] As an optional implementation scheme of the present application, after configuring the value of the signature indicator bit to cover the signature value according to the length configuration of the signature indicator bit, the method further includes:
[0033] Obtaining a business field to be verified and a coding method corresponding to the business field to be verified;
[0034] According to the encoding method, converting the service field to be verified into a code segment of the service field to be verified;
[0035] The code segment of the service field to be verified is verified with the code segment of the service field. When the verification result of the code segment of the service field to be verified and the service field is an expected service value, it is determined that the service field to be verified is verified correctly.
[0036] The present application also provides an encoding device for specifying a code segment configuration, comprising:
[0037] Obtaining configuration module, used to obtain preset encoding rule configuration;
[0038] A configuration reading module, used to read the preset encoding rule configuration, and obtain the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit;
[0039] A signature position determination module, used to determine the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit and the value configuration of the signature indication bit;
[0040] The overwriting signature module is used to obtain a signature value of corresponding length according to the length of the signature area, and then configure the numerical value of the signature indicator bit at one end of the signature area to overwrite the signature value according to the length configuration of the signature indicator bit.
[0041] The present application also provides an electronic device, including:
[0042] processor;
[0043] a memory for storing processor-executable instructions;
[0044] Wherein, the processor is configured to implement the encoding method of the specified code segment configuration described above when executing the executable instructions.
[0045] Beneficial effects of this application:
[0046] The present invention obtains the preset coding rule configuration, reads the preset coding rule configuration, obtains the length configuration of the signature indicator bit, the position configuration of the signature indicator bit and the numerical configuration of the signature indicator bit, determines the length of the signature area according to the length configuration of the signature indicator bit, the position configuration of the signature indicator bit and the numerical configuration of the signature indicator bit, obtains the signature value of the corresponding length according to the length of the signature area, and then covers the signature value with the numerical configuration of the signature indicator bit according to the length configuration of the signature indicator bit at one end of the signature area. The dynamic change of the signature area increases the difficulty of cracking, improves the protection capability, and can adapt to the data transmission requirements of different lengths and security levels. The business party can freely select the encoding method of the business field according to specific requirements, improves the adaptability and flexibility of the system, and simplifies the encoding logic processing, which is easy to integrate into the existing system. The automated verification mechanism reduces manual intervention, improves the efficiency and accuracy of data processing, and the configurable design facilitates the addition of new business fields or adjustment of encoding strategies in the future, reducing maintenance costs.
[0047] Other features and aspects of the present application will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application and, together with the description, serve to explain the principles of the present application.
[0049] Figure 1 A flowchart showing a method for encoding a specified code segment configuration according to an embodiment of the present application;
[0050] Figure 2 A block diagram of an encoding device with a specified code segment configuration according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0051] Various exemplary embodiments, features and aspects of the present application will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0052] Among them, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application or simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0053] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0054] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0055] In addition, in order to better illustrate the present application, numerous specific details are provided in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.
[0056] In the fields of modern logistics and supply chain management, product traceability, anti-counterfeiting, etc., "one item one code" means that each item (such as products, packaging, equipment, etc.) has a unique, non-repeatable identification code (such as barcode, QR code, RFID tag, etc.). This identification code can contain various information about the item, such as production date, production batch, manufacturer, logistics information, etc.
[0057] In actual applications, in product tracing applications, consumers can scan the QR code or barcode on the product to query the product's production information, raw material source, quality inspection report, etc. to ensure the safety and quality of the product. In anti-counterfeiting applications, by assigning a unique identification code to each product, the emergence of counterfeit and inferior products can be effectively prevented, and consumers can determine the authenticity of the product by verifying the authenticity of the identification code. In inventory management applications, in logistics and supply chain management, one-to-one code can help companies achieve accurate inventory management, track the location and status of products in real time, and improve logistics efficiency. In marketing applications, companies can collect information such as consumers' purchasing behavior and preferences through one-to-one code, and conduct accurate marketing and data analysis.
[0058] Example 1
[0059] Figure 1 A flowchart of a coding method for a specified code segment configuration according to an embodiment of the present application is shown. A flexible one-item-one-code solution is provided, and the coding configuration can be changed during the coding process according to the requirements of the business party. Figure 1 As shown, the flow chart includes:
[0060] S100, obtaining a preset encoding rule configuration;
[0061] The preset coding rule configuration is for the business party to determine the coding structure design according to the actual business needs. The coding rule configuration includes the design of four code segment lengths, positions and coding methods. These four code segments are the unique code segment, the business field segment, the signature area segment and the signature indicator bit segment.
[0062] The position of the code segment of the unique code is specified by the business party, and the length of the code segment can be specified by the business party, such as an 8-bit to 11-bit character string, and the encoding method uses Base64 encoding or decimal.
[0063] The position of the code segment of the business field is determined by the specific field passed in by the business party, so the length of the code segment varies depending on the field passed in and the encoding method. The encoding method uses plain text encoding or Base64 encoding.
[0064] The position, length and encoding method of the signature area code segment are determined by the configuration of the signature indicator code segment. Specifically, in this embodiment, the position of the signature indicator code segment is specified as the end of the coding structure and the end of the signature area, and the length is fixed to 4 bits. The encoding method uses Base64 encoding or decimal. The position of the signature area is determined according to the specific value of the signature indicator bit, and then the length of the signature area is determined. The encoding method is consistent with the encoding method of the signature indicator bit.
[0065] The business side flexibly adjusted the configuration of each code segment based on actual business needs, which can enhance the versatility, security and adaptability of the coding.
[0066] S200, reading a preset encoding rule configuration, obtaining a length configuration of a signature indication bit, a position configuration of a signature indication bit, and a value configuration of a signature indication bit;
[0067] The encoding method of the signature has different effects on security. In this embodiment, after the encoding rule configuration is determined, the encoding rule configuration is applied to the server that performs one-to-one encoding. The server performs corresponding encoding according to the encoding rule configuration. When encoding the signature area, the length of the signature indicator bit is configured as 4 bits, the position is configured as the end of the encoding, and the value is configured as 0000-1111 according to the configuration of the signature indicator code segment in the encoding rule configuration. That is, the value of the signature indicator bit is configured as one of the values in the range of 0000-1111, so there are up to 16 different starting points of the signature area. It can reflect the dynamic flexibility of determining the length and position of the signature area.
[0068] S300, determining the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit;
[0069] In this embodiment, the position of the signature indicator code segment is specified to be located at the end of the signature area of the last part of the encoding, and the length is fixed to 4 bits. Assuming that the server obtains a value of 0111 when encoding, then according to the decimal number 7 corresponding to 0111, 0 to 7 are 8 digits in total, it can be known that the length of the signature area occupies an 8-bit binary value. It should be noted that when the server is encoding, the value of the signature indicator bit is not fixed, and the appropriate value of the signature indicator bit will be determined according to the code segment length of the uniqueness code and the code segment length of the business field.
[0070] S400, after obtaining a signature value of a corresponding length according to the length of the signature area, the numerical configuration of the signature indicator bit at one end of the signature area is configured to overwrite the signature value according to the length configuration of the signature indicator bit.
[0071] In this embodiment, after determining that the length of the signature area occupies an 8-bit binary value, the code segment of the unique code and the code segment of the business field are combined, and the selected 8-bit signature is indicated, and then the signature value is calculated. According to the position of the signature indicator code segment, it is known that the signature area is located at the end of the code, that is, the structural order of the code is the code segment of the unique code, the code segment of the business field, and the code segment of the signature area, and the signature area includes the code segment of the signature indicator bit. Specifically, after determining the signature value, count from the end of 0111, and when the count reaches the 8th, it is the starting point of the signature area. From this position, the 8-bit signature value is inserted until the end of 0111. After the signature value is inserted, according to the position and length of the signature indicator code segment, it is determined that 0111 covers the last 4 bits of the signature value, that is, after the covering is completed, the last 4 bits of the signature area are 0111. It should be noted that the position of the signature indicator code segment here is specified as the end of the coding structure and the end of the signature area, so 0111 is covered at the last 4 bits of the 8-bit signature value. Similarly, when the signature area is at the beginning of the coding structure, 0111 is overwritten at the first 4 bits of the signature value. When the length of the signature area is less than the length of the signature indicator bit, the signature indicator bit is still in the last 4 bits of the code. The position and direction of the signature area code segment and the signature indicator bit code segment in the coding structure are consistent, ensuring that the value of the signature indicator bit can overwrite the signature value at the corresponding position of the signature area. This can reduce redundancy during the coding process, and through the dynamic variability of the value configuration of the signature indicator bit, the coding space can be effectively utilized.
[0072] As an optional implementation scheme of the present application, a signature value of a corresponding length is obtained according to the length of the signature area, including: respectively obtaining a code segment of a unique code and a code segment of a business field; combining and calculating the code segment of the unique code and the code segment of the business field to obtain a hash value result; and intercepting the hash value result according to the length of the signature area to obtain a signature value of a corresponding length.
[0073] In this embodiment, before determining the signature area, the code segment of the unique code and the code segment of the business field corresponding to this encoding are first determined. After determining that the length of the signature area is 8 bits in binary, the code segment of the unique code and the code segment of the business field are calculated with a hash value using an algorithm such as SHA256, and an 8-bit value is intercepted from the hash value as an 8-bit signature value. Specifically, it can be intercepted from the end of the hash value. This process is to calculate the signature. After the intercepted hash value is used as the signature value, count from the end of 0111 until the 8th is counted, and the signature value is inserted from this position. In this step, the dynamic interception of the calculated hash value is realized according to the dynamic change of the numerical configuration of the signature indication bit, which reflects the flexible change of the code segment of the signature area.
[0074] As an optional implementation scheme of the present application, after the numerical configuration of the signature indicator bit is overwritten with the signature value according to the length configuration of the signature indicator bit, it also includes: obtaining the identification code to be verified; scanning the identification code to be verified, and determining the numerical configuration of the signature indicator bit according to the preset coding rule configuration; determining the length of the signature to be parsed according to the numerical configuration of the signature indicator bit, and restoring and parsing the signature to be parsed corresponding to the length of the signature to be parsed according to the position configuration of the signature indicator bit, to obtain the signature to be verified; verifying the signature to be verified and the signature value, and when the signature to be verified is equal to the signature value, determining that the identification code to be verified is the correct code.
[0075] In this embodiment, after the encoding is completed, the code will be applied to a product of the business party. When a user scans the code on the product, the code will be used as the identification code to be verified. The server establishes a connection with the identification code to be verified due to the user's scanning, obtains the identification code to be verified, and performs the verification process.
[0076] The server scans the identification code to be verified, obtains the preset coding rule configuration in the identification code to be verified, and obtains the numerical configuration of the signature indicator bit according to the preset coding rule configuration. For example, the obtained numerical configuration is 0111, and the position configuration of the signature indicator bit is specified as the end of the coding structure and the end of the signature area. Then, it can be determined that the 8th bit from the end of 0111 is the starting point of the signature area. At this time, the code segment of the signature area obtained by the server can be known through the position configuration of the signature indicator bit again that the last 4 bits of the code segment of the signature area are covered by 0111. The signature value obtained at this time is not a complete signature value, and the signature value obtained at this time is used as the signature to be parsed. When each code is generated, the generated signature value will be passed into the generated code, and the signature to be parsed will be restored and parsed using a conventional data restoration method to obtain a complete signature value, that is, the signature to be verified.
[0077] The signature to be verified is compared with the signature value in the incoming code. When the two are equal, the identification code to be verified is the correct code. The verification and comparison result of the correct code is returned to the user, so that the user can know whether the product is a counterfeit or inferior product.
[0078] As an optional implementation scheme of the present application, after determining that the scanned code to be verified is a correct code, it also includes: at one end of the signature to be verified, the numerical configuration of the signature indicator bit is again configured to overwrite the signature to be verified according to the length configuration of the signature indicator bit to obtain the signature to be parsed.
[0079] In this embodiment, the signature area and the signature indication bit are located after the code segment of the business field of the code segment of the unique code. At this time, one end of the signature to be verified refers to the end of the entire code and is one end of the signature indication bit. After the signature to be verified is verified, the obtained value configuration 0111 is used to overwrite the last four bits of the code segment of the signature area, that is, the last 4 bits of the entire code, to restore the signature to be parsed.
[0080] As an optional implementation scheme of the present application, obtaining a code segment of a unique code includes: reading a preset coding rule configuration to obtain a code segment configuration of the unique code, wherein the code segment configuration of the unique code includes a length configuration of the unique code; utilizing the snowflake algorithm idea to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code.
[0081] Before determining the length of the code segment of the signature area, it is also necessary to determine the code segment of the unique code and the code segment of the business field. This step is the process of determining the code segment of the unique code. Read the preset coding rule configuration to obtain the designated position and designated length of the code segment of the unique code by the business party, and use the idea of the snowflake algorithm. The snowflake algorithm outputs 64-bit data, and the total length of the coding structure in this embodiment is smaller than 64 bits. Therefore, the idea of the snowflake algorithm is used. After the data is generated by an algorithm similar to the snowflake algorithm, it is trimmed according to the designated length to obtain the code segment of the unique code.
[0082] As an optional implementation scheme of the present application, the snowflake algorithm is used to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code, including: using the snowflake algorithm to generate a globally unique ID; encoding and converting the globally unique ID to obtain an encoding conversion result; according to the length configuration of the unique code, intercepting the encoding conversion result of corresponding length to obtain a code segment of the unique code.
[0083] Specifically, assuming that the length is configured to 8 bits, that is, the specified length is 8 bits, an algorithm similar to the snowflake algorithm is used to generate a globally unique ID. At this time, the encoding method of the globally unique ID is different from the encoding configuration in the code segment of the unique code. For example, when the encoding configuration is Base64, encoding conversion is required to convert the globally unique ID into a string in Base64 format, and according to the specified length of 8 bits, the Base64 format string is trimmed as the code segment of the unique code. This step achieves the effect of reducing the number of auto-increment sequence bits and machine encoding bits based on the snowflake algorithm.
[0084] As an optional implementation scheme of the present application, obtaining the code segment of the business field includes: reading the preset encoding rule configuration to obtain the code segment configuration of the business field; receiving the business field; encoding the business field according to the code segment configuration of the business field to obtain the code segment of the business field.
[0085] The business party can declare the encoding rules of the code segments of the business fields in the preset encoding rule configuration to the system in the form of configuration files or API interfaces. In this embodiment, the encoding rules for the code segments of the business fields are to use Base64 encoding. When receiving the business fields input by the business party, according to the declared encoding rules, the business fields are automatically Base64 encoded when the code segments of the business fields are generated, ensuring that the format of the data of the business fields meets the transmission or storage standards when forming the one-to-one code.
[0086] As an optional implementation scheme of the present application, after the numerical configuration of the signature indication bit is configured to cover the signature value according to the length configuration of the signature indication bit, it also includes: obtaining the business field to be verified and the encoding method corresponding to the business field to be verified; according to the encoding method, converting the business field to be verified into a code segment of the business field to be verified; verifying the code segment of the business field to be verified with the code segment of the business field, and when the verification result of the code segment of the business field to be verified and the business field is the expected business value, it is determined that the verification of the business field to be verified is correct.
[0087] During the one-to-one-code encoding process, the business party will input the business field and convert it into a code segment of the business field, but it is also necessary to verify whether the business field can meet the expectations of the business party in the actual application process. Specifically, during the verification, the business party provides the business field to be verified, the corresponding encoding method and the expected business value. After receiving the business field to be verified, the server encodes the business field to be verified according to the corresponding encoding method to obtain the code segment of the business field to be verified.
[0088] In each code, the code segment of the business field can be processed to obtain the string corresponding to the business field initially input by the business party, and the code segment of the business field to be verified and the business field are matched to obtain the verification result. If the string is equal, it further indicates that the business field verification is correct. Or if the string is not equal, the business field verification result is incorrect, triggering the exception handling process. In this embodiment, the expected business value is: the string is equal, that is, when the code segment of the business field to be verified and the business field are equal, it means that the business field to be verified can meet the expectations of the business party.
[0089] Through this method, the dynamic changes in the signature area increase the difficulty of cracking, improve the protection capability, and can adapt to the data transmission requirements of different lengths and security levels. The business party can freely choose the encoding method of the business field according to specific needs, improve the adaptability and flexibility of the system, and simplify the encoding logic processing, which is easy to integrate into the existing system. The automated verification mechanism reduces manual intervention, improves the efficiency and accuracy of data processing, and the configurable design facilitates the addition of new business fields or adjustment of encoding strategies in the future, reducing maintenance costs.
[0090] Example 2
[0091] Based on the same principle as the above method, a coding device for specifying code segment configuration is also proposed, see Figure 2 , an encoding device 100 for specifying a code segment configuration according to an embodiment of the present disclosure includes:
[0092] The configuration acquisition module 110 is used to acquire the preset encoding rule configuration;
[0093] The configuration reading module 120 is used to read the preset coding rule configuration to obtain the length configuration of the signature indicator bit, the position configuration of the signature indicator bit, and the value configuration of the signature indicator bit;
[0094] A signature position determination module 130, configured to determine the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit;
[0095] The overwriting signature module 140 is used to obtain a signature value of a corresponding length according to the length of the signature area, and then configure the value of the signature indicator bit at one end of the signature area to overwrite the signature value according to the length of the signature indicator bit.
[0096] Obviously, those skilled in the art should understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. The modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by computing devices, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present invention is not limited to any specific combination of hardware and software.
[0097] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned control methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated as: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0098] Example 3
[0099] Furthermore, an electronic device is proposed, comprising:
[0100] processor;
[0101] a memory for storing processor-executable instructions;
[0102] Wherein, the processor is configured to implement the encoding method of the specified code segment configuration of Example 1 when executing executable instructions.
[0103] The electronic device of the embodiment of the present disclosure includes a processor and a memory for storing processor executable instructions, wherein the processor is configured to implement any of the above encoding methods of the specified code segment configuration when executing the executable instructions.
[0104] It should be noted that the number of processors may be one or more. At the same time, the electronic device of the embodiment of the present disclosure may also include an input device and an output device. The processor, memory, input device, and output device may be connected via a bus or in other ways, which are not specifically limited here.
[0105] The memory is a computer-readable storage medium for the coding method of the specified code segment configuration, and can be used to store software programs, computer executable programs, and various modules, such as: the program or module corresponding to the coding method of the specified code segment configuration of the embodiment of the present disclosure. The processor executes various functional applications and data processing of the electronic device by running the software program or module stored in the memory.
[0106] The input device can be used to receive input numbers or signals. The signal can be a key signal related to user settings and function control of the device / terminal / server. The output device can include a display device such as a display screen.
[0107] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A coding method for specifying code segment configuration, characterized in that: include: Get the preset encoding rule configuration; Read the preset encoding rule configuration to obtain the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit; Determine the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit and the value configuration of the signature indication bit; After acquiring a signature value of a corresponding length according to the length of the signature area, the numerical configuration of the signature indicator bit at one end of the signature area is configured to overwrite the signature value according to the length configuration of the signature indicator bit.
2. The encoding method for specifying code segment configuration according to claim 1, characterized in that: The acquiring a signature value of a corresponding length according to the length of the signature area includes: Obtain the code segment of the unique code and the code segment of the business field respectively; Combining and calculating the code segment of the unique code and the code segment of the business field to obtain a hash value result; The hash value result is intercepted according to the length of the signature area to obtain a signature value of the corresponding length.
3. The encoding method for specifying code segment configuration according to claim 2, characterized in that: After the numerical configuration of the signature indicator bit is configured to cover the signature value according to the length configuration of the signature indicator bit, the method further includes: Get the identification code to be verified; Scan the identification code to be verified, and determine the value configuration of the signature indicator bit according to the preset encoding rule configuration; Determine the length of the signature to be parsed according to the numerical configuration of the signature indicator bit, and restore and parse the signature to be parsed corresponding to the length of the signature to be parsed according to the position configuration of the signature indicator bit to obtain the signature to be verified; The signature to be verified is verified with the signature value. When the signature to be verified is equal to the signature value, the identification code to be verified is determined to be a correct code.
4. The encoding method for specifying code segment configuration according to claim 3, characterized in that: After determining that the scanned code to be verified is a correct code, the method further includes: At one end of the signature to be verified, the value configuration of the signature indication bit is again configured to overwrite the signature to be verified according to the length configuration of the signature indication bit to obtain the signature to be parsed.
5. The encoding method for specifying code segment configuration according to claim 2, characterized in that: The code segment for obtaining the unique code includes: Read the preset coding rule configuration to obtain a code segment configuration of the unique code, wherein the code segment configuration of the unique code includes a length configuration of the unique code; The snowflake algorithm is used to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code.
6. The encoding method for specifying code segment configuration according to claim 5, characterized in that: The method of using the snowflake algorithm to obtain a code segment of a unique code of corresponding length according to the length configuration of the unique code includes: Use the snowflake algorithm to generate a globally unique ID; Performing code conversion on the globally unique ID to obtain a code conversion result; According to the length configuration of the unique code, the encoding conversion result is intercepted with a corresponding length to obtain a code segment of the unique code.
7. The encoding method for specifying code segment configuration according to claim 2, characterized in that: The code segment for obtaining the service field includes: Read the preset coding rule configuration to obtain the code segment configuration of the service field; Receive business fields; According to the code segment configuration of the service field, the service field is encoded to obtain the code segment of the service field.
8. The encoding method for specifying code segment configuration according to claim 6, characterized in that: After the numerical configuration of the signature indicator bit is configured to cover the signature value according to the length configuration of the signature indicator bit, the method further includes: Obtaining a business field to be verified and a coding method corresponding to the business field to be verified; According to the encoding method, converting the service field to be verified into a code segment of the service field to be verified; The code segment of the service field to be verified is verified with the code segment of the service field. When the verification result of the code segment of the service field to be verified and the service field is an expected service value, it is determined that the service field to be verified is verified correctly.
9. A coding device for specifying code segment configuration, characterized in that: include: Obtaining configuration module, used to obtain preset encoding rule configuration; A configuration reading module, used to read the preset encoding rule configuration, and obtain the length configuration of the signature indication bit, the position configuration of the signature indication bit, and the value configuration of the signature indication bit; A signature position determination module, used to determine the length of the signature area according to the length configuration of the signature indication bit, the position configuration of the signature indication bit and the value configuration of the signature indication bit; The overwriting signature module is used to obtain a signature value of corresponding length according to the length of the signature area, and then configure the numerical value of the signature indicator bit at one end of the signature area to overwrite the signature value according to the length configuration of the signature indicator bit.
10. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement the encoding method of the specified code segment configuration described in any one of claims 1-8 when executing the executable instructions.
