Anti-counterfeiting verification method and system for screenshot, terminal equipment and storage medium
By randomly selecting sub-screenshots in the screenshots and verifying their authenticity using multiple hashing algorithms, the screenshot verification problem is solved, which significantly improves the tamper-proofness and verification reliability of the screenshots.
Patent Information
- Application Number
- CN202411705995.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-14
AI Technical Summary
Verification of the authenticity and integrity of the screenshots is difficult to effectively resolve, resulting in possible legal disputes, economic losses and trust crises.
By generating the first screenshot and randomly selecting several sub-screenshots, multiple algorithms are used to calculate the hash value of the sub-screenshot, and record the coordinates, sizes and business ID of the sub-screenshots. The user enters the screenshot to be verified, obtains the corresponding sub-screenshot information based on the service ID, and uses the same type of algorithm to calculate the sub-screenshot hash value of the screenshot to be verified, and compares it to verify the authenticity of the screenshot.
Significantly enhances the tamper-proofness of screenshots and the reliability of verification, effectively resisting inverse speculation and forgery attacks by increasing verification complexity and using multiple hashing algorithms.
Smart Images

Figure CN119622702A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of picture verification, and in particular to a screenshot anti-counterfeiting verification method, system, terminal equipment and storage medium. Background Art
[0002] With the rapid development of Internet technology, visual information such as images and screenshots are increasingly used in daily life and work. Whether it is social media sharing, news reporting, advertising, or online transactions, contract signing, electronic credentials, etc., screenshots play an important role, such as electronic credentials in financial transactions, evidence materials in legal proceedings, screenshot proof of online voting, etc. If the screenshots are maliciously forged or tampered with, it may cause serious legal disputes, economic losses and trust crises. However, due to the easy copying and modification of digital content, the authenticity and integrity verification of screenshots has become a problem that needs to be solved urgently. Summary of the invention
[0003] In view of the above-mentioned defects, the purpose of the present invention is to propose a screenshot anti-counterfeiting verification method, system, terminal device and storage medium, aiming to improve the tamper-proof property of the screenshot and the reliability of verification.
[0004] To achieve this object, the present invention adopts the following technical solutions:
[0005] A screenshot anti-counterfeiting verification method, the anti-counterfeiting verification method comprising the following steps:
[0006] S1: Generate a first screenshot and a corresponding business ID, randomly select several sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots;
[0007] S2: The user inputs the screenshot to be verified, obtains the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculates the hash value of the sub-screenshot of the screenshot to be verified using the same algorithm based on the coordinates and size of the sub-screenshot;
[0008] S3: Compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
[0009] Preferably, in step S1, it also includes obtaining a current timestamp, encoding the current timestamp and adding it to the file name of the first screenshot;
[0010] The screenshot to be verified in step S2 is provided with a timestamp when the screenshot is generated. Before executing step S3, the timestamp of the first screenshot is also compared with the timestamp of the screenshot to be verified. If the comparison result is the same, step S3 is executed, otherwise the screenshot to be verified is false.
[0011] Preferably, in step S1, the size of the sub-screenshot is not larger than 1 / 10 of the size of the first screenshot.
[0012] Preferably, the method further includes obtaining the resolutions of the first screenshot and the screenshot to be verified, and determining whether the resolution of the first screenshot is equal to the resolution of the screenshot to be verified and whether the size of the first screenshot is equal to the size of the screenshot to be verified before executing step S3; if both are equal, executing step S3, otherwise the screenshot to be verified is false.
[0013] Preferably, before using an algorithm to calculate the hash value of the first screenshot or the sub-screenshot of the screenshot to be verified, the method includes:
[0014] Convert the first screenshot or the sub-screenshot of the screenshot to be verified into a Base64 string.
[0015] A screenshot anti-counterfeiting verification system is applied to the anti-counterfeiting verification method as described above, and the anti-counterfeiting verification system comprises:
[0016] A verification information generation module is used to generate a first screenshot and a corresponding business ID, randomly select a number of sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots;
[0017] The module for obtaining information to be verified is used for the user to input the screenshot to be verified, obtain the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculate the hash value of the sub-screenshot of the screenshot to be verified using the same type of algorithm based on the coordinates and size of the sub-screenshot;
[0018] The verification module is used to compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
[0019] A terminal device comprises: a memory, a processor and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the anti-counterfeiting verification method as described above.
[0020] A storage medium, characterized in that an anti-counterfeiting verification program is stored on the storage medium, and when the anti-counterfeiting verification program is executed by a processor, the steps of the anti-counterfeiting verification method described above are implemented.
[0021] One of the above technical solutions has the following advantages or beneficial effects:
[0022] By randomly selecting the position and size of the sub-screenshot, the complexity of anti-counterfeiting verification is increased. Even if an attacker obtains information about part of the sub-screenshot, if he cannot know the specific sub-screenshot area selected for each verification, the possibility of an attacker through reverse speculation and construction of forged screenshots is reduced; using multiple different hash algorithms to calculate the hash value of the same image, and requiring all hash values to match for verification to pass, can effectively resist vulnerabilities and collision attacks of a single algorithm, because even if one algorithm is cracked, other algorithms can still provide protection, which can significantly enhance security and reliability. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0024] Figure 1 It is a flowchart of the anti-counterfeiting verification method provided by an embodiment of the present invention;
[0025] Figure 2 It is a structural diagram of an anti-counterfeiting verification system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0027] In the present invention, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0028] like Figure 1 As shown, a preferred embodiment of the present invention, a screenshot anti-counterfeiting verification method, comprises the following steps:
[0029] S1: Generate a first screenshot and a corresponding business ID, randomly select several sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots;
[0030] In this step, a "first screenshot", that is, the original screenshot, is first generated, and then a unique business ID is assigned to this screenshot. The business ID is used to identify this screenshot for matching and querying during subsequent verification. In the first screenshot, several sub-screenshot areas are randomly selected. These sub-screenshots can be small areas of the screenshot, usually involving areas of different sizes, and these areas are randomly selected. For each selected sub-screenshot, multiple hash algorithms are used to calculate the hash value. The hash value is a digital fingerprint of a fixed length obtained by mathematical calculation of the image data, which can uniquely represent the image content. The robustness of anti-counterfeiting verification can be enhanced by using a variety of hash algorithms (such as MD5, SHA-1, SHA-256, etc.). Finally, the coordinates, size, hash value and corresponding business ID of these sub-screenshots are stored for subsequent verification. In actual applications, screenshot generation can use an operational screenshot tool or a screenshot module customized by the developer to generate high-quality images; sub-screenshot selection can select sub-screenshots according to a fixed ratio (such as 1 / 8 area of the screenshot) or in a completely random manner. Increasing randomness can reduce the possibility of reverse identification by attackers.
[0031] S2: The user inputs the screenshot to be verified, obtains the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculates the hash value of the sub-screenshot of the screenshot to be verified using the same algorithm based on the coordinates and size of the sub-screenshot;
[0032] The user uploads the screenshot to be verified and provides the corresponding business ID. The original screenshot information associated with it (i.e. the coordinates, size and hash value of the sub-screenshot) is queried based on the ID. The position and area corresponding to these sub-screenshots in the screenshot to be verified are then extracted, and the hash value of the sub-screenshot in the screenshot to be verified is calculated using the same hash algorithm. Since the specific position and size of each sub-screenshot have been recorded in S1, the corresponding area in the screenshot to be verified can be extracted based on this information for hash calculation. In actual applications, screenshot uploads can be done by users uploading screenshots through the platform, which can be implemented on mobile or PC terminals; data queries can be queried through a database or storage system based on the business ID to ensure search speed and accuracy; the hash calculation of the screenshot to be verified uses the same algorithm and method as S1 to ensure consistency.
[0033] S3: Compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
[0034] This step compares the hash value of the sub-screenshot in the screenshot to be verified with the hash value in the original screenshot. Since the content of the screenshot will not change, and the hash value is unique and consistent, if the calculated hash values are the same, it means that the content of the sub-screenshot has not been tampered with, and the screenshot verification is "true". If the hash value of one of the sub-screenshots does not match, it means that the screenshot has been tampered with or forged, and the verification result is "false".
[0035] By randomly selecting the position and size of the sub-screenshot, the complexity of anti-counterfeiting verification is increased. Even if an attacker obtains information about part of the sub-screenshot, if he cannot know the specific sub-screenshot area selected for each verification, the possibility of an attacker through reverse speculation and construction of forged screenshots is reduced; using multiple different hash algorithms to calculate the hash value of the same image, and requiring all hash values to match for verification to pass, can effectively resist vulnerabilities and collision attacks of a single algorithm, because even if one algorithm is cracked, other algorithms can still provide protection, which can significantly enhance security and reliability.
[0036] Preferably, in step S1, it also includes obtaining a current timestamp, encoding the current timestamp and adding it to the file name of the first screenshot;
[0037] The screenshot to be verified in step S2 is provided with a timestamp when the screenshot is generated. Before executing step S3, the timestamp of the first screenshot is also compared with the timestamp of the screenshot to be verified. If the comparison result is the same, step S3 is executed, otherwise the screenshot to be verified is false.
[0038] As a tool to identify the time when a screenshot is generated, the timestamp is obtained during the screenshot generation process, and then the time information is encoded and appended to the screenshot file name. The timestamp is a number directly related to time, which is unique and increases by time. Therefore, it can uniquely identify the screenshot generated at a certain moment or time period. For example, the timestamp can be directly added to the file name, such as 20231113123045_screenshot.png, where 20231113123045 is the time when the screenshot was generated. The purpose of this is to make the timestamp exist not only as a number, but also be bound to the file attributes of the screenshot to ensure that it can be accurately extracted and compared during verification. In the process of performing anti-counterfeiting verification, the timestamp of the screenshot to be verified is compared with the timestamp of the original screenshot. If the timestamps are consistent, the subsequent hash verification will continue; if the timestamps do not match, it means that the screenshot to be verified may have been modified or forged later, because its generation time is inconsistent with the original screenshot. At this time, the screenshot to be verified can be directly judged as invalid or fake screenshot, without the need to continue the subsequent hash comparison. The timestamp verification can ensure the timeliness of the screenshot and prevent the forger from tampering with the screenshot content and then re-saving and forging the generation time.
[0039] Preferably, in step S1, the size of the sub-screenshot is not larger than 1 / 10 of the size of the first screenshot.
[0040] In step S1, the size of the sub-screenshot is required to be no larger than 1 / 10 of the size of the first screenshot, that is, the resolution or pixel area of the sub-screenshot must be controlled within one tenth of the original screenshot. For example, if the size of the original screenshot is 1000×1000 pixels, then the maximum size of the sub-screenshot should not exceed 100×100 pixels. The sub-screenshot will crop a smaller area from the original screenshot to capture certain key parts or specific content in the screenshot. This design is to ensure that the sub-screenshot has higher accuracy and detail protection, and also to avoid the sub-screenshot being too large and affecting the verification performance or verification process.
[0041] Preferably, the method further includes obtaining the resolutions of the first screenshot and the screenshot to be verified, and determining whether the resolution of the first screenshot is equal to the resolution of the screenshot to be verified and whether the size of the first screenshot is equal to the size of the screenshot to be verified before executing step S3; if both are equal, executing step S3, otherwise the screenshot to be verified is false.
[0042] Resolution refers to the number of pixels of a screenshot (the pixel value of width and height), and the size of a screenshot usually refers to the storage size of an image file, usually in bytes. If the resolution and file size of two screenshots are exactly the same, it means that the content and compression format of the screenshots have not been changed or tampered with. In this embodiment, when judging whether the resolutions are equal, the resolutions of the first screenshot and the screenshot to be verified are compared to see if they are equal, and it is judged whether the width and height of the two screenshots are exactly the same. If the resolutions are different, it means that the size of the screenshot has changed, which means that the screenshot has been modified, scaled or cropped. At the same time, the file sizes of the first screenshot and the screenshot to be verified are compared to see if they are consistent. If the file sizes are equal, it means that the two screenshots are consistent in terms of compression rate, encoding method, etc. If the file sizes are inconsistent, it means that the screenshots have been compressed, cropped or modified in other forms. If both of the above conditions are met, that is, the resolution and size of the first screenshot are equal to those of the screenshot to be verified, step S3 can be continued to perform further verification (hash value comparison); if any of the conditions is not met (that is, the resolution or file size is different), it can be concluded that the screenshot to be verified is false, that is, the screenshot may be tampered with or forged, so the verification can be directly rejected and the screenshot can be marked as invalid or forged. This ensures that the screenshot to be verified has not been obviously tampered with or scaled at the initial level. Only screenshots that meet the consistency will enter a more detailed verification process, which can improve the efficiency and security of the verification process and avoid the risk of forgery caused by changes in screenshots.
[0043] Preferably, before using an algorithm to calculate the hash value of the first screenshot or the sub-screenshot of the screenshot to be verified, the method includes:
[0044] Convert the first screenshot or the sub-screenshot of the screenshot to be verified into a Base64 string.
[0045] Before calculating the hash value of the sub-screenshot of the first screenshot or the screenshot to be verified, the sub-screenshot is first converted into a Base64 string. The purpose is to unify the image data into a text format to avoid hash value differences caused by different image file formats (such as PNG, JPEG) or compression methods. The Base64-encoded string can ensure that screenshots with the same content are consistent when calculating hash values, thereby improving the accuracy of comparison and verification. In addition, the Base64 string is easy to store and transmit, so that image data can be more conveniently embedded in a text format for processing. In this way, the hash value calculation of the image content can be performed more stably to ensure the integrity and consistency of the image content.
[0046] A screenshot anti-counterfeiting verification system is applied to the anti-counterfeiting verification method as described above, and the anti-counterfeiting verification system comprises:
[0047] Verification information generation module 1, used to generate a first screenshot and a corresponding business ID, randomly select a number of sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots;
[0048] The to-be-verified information acquisition module 2 is used for the user to input the to-be-verified screenshot, obtain the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculate the hash value of the sub-screenshot of the to-be-verified screenshot using the same type of algorithm based on the coordinates and size of the sub-screenshot;
[0049] Verification module 3 is used to compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
[0050] This embodiment implements an anti-counterfeiting verification method and implementation process. Please refer to the above embodiments and will not be described in detail here.
[0051] In addition, an embodiment of the present invention further proposes a terminal device, which includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the anti-counterfeiting verification method as described above.
[0052] Since the program is configured to implement the steps of the anti-counterfeiting verification method as described above, the program at least has all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0053] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which an anti-counterfeiting verification program is stored. When the anti-counterfeiting verification program is executed by a processor, the steps of the anti-counterfeiting verification method described above are implemented.
[0054] Since the anti-counterfeiting verification program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0055] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0056] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A screenshot anti-counterfeiting verification method, characterized in that: The anti-counterfeiting verification method comprises the following steps: S1: Generate a first screenshot and a corresponding business ID, randomly select several sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots; S2: The user inputs the screenshot to be verified, obtains the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculates the hash value of the sub-screenshot of the screenshot to be verified using the same algorithm based on the coordinates and size of the sub-screenshot; S3: Compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
2. The anti-counterfeiting verification method according to claim 1, characterized in that: In step S1, it also includes obtaining a current timestamp, encoding the current timestamp and adding it to the file name of the first screenshot; The screenshot to be verified in step S2 is provided with a timestamp when the screenshot is generated. Before executing step S3, the timestamp of the first screenshot is also compared with the timestamp of the screenshot to be verified. If the comparison result is the same, step S3 is executed, otherwise the screenshot to be verified is false.
3. The anti-counterfeiting verification method according to claim 1, characterized in that: In step S1, the size of the sub-screenshot is not larger than 1 / 10 of the size of the first screenshot.
4. The anti-counterfeiting verification method according to claim 1, characterized in that: It also includes obtaining the resolution of the first screenshot and the screenshot to be verified, and before executing step S3, determining whether the resolution of the first screenshot is equal to the resolution of the screenshot to be verified and whether the size of the first screenshot is equal to the size of the screenshot to be verified. If they are equal at the same time, step S3 is executed, otherwise the screenshot to be verified is false.
5. The anti-counterfeiting verification method according to claim 1, characterized in that: Before using the algorithm to calculate the hash value of the first screenshot or the sub-screenshot of the screenshot to be verified, include: Convert the first screenshot or the sub-screenshot of the screenshot to be verified into a Base64 string.
6. A screenshot anti-counterfeiting verification system, applied to the anti-counterfeiting verification method according to any one of claims 1 to 5, characterized in that: The anti-counterfeiting verification system comprises: A verification information generation module is used to generate a first screenshot and a corresponding business ID, randomly select a number of sub-screenshots from the first screenshot, calculate multiple hash values of the sub-screenshots using multiple algorithms, and then record the coordinates and size, hash values and business IDs of the sub-screenshots; The module for obtaining information to be verified is used for the user to input the screenshot to be verified, obtain the coordinates, size and hash value of the corresponding sub-screenshot according to the business ID, and calculate the hash value of the sub-screenshot of the screenshot to be verified using the same type of algorithm based on the coordinates and size of the sub-screenshot; The verification module is used to compare the hash values of the sub-screenshots at the same position. If the comparison results are the same, the screenshot is true, otherwise it is false.
7. A terminal device, characterized in that: The terminal device comprises: a memory, a processor, and a program stored in the memory and executable on the processor, wherein the program is configured to implement the steps of the anti-counterfeiting verification method described in any one of claims 1 to 5.
8. A storage medium, characterized in that: The storage medium stores an anti-counterfeiting verification program, and when the anti-counterfeiting verification program is executed by the processor, the steps of the anti-counterfeiting verification method according to any one of claims 1 to 5 are implemented.