Virtual article storage method and system, electronic equipment and storage medium

By adopting encryption, Rabin fingerprint algorithm sharding and distributed storage technology in virtual item data management, the security, data loss and privacy leakage of virtual item data in centralized database storage is solved, and the secure storage of data is realized and High reliability management.

CN119455403APending Publication Date: 2025-02-18GUANGZHOU YINGFENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411548505.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The centralized database storage method commonly used in the existing gaming industry has problems such as security, data loss and privacy leakage in virtual item management.

Method used

By combining data encryption, Rabin fingerprint algorithm sharding and distributed storage technology, virtual item data is encrypted when acquiring, and then sharding is used to store it on multiple distributed storage nodes using a shard distribution strategy.

Benefits of technology

It effectively prevents virtual item data from being illegally stolen or tampered during storage and transmission, realizes secure storage and management of data, reduces the risk of single point of failure, and improves the reliability and fault tolerance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119455403A_ABST
    Figure CN119455403A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual article storage method and system, electronic equipment and a storage medium, and the method comprises the steps: obtaining virtual article data, encrypting the virtual article data, and obtaining the encrypted virtual article data; fragmenting the encrypted virtual article data by adopting a Rabin fingerprint algorithm to obtain a plurality of pieces of fragmented virtual article data; and storing the virtual article data of the plurality of fragments on a plurality of distributed storage nodes by adopting a fragment distribution strategy. By combining the advantages of data encryption, data fragmentation and distributed storage technologies, the risk that the data is illegally stolen or tampered in the storage and transmission process is effectively prevented, and safe storage and management of the virtual article data are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed storage technology, and in particular to a virtual item storage method, system, electronic device and storage medium. Background Art

[0002] With the booming development of the modern gaming industry, virtual items such as game equipment, props, and currency have become an indispensable element in the player's gaming experience. These virtual items not only carry the player's efforts and achievements, but also play an important role in the game's economic system. However, the centralized database storage method currently used in the gaming industry faces many challenges and shortcomings in virtual item management.

[0003] First, security is a major problem faced by the centralized storage model. Since all virtual item data is stored on a single or a few servers, once these servers are attacked by hackers or maliciously invaded, players' virtual items will face the risk of being stolen, tampered with, or even permanently lost. This not only seriously damages the interests of players, but also poses a huge threat to the stability of game operators. Secondly, the risk of data loss is another issue that cannot be ignored. The centralized storage method is highly dependent on the stability and reliability of the server. Once the server fails or data is damaged due to force majeure factors such as data corruption, players' virtual item data will be lost and may face irreparable losses. Data loss affects the player's gaming experience. In addition, privacy issues are also an important challenge that the centralized storage method needs to face. In the centralized storage model, players' virtual item data is centrally stored on the server, which increases the risk of data leakage. Once the server is illegally accessed or the data is improperly used, the player's personal privacy will be seriously threatened. Therefore, how to safely store and manage virtual item data has become an urgent problem to be solved. Summary of the invention

[0004] The main purpose of this application is to overcome the shortcomings and deficiencies of the prior art and to provide a virtual item storage method, system, electronic device and storage medium. By combining the advantages of data encryption, data sharding and distributed storage technology, the risk of data being illegally stolen or tampered with during storage and transmission is effectively prevented, thereby achieving secure storage and management of virtual item data.

[0005] In order to achieve the above objectives, this application adopts the following technical solutions:

[0006] In a first aspect, the present application provides a virtual item storage method, comprising the following steps:

[0007] Acquiring virtual item data, and encrypting the virtual item data to obtain encrypted virtual item data;

[0008] Using the Rabin fingerprint algorithm to slice the encrypted virtual item data to obtain a plurality of slices of virtual item data;

[0009] A shard distribution strategy is adopted to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes.

[0010] As a preferred technical solution, the obtaining of virtual item data includes obtaining the ID, name, attribute value and type of the virtual item.

[0011] As a preferred technical solution, the encrypting the virtual item data includes:

[0012] A random number generator is used to generate a key of a preset length and an initialization vector;

[0013] Convert the virtual item data into JSON format as plaintext data to be encrypted;

[0014] Selecting the ID of the virtual item as additional authentication data;

[0015] Based on the key and the initialization vector, the plaintext data to be encrypted is encrypted using the AES-GCM algorithm to obtain ciphertext data;

[0016] generating an authentication tag according to the additional authentication data, the initialization vector and the ciphertext data;

[0017] The generated initialization vector, the ciphertext data and the authentication tag are combined to obtain encrypted virtual item data.

[0018] As a preferred technical solution, the encrypted virtual item data is sliced ​​using the Rabin fingerprint algorithm to obtain a plurality of sliced ​​virtual item data; including:

[0019] Set the target shard size;

[0020] Initialize a sliding window, where the size of the sliding window is fixed to k bytes;

[0021] Use the sliding window to traverse the encrypted virtual item data, and at each sliding window position, calculate the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm;

[0022] Check the last n digits of the fingerprint value. If the last n digits are all 0, there is a sharding boundary at the end position of the current sliding window. If the last n digits are not all 0, if the distance between the start position of the current sliding window and the previous sharding boundary is greater than or equal to the target sharding size, a sharding boundary is forcibly set at the end position of the current sliding window.

[0023] When the slice boundary is detected, the encrypted virtual item data from the previous slice boundary to the current slice boundary is treated as an independent slice virtual item data, and the starting position and length of each slice virtual item data are recorded;

[0024] After completing one slice of virtual item data, the sliding window is moved forward by one byte, and the above steps are repeated until the entire encrypted virtual item data is completely traversed and sliced.

[0025] As a preferred technical solution, the method of calculating the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm includes:

[0026] Traverse each byte in the encrypted virtual item data sequence;

[0027] Obtaining a weighted value of each byte in the item data sequence according to the position of each byte in the sequence and the size of the sliding window;

[0028] Sum the weighted values ​​of all bytes to obtain a weighted sum;

[0029] A modular operation is performed on the weighted sum to obtain a fingerprint value of the encrypted virtual item data in the current window.

[0030] As a preferred technical solution, the shard distribution strategy is adopted to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes, including:

[0031] According to the storage capacity and CPU processing capability of each storage node, a weight is assigned to each storage node in the storage node list;

[0032] Calculate the sum of the weight values ​​of all the storage nodes to obtain a total weight sum;

[0033] Using a random number generation algorithm to generate a number of random numbers between 0 and the total weight sum from the virtual item data of the plurality of shards;

[0034] The storage node list is traversed, and weight values ​​are accumulated one by one according to the order of the storage nodes in the storage node list, until the weight value exceeds the random number for the first time, and the storage node traversed at this time is selected as the storage location of the virtual item data of the shard.

[0035] As a preferred technical solution, it also includes:

[0036] When a request to access the virtual item data is required, obtaining the virtual item data of the plurality of shards from the plurality of storage nodes;

[0037] Decrypting the virtual item data of the plurality of slices to obtain decrypted virtual item data of the plurality of slices;

[0038] The virtual item data of the plurality of fragments are merged according to a predefined merging rule to obtain complete virtual item data.

[0039] In a second aspect, the present application provides a virtual item storage system, including an encryption module, a sharding module, and a storage module;

[0040] The encryption module is used to obtain virtual item data and encrypt the virtual item data to obtain encrypted virtual item data;

[0041] The slicing module is used to slice the encrypted virtual item data using a Rabin fingerprint algorithm to obtain a plurality of slices of virtual item data;

[0042] The storage module is used to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes by adopting a shard distribution strategy.

[0043] In a third aspect, the present application provides an electronic device, the electronic device comprising:

[0044] at least one processor; and a memory communicatively coupled to the at least one processor;

[0045] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the virtual item storage method.

[0046] In a fourth aspect, the present application provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the virtual item storage method.

[0047] In summary, compared with the prior art, the effective effects brought about by the technical solution provided by this application include at least:

[0048] This application proposes a virtual item storage method. First, an encryption algorithm is used to encrypt virtual item data to ensure the confidentiality and integrity of the data during storage and transmission, and effectively prevent the risk of data being illegally stolen or tampered with during storage and transmission. Subsequently, the encrypted data is sharded using the Rabin fingerprint algorithm, and the security of the data is enhanced through the asymmetry and irreversibility of the algorithm, while facilitating the distributed storage of data. Finally, through the sharding distribution strategy, the sharded virtual item data is dispersedly stored on multiple distributed storage nodes. This storage method not only improves the reliability and fault tolerance of the system, but also reduces the risk of single point failure. It can be seen that this application combines the advantages of data encryption, data sharding and distributed storage technology to effectively prevent the risk of data being illegally stolen or tampered with during storage and transmission, and realizes the secure storage and management of virtual item data. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0050] Figure 1 A flowchart of a virtual item storage method provided for one embodiment of the present application;

[0051] Figure 2 A flowchart for encrypting virtual item data provided by an embodiment of the present application;

[0052] Figure 3 A flowchart of slicing encrypted virtual item data provided by an embodiment of the present application;

[0053] Figure 4 A process for distributing and storing sharded virtual item data provided in one embodiment of the present application;

[0054] Figure 5 A block diagram of a virtual item storage system provided for one embodiment of the present application;

[0055] Figure 6 A structural diagram of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0056] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.

[0057] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0058] In the modern gaming industry, virtual items such as equipment, props, and currency are not only the core components of the game economy, but also an important carrier of the player's gaming experience. With the vigorous development of the gaming industry, the number and value of virtual items are growing, and their storage and management methods have become the focus of game developers and technology providers.

[0059] However, game operators generally use centralized databases to store players' virtual item data. Although this centralized storage method is easy to manage and maintain, it seems to be unable to cope with increasingly complex security threats. First of all, since all virtual item data is stored on a single or a few servers, once hackers attack the server or exploit system vulnerabilities, virtual items are illegally obtained or tampered with, so the centralized storage method has significant security issues. Secondly, the centralized storage method is highly dependent on the stability and reliability of the server. Once a server failure or human error occurs, data may be damaged or lost, causing irreversible impact on the player's gaming experience. In addition, when players' virtual item data is stored in a centralized manner, they also face the risk of privacy leakage, especially during data processing and transmission. Once security measures are not in place, it may be illegally obtained and used by third parties.

[0060] In order to solve the above problems, this application first encrypts the virtual item data through encryption technology to ensure the confidentiality of the data and prevent it from being illegally obtained or tampered with during storage and transmission. Subsequently, the encrypted data is sharded using the Rabin fingerprint algorithm, which further enhances the security of the data with its asymmetry and irreversibility, and facilitates the distributed storage of data. Finally, a sharding distribution strategy is used to store the sharded data on multiple distributed storage nodes to achieve redundant backup and load balancing of the data.

[0061] The technical solutions provided by the embodiments in this specification are described in detail below in conjunction with the accompanying drawings.

[0062] See also Figure 1 In one embodiment of the present application, a virtual item storage method is provided, comprising the following steps:

[0063] S1. Acquire virtual item data, and encrypt the virtual item data to obtain encrypted virtual item data.

[0064] Furthermore, obtaining virtual item data includes obtaining the unique identifier (ID) of each virtual item and the name of the virtual item; the unique identifier (ID) of the virtual item is the basis for identifying and distinguishing different virtual items; it also includes obtaining the attribute values ​​of the virtual item, which include but are not limited to the attack power value, defense power value, speed value, rarity value, etc., which together define the performance and value of the virtual item. In addition, it also includes obtaining the type of virtual items, such as equipment, consumables, task props, etc. This classification helps the system to manage and distribute virtual items more effectively.

[0065] Specifically, the virtual item data is encrypted to obtain the encrypted virtual item data. Figure 2 , the specific steps include:

[0066] S11. Use a random number generator to generate a key of a preset length and an initialization vector.

[0067] This embodiment uses the AES-GCM (Advanced Encryption Standard Galois / Counter Mode) algorithm to encrypt the plaintext data to be encrypted. The AES-GCM algorithm is a symmetric key encryption mode based on a block cipher. It combines the encryption characteristics of the counter mode (CTR) and the authentication characteristics of the GHASH function of the Galois / Field multiplication; it is intended to provide confidentiality, integrity and authenticity protection for data.

[0068] Furthermore, generating secure and random keys and initialization vectors is the cornerstone of ensuring encryption strength and data security. This process is not only related to the effectiveness of the encryption algorithm, but also directly affects the ability of data to be protected from unauthorized access and tampering during transmission and storage.

[0069] A key of a preset length generated by a random number generator may be 128 bits, 192 bits or 256 bits. To provide higher security, a preset length of 256 bits (ie, 32 bytes) is selected as the key length in this embodiment.

[0070] Furthermore, by calling the API or function of the random number generator, a request is made to generate a random byte sequence with a length of 256 bits (i.e. 32 bytes), which will be used as the encryption key; the key is used for data encryption and integrity verification in the subsequent encryption process, and ensuring its randomness and security is the key to ensuring the encryption strength.

[0071] For each encryption operation, a random number generator is used to generate a random number of a preset length as the initialization vector for the encryption operation. In the AES-GCM algorithm mode, although the AES-GCM algorithm allows the use of an initialization vector of any length (but the maximum length is 2 64-1 In order to ensure sufficient randomness, in this embodiment, a 96-bit (i.e., 12-byte) initialization vector is used. The initialization vector is unique for each encryption operation to ensure that even under the same key, multiple encryptions of the same data will produce different ciphertext outputs, thereby enhancing the security of the encryption process.

[0072] Additionally, after the keys and initialization vectors are generated, their randomness can be verified through statistical tests. Once the keys and initialization vectors have passed randomness verification, they can be considered secure and ready to be used in the encryption process.

[0073] S12. Convert the virtual item data into JSON format as plaintext data to be encrypted.

[0074] Furthermore, JSON format JSON (JavaScript Object Notation) is a lightweight data exchange format, which is a process of converting data structures into an easy-to-read and parse text format; it is easy for people to read and write, and also easy for machines to parse and generate.

[0075] In this embodiment, the virtual item data to be encrypted (including but not limited to ID, name, attribute value and type, etc.) is converted into JSON format to ensure that the data is presented in a unified format before encryption, which is convenient for processing and transmission.

[0076] S13. Select the ID of the virtual item as additional authentication data.

[0077] Additional authentication data is data that is additionally taken into account during the encryption process but is not directly encrypted.

[0078] Furthermore, in this embodiment, the ID of the virtual item in the virtual item data that is important but does not need to be encrypted is selected as additional authentication data. The ID of the virtual item in the virtual item data is usually globally unique, and as the core identification of the virtual item, its integrity is crucial to ensure that the data has not been tampered with; in addition, although the ID of the virtual item is important for verifying the integrity of the data, it does not contain sensitive information itself, so it does not need to be encrypted. Therefore, in this embodiment, the ID of the virtual item can be selected as additional authentication data.

[0079] S14. Based on the key and the initialization vector, the AES-GCM algorithm is used to encrypt the plaintext data to obtain ciphertext data.

[0080] S15. Generate an authentication tag according to the additional authentication data, the initialization vector and the ciphertext data.

[0081] Furthermore, the steps of using the AES-GCM algorithm to encrypt the plaintext data to be encrypted and generate an authentication tag are as follows:

[0082] (1) Generate counter block: GCM mode (Galois / Counter Mode, an algorithm mode for authenticated encryption of associated data) first generates a counter block, which is used to generate the encryption key stream during the encryption process.

[0083] (2) Encrypt plaintext: Use the AES algorithm and key, as well as the key stream generated by the counter block, to encrypt the plaintext data.

[0084] (3) While generating the ciphertext data, an authentication tag is also generated based on the additional authentication data, the initialization vector and the ciphertext data; the authentication tag is calculated using the GMAC (Galois Message Authentication Code) algorithm based on the key, the additional authentication data and the ciphertext data.

[0085] (4) Output ciphertext and authentication tag: After the encryption process is completed, the ciphertext data and authentication tag are output. The ciphertext data is the result of plaintext encryption, and the authentication tag is used to verify the integrity and authenticity of the ciphertext during decryption.

[0086] S16: Combine the generated initialization vector, the ciphertext data and the authentication tag to obtain encrypted virtual item data.

[0087] Furthermore, the generated initialization vector, the ciphertext data and the authentication tag are combined to form a final encrypted data packet, and the final encrypted data packet is stored in a key management system.

[0088] This embodiment adopts the AES-GCM algorithm to provide strong protection for the confidentiality, integrity and authenticity of data by combining symmetric encryption and message authentication code.

[0089] S2. Use Rabin fingerprint algorithm to slice the encrypted virtual item data to obtain a plurality of slices of virtual item data.

[0090] The Rabin fingerprint algorithm is a variant of a hash algorithm used for data integrity verification and segmentation. It is based on the principle of polynomial modular arithmetic and is used to generate a unique identifier (i.e., fingerprint value) for data.

[0091] For further information, see Figure 3 , using the Rabin fingerprint algorithm to fragment the encrypted virtual item data to obtain a number of fragmented virtual item data, the steps include:

[0092] S21. Set the target shard size.

[0093] Since the size of the target shard is directly related to the efficiency of subsequent data processing, the optimization of storage space, and the convenience of network transmission; this embodiment needs to set the size of the target shard according to actual needs or system limitations; for example, if the data shard is used for network transmission, then factors such as network bandwidth, data packet size limit, and transmission delay need to be considered; if it is used for distributed storage, then the capacity of the storage node, data read and write performance, and data redundancy strategy need to be considered. System limitations are also important factors that must be considered when setting the target shard size. For example, some storage systems or databases may have clear limitations on file size, data block size, or transaction processing capabilities.

[0094] Therefore, after analyzing the actual needs and system limitations, a comprehensive evaluation is needed to find a target shard size that meets both the needs and the limitations.

[0095] S22. Initialize a sliding window, where the size of the sliding window is fixed to k bytes.

[0096] S23, using the sliding window to traverse the encrypted virtual item data, and at each sliding window position, calculating the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm.

[0097] Further, the fingerprint value of the encrypted virtual item data in the current window is calculated according to the Rabin fingerprint algorithm, and the steps include:

[0098] Traverse each byte in the encrypted virtual item data sequence;

[0099] Obtaining a weighted value of each byte in the item data sequence according to the position of each byte in the sequence and the size of the sliding window;

[0100] The weighted values ​​of all bytes are summed to obtain a weighted sum;

[0101] A modular operation is performed on the weighted sum to obtain a fingerprint value of the encrypted virtual item data in the current window.

[0102] Furthermore, the Rabin fingerprint algorithm formula is:

[0103]

[0104] Among them, x is the encrypted virtual item data sequence; i is an index variable (the position of each byte in the sequence), which is used to traverse each byte in the encrypted virtual item data sequence x; k represents the size of the sliding window; p is a pre-selected prime number large enough for modular operation to prevent integer overflow.

[0105] S24, checking the last n digits of the fingerprint value, if the last n digits are all 0, there is a sharding boundary at the end position of the current sliding window; when the last n digits are not all 0, if the distance between the starting position of the current sliding window and the previous sharding boundary is greater than or equal to the target sharding size, a sharding boundary is forcibly set at the end position of the current sliding window.

[0106] Furthermore, checking the last n digits of the fingerprint value may check the last 13 digits of the fingerprint value.

[0107] S25. When the slice boundary is detected, the encrypted virtual item data from the previous slice boundary to the current slice boundary is treated as an independent slice virtual item data, and the starting position and length of each slice virtual item data are recorded.

[0108] S26. After completing one data segmentation, the sliding window is moved forward by one byte, and the above steps are repeated until the entire encrypted virtual item data is completely traversed and segmented.

[0109] In addition, if the remaining encrypted virtual item data is less than the data of a complete shard, the remaining encrypted virtual item data is used as the last shard.

[0110] In this embodiment, the Rabin fingerprint algorithm is used for data sharding. By adjusting the window size and the detection conditions of the sharding boundary, the size and number of shards can be flexibly controlled. Since the fingerprint value is based on the data content, sharding usually occurs naturally when the data content changes, which helps to maintain the uniformity of the sharding; at the same time, it facilitates subsequent data deduplication and incremental updates.

[0111] S3. Using a shard distribution strategy, the virtual item data of the plurality of shards are stored on a plurality of distributed storage nodes.

[0112] For further information, see Figure 4 , using a shard distribution strategy to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes, the steps of which include:

[0113] S31. Allocate a weight to each storage node in the storage node list according to the storage capacity and CPU processing capability of each storage node.

[0114] Furthermore, the system first evaluates the performance parameters of each distributed storage node, mainly including storage capacity and CPU processing power. For example, suppose there are three storage nodes A, B, and C, whose storage capacity is 1TB, 2TB, and 1.5TB respectively, and whose CPU processing power (measured in the number of requests processed per second) is 1000, 2000, and 1500 respectively. Based on these parameters, the system can assign a relative weight to each node. In this example, a certain weighted sum of storage capacity and CPU processing power can be used as the weight, such as weight = storage capacity * 0.5 + CPU processing power * 0.5 (the weight distribution method here can be adjusted according to actual needs). Therefore, the weight of storage node A is (10.5 + 10000.5) = 500.5, the weight of storage node B is (20.5 + 20000.5) = 1001, and the weight of storage node C is (1.50.5 + 15000.5) = 750.75.

[0115] S32. Calculate the sum of the weight values ​​of all the storage nodes to obtain a total weight sum.

[0116] Continuing with the above example, the weight of storage node A is 500.5, storage node B is 1001, and storage node C is 750.75; then the total weight sum = 500.5 + 1001 + 750.75 = 2252.25; the value of the total weight sum will be used as the upper limit of subsequent random number generation.

[0117] S33, using a random number generation algorithm to generate a number of random numbers between 0 and the total weight sum from the virtual item data of the plurality of slices.

[0118] A random number generation algorithm (such as a pseudo-random number generator) is used to generate a random number between 0 and the total weight and (2252.25) for each shard of virtual item data. For example, for the first shard of virtual item data, the generated random number may be 1100; for the second shard of virtual item data, the generated random number may be 1800, and so on.

[0119] S34, traversing the storage node list, accumulating weight values ​​one by one according to the order of the storage nodes in the storage node list, until the weight value exceeds the random number for the first time, and selecting the storage node traversed at this time as the storage location of the virtual item data of the shard.

[0120] Traverse the list of storage nodes, starting from the first node, and accumulate their weight values ​​one by one until the accumulated value exceeds the generated random number for the first time. Take the first shard as an example. Assuming the generated random number is 1100, start accumulating the weight (500.5) from storage node A, and then add the weight of storage node B (until the accumulated value exceeds 1100). Assuming that when the weight of storage node B is 600 (the accumulated weight is 1100.5, which exceeds 1100 for the first time), storage node B is selected as the storage location of the shard.

[0121] The above steps adopt a weight-based random distribution strategy, which can ensure that high-performance nodes take on more storage and processing tasks, thereby effectively balancing the load of the entire system.

[0122] In this embodiment, a hash sharding distribution strategy may also be used to store virtual item data of several shards on multiple distributed storage nodes, and the steps include:

[0123] Generate a unique identifier for each distributed storage node; the storage node generates a unique identifier usually based on the physical or logical attributes of the node, such as IP address plus port number; use a hash function (such as MD5 or SHA-1) to map the unique identifier generated by each storage node to 0 to 2 32-1 The integer space of ;

[0124] Generate a unique identifier (such as a shard ID) for each shard of virtual item data; similar to the processing of node identifiers, use the same hash function to map the unique identifier generated by the sharded virtual item data to the same integer space (i.e., 0 to 2 32-1 integer space);

[0125] The hash space is considered as a ring (hash ring), that is, the two endpoints of the integer space (i.e., 0 to 2 32-1) are connected. For the hash value of the virtual item data of each shard, the hash value of the storage node closest to it is found on the hash ring. Once the node closest to the hash value of the virtual item data of the shard is found, the virtual item data of the shard is stored on the corresponding storage node.

[0126] The hash sharding distribution strategy maps the virtual item data of nodes and shards to the same integer space (hash ring) through a hash function, and uses the characteristics of the hash ring to find the node closest to the sharded virtual item data for storage. This method has the advantages of load balancing, scalability, and fault tolerance, and can ensure efficient storage and access of data in a distributed system.

[0127] A dynamic load balancing distribution strategy can also be used to store virtual item data of several shards on multiple distributed storage nodes, and the steps include:

[0128] Deploy a monitoring system to collect real-time load data of each storage node; real-time load data includes but is not limited to CPU usage, memory usage, storage space usage, network bandwidth usage, etc.;

[0129] According to the actual operation situation or demand, set a reasonable load balancing threshold; for example, setting the storage space utilization rate threshold to 80% means that when the storage space utilization rate of a storage node exceeds this threshold, the storage node is considered to be in a high load state.

[0130] The monitoring system collects load data from each storage node regularly (e.g., every minute, every hour, etc.), summarizes and analyzes it, and identifies high-load nodes and low-load nodes based on the set load balancing threshold;

[0131] When load imbalance is found (i.e., there is a significant difference between high-load nodes and low-load nodes), the load balancing adjustment process is started, the virtual item data of the shard to be migrated is selected from the high-load node, and the virtual item data of the selected shard is migrated from the high-load node to the low-load node. After the migration, the storage location information of the virtual item data of the shard is updated.

[0132] In addition, a shard distribution strategy based on geographic location awareness can also be used to store virtual item data of several shards on multiple distributed storage nodes, and the steps include:

[0133] Add geographic location information (such as latitude and longitude, data center ID, etc.) to each storage node;

[0134] Geo-tagging data shards based on user location or game server location;

[0135] Calculate the geographical distance between each shard’s virtual item data and each storage node;

[0136] According to the calculated geographical distance, select N storage nodes closest to the geographical location mark of the virtual item data of the shard as candidate storage nodes;

[0137] Other strategies (such as load balancing) are applied among the candidate nodes to determine the final storage location.

[0138] A multi-copy shard distribution strategy may also be used to store virtual item data of several shards on multiple distributed storage nodes, the steps of which include:

[0139] Determine the number of copies of the virtual item data for each shard (e.g., 3 copies);

[0140] Use any of the above mentioned strategies (such as geolocation awareness, dynamic load balancing, etc.) to select the first storage node, which will be the storage location of the first copy of the virtual item data of the shard;

[0141] Select different storage nodes for the remaining replicas; ensure that they are located in different physical machines or data centers to provide higher fault tolerance and data security to prevent data loss caused by single point failures;

[0142] Record the location information of all replica storage; design and implement a read load balancing mechanism that can select which replica to read the sharded virtual item data from based on recency or lightest load.

[0143] In this embodiment, the above-mentioned shard distribution strategy can be selected according to system scale, data characteristics, hardware heterogeneity, network topology or scalability to store virtual item data of several shards on multiple distributed storage nodes.

[0144] According to the shard distribution strategy, the virtual item data of several shards is stored in multiple distributed storage nodes, which can effectively disperse the data and store it on different nodes, reducing the risk of single point failure and improving the overall performance and reliability of the system. According to the specific application scenario and requirements, a single strategy or a combination of multiple strategies can be selected to achieve the optimal data distribution.

[0145] In this embodiment, it also includes:

[0146] (1) When a request is needed to access virtual item data, a data request is made through the API gateway to obtain the virtual item data of the plurality of shards from the plurality of storage nodes; specifically:

[0147] The API gateway receives the player's virtual item data access request;

[0148] And extract the virtual item ID and player information in the access request;

[0149] Query the data shard mapping table according to the virtual item ID to obtain the virtual item data storage location of the shard; and check the current load of the storage node;

[0150] Consider the player's geographical location and choose a storage node that is closer to the player to reduce network latency;

[0151] Determine the health status of the selected storage node; if the selected storage node is in a healthy state, the access request can be processed.

[0152] Finally, the player's data access request is forwarded to the selected storage node to obtain the required virtual item data.

[0153] (2) decrypting the virtual item data of the plurality of slices to obtain decrypted virtual item data of the plurality of slices; specifically:

[0154] (2.1) According to the data sharding mapping table, the location of the storage node of all sharded virtual item data is determined; and a data acquisition request is sent to multiple storage nodes, and the storage nodes respond to the request to obtain the encrypted sharded virtual item data;

[0155] (2.2) Use a hash function (such as SHA-256) to hash the virtual item data of each shard, and compare the calculated hash value with the pre-stored hash value (calculated before the data is sharded and encrypted) to ensure that the shard data has not been tampered with during transmission;

[0156] (2.3) Obtain a decryption key, use the decryption key to decrypt each slice, and obtain virtual item data of several decrypted slices; after decryption, verify the integrity and authenticity of the ciphertext based on the authentication tag.

[0157] (3) merging the virtual item data of the plurality of fragments according to a predefined merging rule to obtain complete virtual item data;

[0158] Specifically, the decrypted virtual item data of the shards are arranged in the correct order according to the shard sequence number or the predefined merging rule, and it is checked whether all necessary virtual item data of the shards have been successfully acquired and decrypted; the virtual item data of all the shards are spliced ​​together in order to reconstruct the complete virtual item data.

[0159] In addition, it also includes data integrity verification of the complete virtual item data obtained after merging to ensure the security and integrity of the data.

[0160] It should be noted that, for the sake of convenience of description, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously.

[0161] Based on the same idea as the virtual item storage method in the above embodiment, the present application also provides a virtual item storage system, which can be used to execute the above virtual item storage method. For ease of explanation, the structural diagram of a virtual item storage system embodiment only shows the parts related to the embodiment of the present application. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.

[0162] See also Figure 5 In another embodiment of the present application, a virtual item storage system is provided, the system comprising an encryption module 101, a sharding module 102 and a storage module 103;

[0163] The encryption module 101 is used to obtain virtual item data and encrypt the virtual item data to obtain encrypted virtual item data;

[0164] The slicing module 102 is used to slice the encrypted virtual item data using a Rabin fingerprint algorithm to obtain a plurality of slicing virtual item data;

[0165] The storage module 103 is used to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes by adopting a shard distribution strategy.

[0166] As a preferred technical solution, the obtaining of virtual item data includes obtaining the ID, name, attribute value and type of the virtual item.

[0167] As a preferred technical solution, the encryption module 101 is specifically used for:

[0168] A random number generator is used to generate a key of a preset length and an initialization vector;

[0169] Convert the virtual item data into JSON format as plaintext data to be encrypted;

[0170] Selecting the ID of the virtual item as additional authentication data;

[0171] Based on the key and the initialization vector, the plaintext data to be encrypted is encrypted using the AES-GCM algorithm to obtain ciphertext data;

[0172] generating an authentication tag according to the additional authentication data, the initialization vector and the ciphertext data;

[0173] The generated initialization vector, the ciphertext data and the authentication tag are combined to obtain encrypted virtual item data.

[0174] As a preferred technical solution, the slicing module 102 is specifically used for:

[0175] Set the target shard size;

[0176] Initialize a sliding window, where the size of the sliding window is fixed to k bytes;

[0177] Use the sliding window to traverse the encrypted virtual item data, and at each sliding window position, calculate the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm;

[0178] Check the last n digits of the fingerprint value. If the last n digits are all 0, there is a sharding boundary at the end position of the current sliding window. If the last n digits are not all 0, if the distance between the start position of the current sliding window and the previous sharding boundary is greater than or equal to the target sharding size, a sharding boundary is forcibly set at the end position of the current sliding window.

[0179] When the slice boundary is detected, the encrypted virtual item data from the previous slice boundary to the current slice boundary is treated as an independent slice virtual item data, and the starting position and length of each slice virtual item data are recorded;

[0180] After completing one slice of virtual item data, the sliding window is moved forward by one byte, and the above steps are repeated until the entire encrypted virtual item data is completely traversed and sliced.

[0181] As a preferred technical solution, the storage module 103 is specifically used for:

[0182] Assign a weight to each storage node in the storage node list based on its storage capacity and CPU processing capability.

[0183] Calculate the sum of the weight values ​​of all storage nodes to get the total weight sum;

[0184] Using a random number generation algorithm to generate a number of random numbers between 0 and the total weight sum from the virtual item data of the plurality of shards;

[0185] The storage node list is traversed, and weight values ​​are accumulated one by one according to the order of the storage nodes in the storage node list, until the weight value exceeds the random number for the first time, and the storage node traversed at this time is selected as the storage location of the virtual item data of the shard.

[0186] As a preferred technical solution, a decryption and merging module is also included, and the decryption and merging module is used to:

[0187] When a request to access the virtual item data is required, obtaining the virtual item data of the plurality of shards from the plurality of storage nodes;

[0188] Decrypting the virtual item data of the plurality of slices to obtain decrypted virtual item data of the plurality of slices;

[0189] The virtual item data of the plurality of fragments are merged according to a predefined merging rule to obtain complete virtual item data.

[0190] It should be noted that a virtual item storage system of the present application corresponds one-to-one to a virtual item storage method of the present application. The technical features and beneficial effects described in the embodiment of the above-mentioned virtual item storage method are applicable to the embodiment of a virtual item storage system. For specific contents, please refer to the description in the embodiment of the method of the present application, which will not be repeated here. This is hereby declared.

[0191] In addition, in the implementation of a virtual item storage system in the above embodiment, the logical division of each program module is only an example. In actual application, the above functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the virtual item storage system is divided into different program modules to complete all or part of the functions described above.

[0192] See also Figure 6 In another embodiment, an electronic device for implementing a virtual item storage method is provided. The electronic device may include a processor, a memory, and a bus, and may also include a computer program stored in the memory and executable on the processor, such as a virtual item storage program.

[0193] Exemplarily, in this embodiment, the computer program may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the device.

[0194] The electronic device may be a computing device such as a desktop computer, a notebook, a palm computer, a cloud server, etc. The device may include, but is not limited to, a processor and a memory.

[0195] In some embodiments, the processor may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center (Control Unit) of the device, and uses various interfaces and lines to connect the various components of the entire device; by running or executing the program or module stored in the memory, and calling the data stored in the memory, the various functions of the electronic device and the processing data are executed.

[0196] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; in addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0197] Wherein, the memory may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the memory may also include both an internal storage unit of the electronic device and an external storage device. The memory may be used not only to store application software and various types of data installed in the electronic device, such as a code of a virtual item storage program, etc., but also to temporarily store data that has been output or is to be output.

[0198] Figure 6 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 6 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0199] The virtual item storage program stored in the memory of the electronic device is a combination of multiple instructions, and when executed in the processor, can achieve:

[0200] Acquiring virtual item data, and encrypting the virtual item data to obtain encrypted virtual item data;

[0201] Using the Rabin fingerprint algorithm to slice the encrypted virtual item data to obtain a plurality of slices of virtual item data;

[0202] A shard distribution strategy is adopted to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes.

[0203] Accordingly, the present application also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a virtual item storage method as described in any one of the above embodiments.

[0204] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), flash memory, mobile hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.

[0205] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0206] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0207] The above embodiments are preferred implementation modes of the present application, but the implementation modes of the present application are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present application should be equivalent replacement methods and are included in the protection scope of the present application.

Claims

1. A virtual item storage method, characterized in that: The steps include: Acquiring virtual item data, and encrypting the virtual item data to obtain encrypted virtual item data; Using the Rabin fingerprint algorithm to slice the encrypted virtual item data to obtain a plurality of slices of virtual item data; A shard distribution strategy is adopted to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes.

2. A virtual item storage method according to claim 1, characterized in that: The obtaining of virtual item data includes obtaining the ID, name, attribute value and type of the virtual item.

3. A virtual item storage method according to claim 2, characterized in that: The encrypting the virtual item data includes: A random number generator is used to generate a key of a preset length and an initialization vector; Convert the virtual item data into JSON format as plaintext data to be encrypted; Selecting the ID of the virtual item as additional authentication data; Based on the key and the initialization vector, the plaintext data to be encrypted is encrypted using the AES-GCM algorithm to obtain ciphertext data; generating an authentication tag according to the additional authentication data, the initialization vector and the ciphertext data; The generated initialization vector, the ciphertext data and the authentication tag are combined to obtain encrypted virtual item data.

4. A virtual item storage method according to claim 1, characterized in that: The encrypted virtual item data is sliced ​​by using the Rabin fingerprint algorithm to obtain a plurality of sliced ​​virtual item data; including: Set the target shard size; Initialize a sliding window, where the size of the sliding window is fixed to k bytes; Use the sliding window to traverse the encrypted virtual item data, and at each sliding window position, calculate the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm; Check the last n digits of the fingerprint value. If the last n digits are all 0, there is a sharding boundary at the end position of the current sliding window. If the last n digits are not all 0, if the distance between the start position of the current sliding window and the previous sharding boundary is greater than or equal to the target sharding size, a sharding boundary is forcibly set at the end position of the current sliding window. When the slice boundary is detected, the encrypted virtual item data from the previous slice boundary to the current slice boundary is treated as an independent slice virtual item data, and the starting position and length of each slice virtual item data are recorded; After completing one slice of virtual item data, the sliding window is moved forward by one byte, and the above steps are repeated until the entire encrypted virtual item data is completely traversed and sliced.

5. A virtual item storage method according to claim 4, characterized in that: The step of calculating the fingerprint value of the encrypted virtual item data in the current window according to the Rabin fingerprint algorithm includes: Traverse each byte in the encrypted virtual item data sequence; Obtaining a weighted value of each byte in the item data sequence according to the position of each byte in the sequence and the size of the sliding window; The weighted values ​​of all bytes are summed to obtain a weighted sum; A modular operation is performed on the weighted sum to obtain a fingerprint value of the encrypted virtual item data in the current window.

6. A virtual item storage method according to claim 1, characterized in that: The adopting of the shard distribution strategy to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes includes: According to the storage capacity and CPU processing capability of each storage node, a weight is assigned to each storage node in the storage node list; Calculate the sum of the weight values ​​of all the storage nodes to obtain a total weight sum; Using a random number generation algorithm to generate a number of random numbers between 0 and the total weight sum from the virtual item data of the plurality of shards; The storage node list is traversed, and weight values ​​are accumulated one by one according to the order of the storage nodes in the storage node list, until the weight value exceeds the random number for the first time, and the storage node traversed at this time is selected as the storage location of the virtual item data of the shard.

7. A virtual item storage method according to claim 1, characterized in that: Also includes: When a request to access the virtual item data is required, obtaining the virtual item data of the plurality of shards from the plurality of storage nodes; Decrypting the virtual item data of the plurality of slices to obtain decrypted virtual item data of the plurality of slices; The virtual item data of the plurality of fragments are merged according to a predefined merging rule to obtain complete virtual item data.

8. A virtual item storage system, characterized in that: Including encryption module, sharding module and storage module; The encryption module is used to obtain virtual item data and encrypt the virtual item data to obtain encrypted virtual item data; The slicing module is used to slice the encrypted virtual item data using a Rabin fingerprint algorithm to obtain a plurality of slices of virtual item data; The storage module is used to store the virtual item data of the plurality of shards on a plurality of distributed storage nodes by adopting a shard distribution strategy.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores computer program instructions executable by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute a virtual item storage method as described in any one of claims 1-7.

10. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, a virtual item storage method according to any one of claims 1 to 7 is implemented.