Hash algorithm-based multi-level access control method and device for digital collectibles
By performing multi-level processing and hash algorithm optimization on digital collection image files, multi-layered hybrid hash credentials are generated and stored on the blockchain. Encrypted authorization allows users to preview the credentials, solving the security and permission accuracy problems of traditional access control and achieving precise multi-level access control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2026-03-24
AI Technical Summary
Traditional data processing methods cannot classify digital collection data, resulting in insufficient security of access control and inaccurate permission division.
A multi-level access control method based on hash algorithms is adopted. Multi-level preview data is generated by multi-level processing of digital collection image files. Multi-level hybrid hash credentials are generated by combining cryptographic security and perceptual hash algorithms. After anti-speculation optimization, the credentials are stored on the blockchain with encryption. Decryption authorization is granted by issuing matching-layer optimized hash credentials according to user permissions.
This system enables users with different access permissions to accurately obtain digital collection preview data of corresponding precision, improving the security and credibility of access control and preventing unauthorized access and overreach of permissions.
Smart Images

Figure CN120951358B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital image processing technology, and in particular to a method and device for multi-level access control of digital collections based on hash algorithms. Background Technology
[0002] In reality, access scenarios for digital collectibles are widespread, and the security and accuracy of access permissions are crucial for protecting the value of collectibles, safeguarding user rights, and building trust in transactions. Data-driven access control is a core component, and its effective implementation is of great significance. Current technologies addressing access control issues for digital collectibles primarily employ data processing methods such as single hash verification and simple permission division. These methods play a role in closed, low-frequency collectible access scenarios, but as the application scope of digital collectibles expands, traditional data processing technologies reveal their limitations in complex access scenarios. Summary of the Invention
[0003] This application solves the technical problem that traditional data processing methods cannot classify and process collection data and generate secure matching access credentials, resulting in insufficient data security and inaccurate permission division.
[0004] The first aspect of this application provides a multi-level access control method for digital collectibles based on a hash algorithm. The method includes: inputting a digital collectible image file; performing multi-level processing on the digital collectible image file to obtain multi-level preview data, wherein the multi-level preview data includes at least first-level preview data, second-level preview data, and third-level preview data; obtaining a multi-layer hybrid hash certificate, wherein the multi-layer hybrid hash certificate is obtained by analyzing the multi-level preview data using a combination of at least two hash algorithms selected from a hash algorithm set; performing anti-speculation hash optimization on the multi-layer hybrid hash certificate to output a multi-layer optimized hash certificate; storing the multi-layer optimized hash certificate on the blockchain with encryption; recording a digital collectible preview request from the current preview user; verifying the identity information of the current preview user based on the digital collectible preview request; issuing a matching layer optimized hash certificate; and using the matching layer optimized hash certificate to decrypt and authorize the current preview user to preview the digital collectible image file.
[0005] A second aspect of this application provides an electronic device comprising: a memory for storing executable instructions; and a processor for implementing a hash-based multi-level access control method for digital collections when executing the executable instructions stored in the memory.
[0006] This application proposes one or more technical solutions, which have at least the following technical effects:
[0007] This application processes input digital artifact image files to generate first- to third-level preview data. It selects a combination of cryptographically secure and perceptual hash algorithms to analyze the multi-level preview data and obtain multi-layered hybrid hash credentials. After anti-speculation optimization through nested salt hashing, multi-layered optimized hash credentials are obtained and stored encrypted on the blockchain. Then, based on the user's preview request, the identity is verified, and a matching-layer optimized hash credential is issued for decryption authorization. This enables users with different permissions to accurately preview artifact data of corresponding precision, making multi-level access control of digital artifacts more secure and reliable. It achieves the technical effect of secure access control for users with different permissions to accurately obtain artifact preview data of corresponding precision. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a flowchart illustrating the multi-level access control method for digital collections based on hash algorithms provided in this application embodiment.
[0010] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0011] Explanation of reference numerals in the attached drawings: Input device 301, processor 302, memory 303, output device 304. Detailed Implementation
[0012] This application provides a method and device for multi-level access control of digital collections based on hash algorithms, which solves the technical problem that traditional data processing methods cannot perform hierarchical processing of collection data and generate secure matching access credentials, resulting in insufficient data security and inaccurate permission division.
[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0014] It should be noted that any variation of the terms "comprising" and "having" is intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or modules that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0015] Example 1, as Figure 1 As shown, a multi-level access control method for digital collections based on a hash algorithm is provided, wherein the method includes:
[0016] Step A100: Input a digital artifact image file, perform multi-level processing on the digital artifact image file to obtain multi-level preview data, wherein the multi-level preview data includes at least first-level preview data, second-level preview data and third-level preview data.
[0017] In this embodiment of the application, the digital collection is a unique digital certificate generated based on blockchain technology, corresponding to a specific work such as an image or video.
[0018] Specifically, the multi-level preview data includes at least three levels of preview data: color chart data for extracting the main color of the digital artifact image, color chart ratio data for quantifying the main color extraction, and equivalent data for perceptual blur equivalence processing. Specific steps are detailed in A110-A120. The process of performing multi-level processing on the digital artifact image file is detailed in steps A111-A117.
[0019] Step A200: Obtain a multi-level hybrid hash certificate, which is obtained by analyzing the multi-level preview data by selecting a combination of at least two hash algorithms from the hash algorithm set.
[0020] Optionally, the hash algorithm set includes cryptographically secure hash algorithms and perceptual hash algorithms. By selecting one algorithm from each of the two types and computing the first and second hash values of each level of preview data in parallel, and then combining the two hash values, a multi-layered hybrid hash certificate is obtained. The specific steps are explained in detail in A210-A230.
[0021] Step A300: Perform anti-speculation hash optimization on the multi-layer hybrid hash certificate to output a multi-layer optimized hash certificate, and store the multi-layer optimized hash certificate on the blockchain with encryption.
[0022] In one embodiment of this application, firstly, a nested salt hash structure is used to obtain a multi-layer random salt, and the multi-layer anti-speculation hash value of the multi-layer hybrid hash certificate is extracted at a preset ratio. Then, the multi-layer hybrid hash certificate is optimized by combining the two, thereby outputting a multi-layer optimized hash certificate. The specific steps are described in detail in A310-A330.
[0023] Next, the multi-layer optimized hash certificate is encrypted, and the encrypted certificate and the unique identifier of the digital collection image file are stored in the blockchain contract. The decryption authorization is implemented in the blockchain contract by using the matching layer optimized hash certificate. The specific steps are explained in detail in A340-A350.
[0024] Step A400: Enter the digital collection preview request of the current preview user, verify the identity information of the current preview user according to the digital collection preview request, issue a matching layer optimized hash certificate, and use the matching layer optimized hash certificate to decrypt and authorize the current preview user to preview the digital collection image file.
[0025] Specifically, firstly, the user enters a digital collection preview request through the user interaction terminal or interface. This request is an instruction initiated by the user, containing their own identity identifier (such as user account or bound mobile phone number) and the unique identifier of the target digital collection (such as collection UUID), used to clarify the specific collection the user wants to preview and their own identity association. Next, based on this request, an identity verification process is initiated, employing multi-factor authentication technology. This combines static verification elements submitted by the user, such as login password, with dynamic verification elements, such as SMS verification code or temporary email password. In some scenarios, biometric verification such as fingerprints or facial recognition can be added. This information is then compared with the legitimate user information pre-stored in the user identity database to complete the identity verification of the current preview user. This process aims to eliminate risks such as identity theft and unauthorized access, ensuring that the request initiator is a legitimate registered user.
[0026] Next, after successful identity verification, the user permission configuration table is queried to determine the preview permission level corresponding to the user. For example, ordinary users are only granted level one preview permission, while paid users are granted level two preview permission. Subsequently, the matching layer optimized hash certificate that matches the permission level is retrieved from the blockchain contract. The matching layer optimized hash certificate is a hash certificate generated by the aforementioned multi-layer hybrid hash certificate after anti-speculation optimization of nested salt hash and random position permutation, and is bound to a specific permission. Its hash value is associated with the decryption key of the preview data at the corresponding level.
[0027] Finally, the matching layer optimized hash certificate is sent to the user terminal. The user terminal uses the certificate to initiate a decryption request to the blockchain contract. The built-in permission verification logic of the contract compares the consistency between the sent matching layer optimized hash certificate and the corresponding level optimized hash certificate stored in the contract. If the comparison is successful, the decryption function is triggered, and the digital collection preview data of the corresponding level is decrypted using the key associated with the certificate. Finally, the user is authorized to preview the digital collection image file.
[0028] By clearly defining requirements through the input of preview requests, verifying user legitimacy through multi-factor authentication, issuing optimized hash credentials that match permissions, and completing decryption authorization through blockchain contracts, a coherent process is achieved, which effectively controls the access permissions of different users to digital collection preview data and prevents unauthorized access and overreach of permissions.
[0029] Furthermore, step A100 in the method provided in this application embodiment includes:
[0030] A110: The multi-level preview data includes at least first-level preview data, second-level preview data, and third-level preview data.
[0031] A120: Wherein, the first-level preview data is color card preview data obtained by extracting the main color of the digital collection image file, the second-level preview data is color card ratio preview data obtained by extracting and quantizing the main color of the digital collection image file, and the third-level preview data is equivalent preview data obtained by perceptual blur equivalent processing of the digital collection image file.
[0032] Specifically, after multi-level processing of digital artifact image files, multi-level preview data is obtained, including at least level one, level two, and level three preview data. Level one preview data is color chart preview data obtained after extracting the primary color from the digital artifact image file; the specific steps are explained in detail in A111-A112. Its purpose is to provide the most basic visual information of the digital artifact, displaying only the main colors of the artifact to meet the preview needs of users with the lowest access privileges. For example, it allows ordinary visitors to quickly understand the core color tone of the artifact, while avoiding the disclosure of more details. This lays the foundation for subsequent higher-level previews and ensures that key visual information of the artifact is not leaked during low-privilege access.
[0033] Secondary preview data is color chart proportion preview data obtained after extracting and quantizing the primary colors of digital artifact image files. Specific steps are explained in detail in A113-A114. Its purpose is to further enrich the information based on the primary preview data, not only presenting the artifact's primary colors but also including the pixel proportions of each primary color in the image. This meets the needs of users with advanced access, such as allowing potential buyers to gain a deeper understanding of the artifact's color composition and distribution, helping them determine if it meets their needs, while still preserving the artifact's specific outline and details, thus balancing preview depth with information security.
[0034] Level 3 preview data is equivalent preview data obtained after perceptually blurring the digital artifact image files. Specific steps are detailed in A115-A117. Its purpose is to provide blurred visual information that approximates the outline of the original digital artifact image, meeting the preview needs of high-privilege users. For example, it allows authorized users to understand the general shape and overall layout of the artifact without viewing the complete details of the original image. This processing ensures that high-privilege users have a deep understanding of the artifact while effectively preventing the leakage of complete information from the original digital artifact image. It is a key data support for high-privilege previews in multi-level access control.
[0035] Furthermore, step A110 in the method provided in this application embodiment includes:
[0036] A111: Scale the digital collection image file to obtain a scaled digital collection image.
[0037] A112: Use a clustering algorithm to extract RGB values from the scaled digital collection image, obtain key RGB values that are greater than a preset threshold from the RGB value extraction results, and convert the key RGB values into strings to obtain first-level preview data.
[0038] Optionally, firstly, an image scaling operation is performed on the input digital artifact image file to obtain a scaled digital artifact image. A bilinear interpolation method is used, which calculates the gray values of the four neighboring pixels around the target pixel and assigns different weights to the pixels based on their distance from the target pixel, and then performs a weighted average to determine the final value of the target pixel. For example, a digital artifact image with an original resolution of 1024×1024 can be scaled to a resolution of 256×256 using the bilinear interpolation method. This reduces the total number of pixels while preserving the main color features of the image, thereby reducing the computational complexity of subsequent data processing.
[0039] Next, the K-Means clustering algorithm is used to extract RGB values from the scaled digital artifact images. This algorithm first randomly initializes K cluster centers, where the value of K can be set according to the color richness of the digital artifact images, for example, to 5. Then, it calculates the Euclidean distance between the RGB value of each pixel in the scaled image and each cluster center. The Euclidean distance calculation logic is as follows: if the RGB value of a pixel is (R1, G1, B1) and the RGB value of a cluster center is (R2, G2, B2), then the Euclidean distance between them is... Next, the pixels are assigned to the nearest cluster, and the center value of each cluster is iteratively updated until the cluster center no longer changes significantly. For example, if the difference between the center values in two consecutive iterations is less than 0.1, then through this process, several classes of RGB values representing the main color of the image are extracted from the massive pixel RGB values of the scaled image. Finally, the RGB value extraction result is obtained, which is the center RGB value corresponding to the K clusters.
[0040] Next, the key RGB values greater than a preset threshold are obtained from the RGB value extraction results. The preset threshold needs to be determined based on the color distribution statistics of the scaled image. For example, by statistically analyzing the proportion of pixels contained in each cluster to the total number of pixels in the scaled image, a pixel proportion of ≥5% is set as the preset threshold. The RGB values corresponding to clusters with a pixel proportion exceeding this threshold are then filtered out. These RGB values are the key RGB values that play a dominant role in the visual effect of the image, thereby filtering out secondary RGB values with a very low proportion that do not affect the perception of the main color.
[0041] Finally, following a fixed format, the key RGB values are converted into strings to obtain the first-level preview data. First, the values of the three channels (Red R, Green G, Blue B) of each key RGB value (within the range of 0-255) are converted into two-digit hexadecimal numbers. For example, the RGB value of R=255, G=0, and B=0 is converted to FF0000. Then, the hexadecimal strings corresponding to all key RGB values are concatenated in descending order of the pixel proportion of the cluster to form a continuous text string such as FF000000FF00000000. This string is the first-level preview data.
[0042] Image scaling is achieved through bilinear interpolation, K-Means clustering algorithm is used to extract the RGB values of the main color, key RGB values are filtered based on a preset threshold of color distribution statistics, and strings are obtained by converting hexadecimal data to a fixed format. Ultimately, the goal is to generate lightweight, first-level preview data that is suitable for low-privilege preview requirements while preserving the main color characteristics of digital collections.
[0043] Furthermore, step A110 in the method provided in this application embodiment includes:
[0044] A113: Use a clustering algorithm to extract RGB values from the scaled digital collection image and obtain the RGB value extraction results.
[0045] A114: Calculate the ratio of the number of pixels in each RGB channel in the RGB value extraction result to obtain the RGB channel pixel ratio, and convert the RGB channel pixel ratio into a string to obtain the secondary preview data.
[0046] Specifically, firstly, the K-Means clustering algorithm is used to extract RGB values from the scaled digital collection image to obtain the RGB value extraction results. This process is the same as step A112, and will not be repeated here.
[0047] Next, the proportion of pixels in each RGB channel of the extracted RGB values is calculated to obtain the RGB channel pixel ratio, which is then converted into a string to obtain the secondary preview data. Specifically, the number of pixels in each cluster in the R, G, and B channels is first counted. For example, if a cluster contains 1500 pixels, with 450 in the R channel, 600 in the G channel, and 450 in the B channel, then the proportion of each channel's pixels to the total number of pixels in the cluster is calculated. In the example above, the R channel ratio = 450 / 1500 × 100% = 30%, the G channel ratio = 600 / 1500 × 100% = 40%, and the B channel ratio = 450 / 1500 × 100% = 30%. Following this logic, the RGB channel pixel ratios for all clusters are calculated. Finally, string conversion is performed: first, the % symbols for the R, G, and B channel ratios of each cluster are omitted, two decimal places are retained, and the data is converted to character form, such as 30% to 30.00 and 40% to 40.00. Then, the channel ratio strings of all clusters are concatenated in cluster order, separated by semicolons, for example: 30.00,40.00,30.00;29.80,45.50,24.70;32.20,28.30,39.50. This finally yields the secondary preview data.
[0048] Furthermore, step A110 in the method provided in this application embodiment includes:
[0049] A115: Perform grayscale conversion processing on the scaled digital collection image to obtain a grayscale collection image.
[0050] A116: Based on discrete cosine transform, the blur response of the grayscale collection image is extracted to obtain the mean blur response value which is less than the preset grayscale value.
[0051] A117: Based on the average fuzzy response of the preset grayscale value, the grayscale collection image is converted into a binary string to obtain three-level preview data.
[0052] Specifically, obtaining the Level 3 preview data requires scaling up the digital artifact image obtained through bilinear interpolation in step A111 above. For example, the original 1024×1024 resolution digital artifact image is scaled down to 256×256 resolution through bilinear interpolation. First, the scaled digital artifact image is converted to grayscale to obtain a grayscale artifact image. The weighted average method of image grayscale conversion is used. This method calculates the grayscale value by assigning different weights to the R, G, and B channels based on the differences in the human eye's perception sensitivity to red, green, and blue light channels. The specific formula is: Grayscale value = 0.299 × R value + 0.587 × G value + 0.114 × B value. For example, if the RGB value of a pixel in the scaled image is (255, 0, 0), substituting it into the formula, the grayscale value is calculated as 0.299×255+0.587×0+0.114×0≈76.25. After rounding, the grayscale value of the pixel is 76. Following this logic, all pixels in the scaled image are traversed, and the RGB value of each pixel is converted into a single grayscale value, ultimately resulting in a grayscale image of the collection containing only grayscale information and no color information.
[0053] Secondly, based on Discrete Cosine Transform (DCT), blur response extraction is performed on the grayscale artifact image to obtain the mean blur response value smaller than the preset grayscale value. The specific steps are as follows: First, the grayscale artifact image is divided into 8×8 pixel non-overlapping image blocks. For example, a 256×256 grayscale image can be divided into 32×32 8×8 image blocks. Second, a two-dimensional discrete cosine transform is performed on each 8×8 image block to convert the image block from the spatial domain to the frequency domain, obtaining a DCT coefficient matrix containing low-frequency and high-frequency coefficients. The low-frequency coefficients are located in the upper left corner of the matrix, representing the overall contour information of the image block, while the high-frequency coefficients are located in the lower right corner, representing detail information. Third, blur response extraction is performed, retaining the low-frequency coefficients in the upper left corner of the DCT coefficient matrix. The process involves several steps. For example, retaining the first 4×4 low-frequency coefficients and filtering out high-frequency coefficients to remove image details and simulate a blur effect. The average value of all coefficients within this region is then calculated, which is the blur response value of the image block. The fourth step involves setting a preset grayscale value. For example, based on the overall brightness distribution of the grayscale image, a preset grayscale value of 128 is set. All blur response values less than 128 are then filtered out, and the arithmetic mean of these filtered values is calculated to obtain the average blur response value. For example, if 50 blur response values are filtered out, and the sum is 5400, then the average blur response value = 5400 ÷ 50 = 108.
[0054] Finally, the grayscale image is converted into a binary string based on the average fuzzy response of the preset grayscale values. Specifically, each pixel of the grayscale image is iterated, and the grayscale value of each pixel is compared with the average fuzzy response. If the pixel grayscale value is greater than or equal to the average fuzzy response, the pixel is converted to the character 1; if the pixel grayscale value is less than the average fuzzy response, it is converted to the character 0. Following the pixel arrangement order of the grayscale image, usually from left to right and from top to bottom, the 0 or 1 characters corresponding to all pixels are concatenated sequentially to form a continuous binary string. For example, for a 3×3 grayscale image, the grayscale values of each pixel are compared with the average fuzzy response to obtain 1, 0, 1, 0, 1, 0, 1, 0, 1. After concatenation, the binary string 101010101 is formed, which is the level 3 preview data.
[0055] Furthermore, step A200 in the method provided in this application embodiment includes:
[0056] A210: The set of hash algorithms includes cryptographically secure hash algorithms and perceptual hash algorithms. The cryptographically secure hash algorithms include SHA-256, SHA-3, and BLAKE2 algorithms, and the perceptual hash algorithms include pHash, dHash, and aHash algorithms.
[0057] A220: The first hash value and the second hash value of each level of preview data in the multi-level preview data are calculated in parallel by selecting any cryptographically secure hash algorithm and any perceptual hash algorithm from the set of hash algorithms.
[0058] A230: Combine the first hash value and the second hash value to obtain a multi-layered hybrid hash certificate.
[0059] Specifically, first, the set of hash algorithms used for computation is determined, which includes two categories: cryptographically secure hash algorithms and perceptual hash algorithms. Among them, cryptographically secure hash algorithms emphasize data integrity and resistance to attacks: SHA-256 is a typical member of the SHA-2 hash function family, possessing cryptographic security characteristics such as collision resistance and resistance to perceptual attacks, and outputting a fixed 256-bit hash value; SHA-3 is the third-generation standard in the SHA series, employing a unique sponge structure that effectively resists existing cryptanalysis attacks and has strong compatibility; BLAKE2 is a hash algorithm based on the HAIFA iterative structure, ensuring the same security level as SHA-256 while offering faster computation speed and supporting variable output length. Perceptual hashing algorithms focus on perceptual similarity matching of image content: pHash (phase hashing) extracts low-frequency information by performing discrete cosine transform on the image to generate hash values, which can accurately identify images with similar content; dHash (difference hashing) generates hash values by comparing the grayscale differences of adjacent pixels, which has low computational complexity and fast speed; aHash (average hashing) generates hash values by comparing the grayscale values of the image with the global average value, which is suitable for fast image similarity retrieval.
[0060] Next, after determining the algorithm set, a dual-algorithm selection + parallel computation approach is adopted to process the multi-level preview data. First, one algorithm from each of the two categories is selected, for example, the cryptographically secure SHA-256 algorithm and the perceptual algorithm pHash algorithm. Then, a multi-threaded parallel computation mechanism is started to perform synchronous operations on the first, second, and third level preview data respectively: On the one hand, the SHA-256 algorithm is used to perform hash operations on each level of preview data, including the first level color card preview data, the second level color card ratio preview data, and the third level fuzzy equivalent preview data, converting the data into a fixed 256-bit binary hash value, which is the first hash value of the corresponding level, i.e., the cryptographically secure hash value; on the other hand, the pHash algorithm is used simultaneously to process the preview data of the same level. First, the preview data (such as color card data, ratio data) is converted into an image format suitable for pHash calculation, and then a 64-bit hash value is generated through steps such as discrete cosine transform and low-frequency coefficient extraction. This value is the second hash value of the corresponding level, i.e., the perceptual hash value. Throughout the process, the calculation of two hash values for each level of preview data is completed synchronously, avoiding efficiency loss caused by serial calculation, and ensuring that each level of data corresponds to a set of first hash value and second hash value.
[0061] After calculating the double hash value for each level of preview data, a multi-level hybrid hash certificate is generated using a fixed-format combination and hierarchical association method. First, the two hash values at a single level are combined using a string concatenation format of the first hash value + a special separator + the second hash value, with the separator distinguishing between the two types of hash values, thus obtaining the first-level combination result. The same logic is followed to combine the hash values of the second and third-level preview data, resulting in the second-level and third-level combination results. Finally, the third-level combination results are associated according to the hierarchical order of first-level-second-level-third-level, integrating them using a hierarchical identifier + combination result method. For example, L1: first-level combination result;; L2: second-level combination result;; L3: third-level combination result, where L1, L2, and L3 are hierarchical identifiers, and ;; is the hierarchical separator, ultimately forming a multi-level hybrid hash certificate containing double hash information from each level of preview data.
[0062] By inputting digital collection image files to generate multi-level preview data, a combination of cryptographic security and perceptual hash algorithms is selected to obtain multi-layered hybrid hash credentials, which are then optimized against speculation and uploaded to the blockchain. Based on the user's preview request, the identity is verified and a matching layer optimized hash credentials are issued for decryption authorization. This achieves the technical effect of enabling users with different permissions to accurately obtain collection preview data of corresponding precision.
[0063] Furthermore, step A300 in the method provided in this application embodiment includes:
[0064] A310: A nested salt hash structure is used to obtain a multi-level random salt.
[0065] A320: Extract the multi-layer anti-speculation hash values of the multi-layer hybrid hash certificate at a preset ratio.
[0066] A330: Optimize the multi-layer hybrid hash certificate based on the multi-layer anti-speculation hash value and the multi-layer random salt, and output the multi-layer optimized hash certificate.
[0067] In this embodiment, the nested salt hash structure is a multi-round salt value generation mechanism based on hierarchical independence. Each layer of salt value corresponds to the hash certificate of the first-level preview data, and the salt value generation process at each level is independent of each other.
[0068] In one embodiment, a nested salt hash structure is first used to obtain multi-level random salts. Specifically, multi-level random salts are generated by combining the nested salt hash structure with a CSPRNG (Cryptographically Secure Pseudo-Random Number Generator). In practice, the number of salt levels is first determined to be consistent with the number of levels in the multi-level preview data, corresponding to the first, second, and third levels of preview data, generating three levels of random salts. Then, the CSPRNG is activated to independently generate random numbers for each level of salt. For example, when generating the first-level random salt S1, an initial seed related to the first-level preview data is input, such as the string length of the first-level preview data, and a 256-bit binary random salt is generated using the CSPRNG's linear feedback shift register algorithm. When generating the second-level random salt S2, an independent initial seed related to the second-level preview data is input, such as the sum of the proportional values in the second-level preview data, and an unrelated 256-bit binary random salt is generated using the CSPRNG. The generation logic for the third-level random salt S3 is consistent with the first two levels, ensuring that S1, S2, and S3 are independent of each other and that the leakage of one level of salt will not lead to the speculation of other levels of salt, thus severing the path between higher-level salt values and lower-level data at the fundamental level.
[0069] Next, the step of extracting multi-layer anti-speculation hash values of multi-layer hybrid hash credentials at a preset ratio is performed. Through the hash value hierarchical truncation algorithm, combined with the preset ratio rule, which is based on the hash value fragment extraction range set at the preview data level, it is ensured that the fragments extracted at different levels have no overlap or inclusion relationship, thereby realizing the extraction of anti-speculation hash values. First, define the preset proportions: For example, for a 32-byte Level 1 hybrid hash certificate, the extraction proportion is set to the first 25%, i.e., the first 8 bytes; for a 32-byte Level 2 hybrid hash certificate, the extraction proportion is set to the middle 50%, i.e., bytes 9-24; for a 32-byte Level 3 hybrid hash certificate, the extraction proportion is set to the last 25%, i.e., bytes 25-32. Then, perform a truncation operation on each level of hybrid hash certificate. Taking a Level 1 hybrid hash certificate as an example, the first 8 bytes are truncated according to the first 25% proportion; this segment is the Level 1 anti-guessing hash value. For a Level 2 hybrid hash certificate, bytes 9-24 are truncated according to the middle 50% proportion; this is the Level 2 anti-guessing hash value. For a Level 3 hybrid hash certificate, bytes 25-32 are truncated according to the last 25% proportion; this is the Level 3 anti-guessing hash value. By truncating without overlap, it is ensured that the higher-level anti-guessing hash value does not contain any hash information from lower levels, preventing higher-level certificates from retrieving lower-level data.
[0070] Finally, multi-layer concatenated hash certificates are obtained by concatenating multi-layer anti-speculation hash values with multi-layer hybrid hash certificates. After fixed string processing, multi-layer standard concatenated hash certificates are obtained. Then, multi-layer random salts are used to randomly permutate the positions of the standard concatenated certificates, and finally, multi-layer optimized hash certificates are output. The specific steps are explained in detail in A331-A333.
[0071] Furthermore, step A330 in the method provided in this application embodiment includes:
[0072] A331: The multi-layer hybrid hash certificate is concatenated according to the multi-layer anti-speculation hash value to obtain the multi-layer concatenated hash certificate.
[0073] A332: Perform fixed string processing on the multi-layer concatenated hash certificate and output a multi-layer standard concatenated hash certificate.
[0074] A333: The multi-layered random salt is used to randomly permutate the positions of the multi-layered standard concatenated hash certificate, and the multi-layered optimized hash certificate is output.
[0075] Optionally, firstly, a multi-level concatenated hash certificate generation can be achieved based on a hierarchical correspondence concatenation algorithm. The core of this algorithm is to establish a one-to-one correspondence between multi-level anti-guessing hash values and multi-level hybrid hash certificates, concatenating them level by level to obtain the multi-level concatenated hash certificate. First, the hierarchical matching rules are clearly defined: a level-one anti-guessing hash value corresponds only to a level-one hybrid hash certificate, a level-two anti-guessing hash value corresponds only to a level-two hybrid hash certificate, and a level-three anti-guessing hash value corresponds only to a level-three hybrid hash certificate, ensuring that data from different levels are not cross-correlated. The concatenation operation follows a fixed order of anti-guessing hash value + hybrid hash certificate. This order is the standard logic for hash certificate concatenation in the industry and avoids hierarchical confusion during subsequent parsing. For example, for level-one data, the level-one anti-guessing hash value is used as a prefix, and the level-one hybrid hash certificate as a suffix, and the integration is completed using a string concatenation function. Level-two and level-three data are concatenated according to the same logic, ultimately obtaining an independent combination of anti-guessing hash value and hybrid hash certificate for each level, i.e., a multi-level concatenated hash certificate. Strict control over the hierarchical correspondence in the above process is the foundation for avoiding correlation between high-level data and low-level data and preventing speculation.
[0076] Next, a multi-level standard concatenated hash certificate is generated using a string length standardization algorithm. Based on this algorithm, the multi-level concatenated hash certificates are processed to achieve a unified format, outputting a multi-level standard concatenated hash certificate. The core purpose is to eliminate length differences between different levels of concatenated certificates, providing a consistent data foundation for random position permutations in subsequent steps. First, the standardization target length is determined: typically based on a preset hash certificate processing specification, such as the industry-common 512 bytes or 1024 bytes, or by selecting the maximum length among all levels of concatenated certificates as the target length, ensuring no data loss due to length truncation. During processing, if the length of a certain level of concatenated certificate is less than the target length, a zero-padding mechanism is used, i.e., padding with 0x00 formatted characters at the end of the certificate until the target length is reached; if the length of a certain level of concatenated certificate is greater than the target length, a safe truncation mechanism is used, i.e., only the first N characters of the certificate are retained, where N is the target length. The truncation rules must be pre-defined in the algorithm to ensure consistent processing logic each time. For example, if the target length is set to 512 bytes, and the length of the first-level concatenated certificate is 480 bytes, then 32 bytes of zero-padding characters are added; if the length of the third-level concatenated certificate is 550 bytes, then it is truncated to the first 512 bytes. Finally, all levels of concatenated certificates are uniformly 512 bytes, forming a multi-level standard concatenated hash certificate with a consistent format.
[0077] Finally, a salt-driven permutation algorithm is used to output multi-level optimized hash credentials. Specifically, this algorithm uses multi-level random salts as the core driving force to perform random position permutations on multi-level standard concatenated hash credentials, ultimately outputting multi-level optimized hash credentials. The core principle is to enhance the credential's resistance to speculation through randomness. First, a hierarchical correspondence between salt values and credentials is established: first-level random salts are used only for first-level standard concatenated hash credentials, second-level random salts are used only for second-level standard concatenated hash credentials, and third-level random salts are used only for third-level standard concatenated hash credentials, ensuring that the salt value's driving force on the credentials is unique. The permutation operation consists of two steps: First, the salt value is converted into a position index. The random salt (binary format) at each level is converted into a series of decimal position indices according to fixed rules. For example, every 8 bits of binary data are converted into a decimal number of 0 minus the target length, serving as the position identifier for the voucher characters. Second, position adjustments are performed according to the indices. Based on the converted position index sequence, the character positions in the standard concatenated voucher are rearranged. For example, if the index sequence is 5→23→10, the 5th character is swapped with the 23rd character, and the 10th character is swapped with the next character specified by the index, until the entire index sequence is executed. Each level of permutation relies independently on the corresponding level's random salt, and the randomness of the salt value directly determines the unpredictability of the permutation result, ultimately resulting in a multi-layered optimized hash voucher with robust anti-speculation capabilities.
[0078] By concatenating multi-layer anti-speculation hash values with multi-layer hybrid hash credentials, processing the concatenated results into a fixed string, and then using multi-layer random salts to randomly permutate the positions of the standard concatenated credentials, the technical effect of improving the anti-speculation of multi-layer hybrid hash credentials and generating secure and usable multi-layer optimized hash credentials is achieved.
[0079] Furthermore, step A300 in the method provided in this application embodiment includes:
[0080] A340: Encrypt the multi-layer optimized hash certificate, and store the encrypted multi-layer optimized hash certificate and the unique identifier of the digital collection image file in a blockchain contract.
[0081] A350: Utilize the matching layer to optimize the hash credentials for decryption authorization in the blockchain contract.
[0082] In this embodiment of the application, the blockchain contract is a carrier used to store encrypted multi-layer optimized hash certificates and unique identifiers for digital collection image files, and also supports decryption authorization operations within this contract using matching layer optimized hash certificates.
[0083] Optionally, when encrypting the multi-layer optimized hash certificate for on-chain storage, the AES-256 symmetric encryption algorithm is first used to encrypt the multi-layer optimized hash certificate. AES-256 has 128-bit data block encryption and a 256-bit key length, which can provide high-strength encryption protection, effectively resist attack methods such as cracking, and ensure the security of the multi-layer optimized hash certificate during transmission and storage. Specifically, the multi-layer optimized hash certificate (plaintext) is first divided into 128-bit data blocks. If the certificate length is less than 128 bits, it is padded according to the AES padding rule. Then, based on the 256-bit initial key, the round keys required for 14 rounds of encryption are generated through the key expansion algorithm. Subsequently, 14 rounds of encryption are performed: the initial round adds the plaintext block with the first round key, i.e., performs an XOR operation; the middle 12 rounds perform byte substitution in sequence, i.e., replace each byte in the block with an S-box; row shifting, i.e., performs a circular shift on each row in the block; column mixing, i.e., performs a linear transformation on each column in the block; and round key addition. The last round omits column mixing and only performs byte substitution, row shifting, and round key addition, finally outputting the encrypted multi-layer optimized hash certificate.
[0084] Next, a unique identifier is generated for each digital artifact's image file. This identifier uses a UUID (Universally Unique Identifier) generation mechanism, combining multiple elements such as timestamps, device MAC addresses, and random numbers to ensure that each digital artifact has a unique identifier, preventing confusion between different artifacts. Subsequently, the encrypted multi-layered optimized hash certificate and the generated UUID are stored together in a blockchain contract. The blockchain contract used here is a smart contract, such as a Solidity smart contract based on the Ethereum platform. These contracts have the characteristics of automatic execution and immutability, establishing a mapping between the encrypted certificate and the UUID and storing it permanently. At the same time, relying on the distributed ledger characteristics of the blockchain, it prevents data from being maliciously tampered with or deleted, ensuring the security and traceability of the certificate storage.
[0085] Subsequently, when decryption authorization is required, the automated authorization logic of the blockchain contract, combined with the matching layer optimized hash certificate, enables permission verification and decryption. When a user initiates a digital collectible preview request and passes identity verification, a matching layer optimized hash certificate matching the user's permissions is issued. The user submits this certificate to the blockchain contract, which first performs a hash value comparison verification. This involves extracting the hash value of the matching layer optimized hash certificate and performing a consistency check with the hash value of the corresponding level hash certificate pre-stored in the contract. If the check passes, the certificate is confirmed as valid. Then, the smart contract calls a built-in decryption function. This function retrieves the AES-256 key used to encrypt the multi-layer optimized hash certificate from the contract's secure storage area and decrypts the encrypted multi-layer optimized hash certificate. After decryption, the contract automatically authorizes the user to access the corresponding level of digital collectible preview data based on the user's permissions. The entire process requires no manual intervention, leveraging the automation features of smart contracts to achieve efficient and secure decryption authorization while avoiding the risks of key leakage or tampering with the authorization process.
[0086] By encrypting multi-layer optimized hash credentials and storing them along with the unique identifier of the digital collection image file in a blockchain contract, and simultaneously using the matching layer optimized hash credentials for decryption authorization in the blockchain contract, the technical effect of ensuring the storage security of multi-layer optimized hash credentials and achieving precise decryption authorization according to permissions is achieved.
[0087] In summary, the multi-level access control method for digital collections based on hash algorithms provided in this application has the following technical effects:
[0088] This application obtains multi-level preview data and multi-layered hybrid hash credentials by inputting digital artifact image files and performing multi-level processing, including RGB value extraction via clustering algorithms, fuzzy response extraction via discrete cosine transform, and combined hash algorithm calculations. The multi-layered hybrid hash credentials are then optimized for anti-speculation hashing and stored encrypted on the blockchain. Based on the current preview user's digital artifact preview request and identity verification results, a matching layer optimized hash credentials are issued for adjustment. This achieves multi-level access control for digital artifacts, accurately authorizing users with different permissions to preview corresponding levels of digital artifact data. This makes the security and accuracy of access control more reliable, achieving the technical effect of secure access control for users with different permissions to accurately obtain corresponding precision artifact preview data.
[0089] Example 2, as Figure 2 As shown, based on the same inventive concept as in Embodiment 1 above, this application provides an electronic device, the electronic device comprising:
[0090] The memory 303 is used to store executable instructions; the processor 302 is used to implement a multi-level access control method for digital collections based on a hash algorithm when executing the executable instructions stored in the memory 303.
[0091] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, showing a block diagram of an exemplary electronic device suitable for implementing the embodiments of the present invention. Figure 2 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of the present invention. This electronic device is in the form of a general-purpose computing device, and its components may include, but are not limited to, an input device 301, a processor 302, a memory 303, and an output device 304. The processor 302 may be one or more; the memory 303 may include a computer-readable medium and at least one program product having a set (at least one) of program modules configured to perform the functions of the embodiments of this application.
[0092] The memory 303 shown in this embodiment of the invention can be any combination of one or more computer-readable media. The computer-readable storage media can be, but is not limited to, infrared, semiconductor systems, devices or components, or any combination thereof, for storing software programs, computer-executable programs and modules, such as the program instructions / modules corresponding to the hash algorithm-based multi-level access control method for digital collections in this embodiment of the invention. The processor 302 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 303, thereby realizing the above-mentioned hash algorithm-based multi-level access control method for digital collections.
[0093] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0094] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of this application and its equivalents, this application also intends to include such modifications and variations.
Claims
1. A multi-level access control method for digital collections based on hash algorithms, characterized in that, The method includes: Input a digital artifact image file, perform multi-level processing on the digital artifact image file to obtain multi-level preview data, the multi-level preview data including at least first-level preview data, second-level preview data and third-level preview data; A multi-level hybrid hash certificate is obtained by analyzing the multi-level preview data using a combination of at least two hash algorithms selected from a set of hash algorithms. The multi-layer hybrid hash certificate is subjected to anti-speculation hash optimization to output a multi-layer optimized hash certificate, and the multi-layer optimized hash certificate is stored and encrypted on the blockchain. Enter the digital collection preview request of the current preview user, verify the identity information of the current preview user according to the digital collection preview request, issue a matching layer optimized hash certificate, and use the matching layer optimized hash certificate to decrypt and authorize the current preview user to preview the digital collection image file; The method for performing anti-speculation hash optimization on the multi-layer hybrid hash certificate to output a multi-layer optimized hash certificate includes: A nested salt hash structure is used to obtain multi-level random salts; Extract the multi-layer anti-speculation hash values of the multi-layer hybrid hash certificate at a preset ratio; Based on the multi-layer anti-speculation hash value and the multi-layer random salt, the multi-layer hybrid hash certificate is optimized to output a multi-layer optimized hash certificate; The method for optimizing the multi-layer hybrid hash certificate based on the multi-layer anti-speculation hash value and the multi-layer random salt to output a multi-layer optimized hash certificate includes: The multi-layer hybrid hash certificate is concatenated according to the multi-layer anti-speculation hash value to obtain the multi-layer concatenated hash certificate. The multi-layer concatenated hash certificate is processed with a fixed string to output a multi-layer standard concatenated hash certificate; The multi-layer random salt is used to randomly permutate the positions of the multi-layer standard concatenated hash certificate, and a multi-layer optimized hash certificate is output.
2. The method as described in claim 1, characterized in that, The multi-level preview data includes at least first-level preview data, second-level preview data, and third-level preview data; The first-level preview data is color chart preview data obtained by extracting the primary color from the digital collection image file; the second-level preview data is color chart ratio preview data obtained by extracting and quantizing the primary color from the digital collection image file; and the third-level preview data is equivalent preview data obtained by perceptually blurring the digital collection image file.
3. The method as described in claim 2, characterized in that, Methods for obtaining first-level preview data include: The digital artifact image file is scaled up to obtain a scaled digital artifact image; Clustering algorithms are used to extract RGB values from the scaled digital collection image. Key RGB values greater than a preset threshold are obtained from the extracted RGB values. The key RGB values are then converted into strings to obtain first-level preview data.
4. The method as described in claim 3, characterized in that, Methods for obtaining secondary preview data include: The RGB values of the scaled digital artifact image are extracted using a clustering algorithm to obtain the RGB value extraction results. The number of pixels in each RGB channel in the RGB value extraction result is calculated proportionally to obtain the RGB channel pixel ratio. The RGB channel pixel ratio is then converted into a string to obtain the secondary preview data.
5. The method as described in claim 3, characterized in that, Methods for obtaining level 3 preview data include: The scaled digital artifact image is converted to grayscale to obtain a grayscale artifact image; The grayscale collection image is subjected to fuzzy response extraction based on discrete cosine transform to obtain the mean fuzzy response value that is less than the preset grayscale value. The grayscale collection image is converted into a binary string based on the mean of the fuzzy response to obtain three-level preview data.
6. The method as described in claim 1, characterized in that, The multi-level hybrid hash certificate is obtained by analyzing the multi-level preview data through a combination of at least two hash algorithms selected from a set of hash algorithms. The method includes: The set of hash algorithms includes cryptographically secure hash algorithms and perceptual hash algorithms. The cryptographically secure hash algorithms include SHA-256, SHA-3, and BLAKE2 algorithms, and the perceptual hash algorithms include pHash, dHash, and aHash algorithms. The first hash value and the second hash value of each level of preview data in the multi-level preview data are calculated in parallel by selecting any cryptographically secure hash algorithm and any perceptual hash algorithm from the set of hash algorithms; The first hash value and the second hash value are combined to obtain a multi-layered hybrid hash certificate.
7. The method as described in claim 1, characterized in that, The method for storing and encrypting the multi-layered optimized hash certificate on the blockchain includes: The multi-layer optimized hash certificate is encrypted, and the encrypted multi-layer optimized hash certificate and the unique identifier of the digital collection image file are stored in a blockchain contract. The matching layer optimizes the hash credentials for decryption authorization in the blockchain contract.
8. An electronic device, characterized in that, The electronic device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the multi-level access control method for digital collections based on a hash algorithm as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Data processing system and method for digital collection management
CN117171413A
Block chain data processing method, device and equipment, medium and program product
CN117522398A