Verification methods, electronic devices, and storage media based on dummy ciphers
By combining sliding window hashing and salted hashing with reinforcement learning to dynamically update the recommended phantom length table, the problems of poor security and user personalization needs in traditional phantom password verification are solved, achieving highly secure and convenient phantom password verification.
Patent Information
- Application Number
- CN202611397285.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional decoy password verification schemes require storing plaintext passwords on the server, resulting in poor security and an inability to dynamically adjust the decoy length, thus failing to meet the personalized needs of different users.
By using a sliding window to extract substrings from the input string for hashing, and introducing a salted hashing mechanism and reinforcement learning, the recommended table for virtual bit length is dynamically updated to avoid storing plaintext passwords, adapt to user input habits, and improve security and convenience.
It achieves high-security verification without storing plaintext passwords, dynamically adjusts the phantom length to adapt to different user needs, and improves user experience and security.
Smart Images

Figure CN123122844A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent security and cryptographic authentication technology, specifically to verification methods, electronic devices and storage media based on dummy ciphers. Background Technology
[0002] With the rapid development of smart home and IoT technologies, access control devices have been widely used in identity authentication scenarios such as smart locks, community access control, and shared lockers. Users authenticate themselves by entering a preset password to obtain corresponding access permissions. However, traditional fixed password input methods have significant security vulnerabilities. In actual use, attackers can easily steal a user's complete password through methods such as peeping behind their shoulder, hidden camera recording, or keystroke analysis. Once the password is leaked, the user's property and personal safety will be seriously threatened.
[0003] To effectively prevent passwords from being directly snooped on, decoy password technology has been proposed and gradually applied. However, traditional decoy password verification schemes generally have the following drawbacks: the verification process usually requires storing the user's plaintext password on the server side in order to locate and extract the target password from the input string containing the decoy for comparison. This approach means that once the backend database is compromised, all users' plaintext passwords will be directly exposed, causing a large-scale, irreversible security incident. Therefore, there is an urgent need for a scheme that can complete decoy password verification without storing the plaintext password. Summary of the Invention
[0004] This application provides a verification method, electronic device, and storage medium based on dummy passwords to solve the problem of poor security caused by storing plaintext passwords for dummy password verification.
[0005] Firstly, this application provides a verification method based on a dummy cipher, the method comprising: The system acquires an input string collected by the access control device, the input string consisting of a user password and a decoy character; the decoy character includes at least one, which is located before and / or after the user password in the input string; The size of the sliding window is determined based on the length of the target password, and a preset movement step is used. The sliding window is moved over the input string according to the movement step to obtain a cropped substring to be verified with the size of the sliding window. The target password is the password that the user has preset for authentication. Perform a hash operation on the substring to be verified to obtain the hash value to be verified; Obtain the target hash value corresponding to the pre-stored target password; The hash value to be verified and the target hash value are compared to determine whether they match. When the hash value to be verified matches the target hash value, the authentication result of the input string is confirmed as successful.
[0006] The method provided in this application uses a sliding window to extract a substring from an input string containing dummy characters, and then performs a hash operation on the extracted substring and compares it with a pre-stored target hash value. Since only the hash value of the target password is stored, rather than the plaintext, even if the database is leaked, the user's password cannot be recovered, fundamentally eliminating the risk of password exposure due to data leakage. Simultaneously, the sliding window's traversal method automatically adapts to the presence of dummy characters, eliminating the need to pre-remove dummy characters, simplifying the verification process, and achieving effective verification of dummy passwords while ensuring high security.
[0007] In one possible implementation, performing a hash operation on the substring to be verified to obtain a hash value to be verified includes: Obtain the pre-stored salt value corresponding to the target password; The substring to be verified is concatenated with the salt value to obtain a concatenated string; Perform a hash operation on the concatenated string to obtain the hash value to be verified.
[0008] The method provided in this application introduces a user-specific random salt value into the hash calculation, ensuring that even if two users set the same password, their stored hash values will be completely different. This salted hashing mechanism effectively resists rainbow table attacks and pre-computed dictionary attacks, significantly increasing the difficulty for attackers to reverse engineer passwords using hash values, and further enhancing the security of password storage.
[0009] In one possible implementation, the method further includes: The length of the phantom character in the input string is determined as the actual phantom length; Obtain the target recommended length range; the target recommended length range is the length range of the phantom characters recommended when the user inputs the input string; Determine whether the actual virtual length belongs to the target recommended length range to obtain a judgment result; The virtual length recommendation table corresponding to the user is updated based on the judgment result and the authentication result of the input string; the virtual length recommendation table includes multiple recommendation combinations, each recommendation combination includes a recommendation length range and a recommendation value corresponding to the recommendation length range; the larger the recommendation value, the greater the probability that the corresponding recommendation length range will be recommended.
[0010] The method provided in this application records the actual phantom length and corresponding authentication result for each user authentication, and dynamically updates the phantom length recommendation table accordingly. This mechanism can continuously learn the user's input habits, allowing the recommended phantom length range to gradually adapt to the user's personalized needs, meeting the needs of different users and effectively improving the user's input experience while ensuring security.
[0011] In one possible implementation, updating the virtual length recommendation table corresponding to the user based on the judgment result and the authentication result of the input string includes: Based on the judgment result and the authentication result of the input string, an instant reward value is calculated; the instant reward value is used to reflect the degree of fit between the target recommendation length range and the user's current authentication. Update the target recommendation value in the target recommendation combination based on the instant reward value.
[0012] The method provided in this application introduces a reward mechanism from reinforcement learning to quantify the authentication result into a specific reward value, and uses this reward value to iteratively update the recommendation value of the corresponding recommendation combination in the recommendation table. This feedback-based update method enables the recommendation strategy to be continuously optimized as the number of times the user uses the service increases, gradually converging to the most suitable balance point between safety and convenience for the user, thus achieving intelligent and adaptive recommendation of dummy length.
[0013] In one possible implementation, calculating the instant reward value based on the judgment result and the authentication result of the input string includes: The adoption reward value is calculated based on the judgment result; the adoption reward value is determined based on the deviation between the actual virtual length and the midpoint value of the target recommended length interval, and the smaller the deviation, the larger the adoption reward value. If the authentication result of the input string is successful, then the first reward value is calculated based on the adoption reward value and the actual virtual length; If the authentication result of the input string is authentication failure, then a second reward value is calculated based on the actual phantom length, and the second reward value is less than the first reward value; The first reward value or the second reward value is determined as the instant reward value.
[0014] The method provided in this application establishes different reward benchmarks for successful and failed authentication scenarios, and provides additional adoption rewards for behaviors that follow the target recommended length range, thus constructing a clear guiding signal. This reward mechanism encourages users to use the recommended decoy length range as much as possible while ensuring successful authentication, and at the same time, by penalizing failed behaviors, it tends to recommend a more reliable recommended length range, thereby improving security while continuously optimizing the user experience.
[0015] In one possible implementation, before obtaining the user input string collected by the access control device, the method further includes: Obtain a recommended virtual length table, select a target recommended length range from the recommended virtual length table, and display the target recommended length range through the access control device.
[0016] The method provided in this application offers clear operational guidance to users by proactively displaying the recommended range of phantom characters before user input. Users no longer need to manually determine how many phantom characters to add, reducing the cognitive burden and ensuring that the recommendation strategy effectively guides user behavior. This allows the system to collect data that better aligns with the strategy's expectations, accelerating the personalized learning process.
[0017] In one possible implementation, the method further includes: If the hash value to be verified and the target hash value do not match, the authentication result of the input string is confirmed as authentication failure.
[0018] The method provided in this application explicitly determines authentication failure when hash value comparisons are inconsistent, establishing a clear logic for determining authentication results. This determination method avoids misjudgments caused by input errors, provides an accurate data foundation for subsequent reward calculations and policy updates, and ensures the reliability of the entire verification process and the effectiveness of closed-loop feedback.
[0019] In one possible implementation, the size of the sliding window is the length of the target password, and the movement step is 1.
[0020] The method provided in this application precisely sets the sliding window size to the target password length and traverses with a step size of 1, ensuring that every possible password substring in the input string is completely covered without omission. This setting guarantees that as long as the user-input target password is complete, regardless of whether the dummy character is before, after, or both before and after it, the system can accurately extract the password substring by sliding the window, thereby achieving highly reliable dummy password verification without storing plaintext.
[0021] Secondly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the verification method based on the dummy password described in the first aspect or any corresponding embodiment.
[0022] Thirdly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the verification method based on a dummy cipher as described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this application, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a flowchart of a verification method based on a dummy cipher according to an embodiment of this application; Figure 3 This is a schematic diagram of the authentication process according to an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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 some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0027] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, the verification system based on dummy passwords may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.
[0028] The terminal device can be an access control device, specifically a smart lock, a community unit access control system, a shared locker, an office access control terminal, or other devices with password input functionality; it can also be a smartphone, tablet, laptop, PDA, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranets, local area networks, wide area networks, mobile communication networks, and combinations thereof.
[0029] The relevant decoy password verification schemes generally suffer from the following drawbacks: First, the verification process typically requires storing the user's plaintext password on the server side to locate and extract the target password from the input string containing the decoy bit for comparison. This approach means that once the backend database is compromised, all users' plaintext passwords will be directly exposed, causing a large-scale, irreversible security incident. Second, the decoy bit length in these schemes is usually a fixed value and cannot be dynamically adjusted, such as based on user habits or specific usage times. This results in overly cumbersome input in high-frequency usage scenarios, while the protection strength may be insufficient in high-risk scenarios, failing to achieve a dynamic balance between security and user experience. Third, these schemes lack the ability to learn and adapt to individual users, employing a uniform static strategy for all users, which fails to meet the differentiated needs of different users for input convenience and security.
[0030] According to an embodiment of this application, a verification method based on a dummy cipher is provided to solve the above-mentioned problems. It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0031] This embodiment provides a verification method based on dummy ciphers. Figure 2 This is a flowchart of a verification method based on a dummy cipher according to an embodiment of this application, as shown below. Figure 2 As shown, the process includes the following steps: S201: Obtain the input string collected by the access control device from the user input string.
[0032] In this embodiment, the input string consists of a user password and dummy characters. The dummy characters include at least one and are positioned before and / or after the user password in the input string.
[0033] In this embodiment, the access control device can display a target recommended length range. The target recommended length range is a range of dummy character lengths dynamically recommended by the system through a reinforcement learning model based on factors such as user history, device security level, and time period.
[0034] In this embodiment, access control equipment refers to a smart terminal with password input functionality, including but not limited to smart door locks, community unit access control systems, shared lockers, and office access control terminals. The device collects the string input by the user via a keyboard or touchscreen and forwards the authentication request to the smart center (gateway) for processing. The device itself does not store any user credential information; it is only responsible for input collection and result feedback.
[0035] In this embodiment, the access control device displays a target recommended length range, which is the recommended number of digits for the phantom characters used by the user. For example, the target recommended length range is "recommended phantom length of 5 to 8 digits", including "5" and "8". The actual length of the phantom characters entered by the user (actual phantom length) may or may not fall within the target recommended length range.
[0036] S202: Determine the size of the sliding window based on the length of the target password, and preset the movement step. Move the sliding window over the input string according to the movement step to obtain a cropped substring to be verified with the size of the sliding window.
[0037] In this embodiment, the target password is a password pre-set by the user for authentication. The target password typically consists of numbers, letters, or symbols. The system only stores the hash value and salt value of the target password, and does not store the plaintext password.
[0038] In this embodiment, the size of the sliding window is the length of the target password, and the movement step is 1.
[0039] In this embodiment, the system moves a sliding window with a step size of 1, starting from the beginning of the input string, and each time extracts a substring covered by the sliding window as the substring to be verified. The traversal process continues until the sliding window reaches the end of the input string, or until a match is found, ensuring that all possible substrings are covered. Each substring is then used as the substring to be verified, and steps S203 to S205 determine whether the hash value to be verified matches the target hash value.
[0040] This embodiment precisely sets the sliding window size to the target password length and iterates with a step size of 1, ensuring that every possible password substring in the input string is completely covered without omission. This setting guarantees that as long as the user-input target password is complete, regardless of whether the dummy character is before, after, or both before and after it, the system can accurately extract the password substring by sliding the window, thus achieving highly reliable dummy password verification without storing plaintext.
[0041] S203: Perform a hash operation on the substring to be verified to obtain the hash value to be verified.
[0042] In this embodiment, the salt value corresponding to the pre-stored target password is obtained. The substring to be verified is concatenated with the salt value to obtain a concatenated string. A hash operation is performed on the concatenated string to obtain the hash value to be verified.
[0043] In this embodiment, the relevant data is stored in the user master database of the smart center. For example, the salt value corresponding to the target password is stored in the user information table of the PostgreSQL database, and can be retrieved from the table by user ID. The salt value refers to a random string generated by the system for the user. Different users have different salt values, and the salt value for the same user is regenerated when the password is set or reset.
[0044] This embodiment introduces a user-specific random salt value into the hash calculation, ensuring that even if two users set the same password, their stored hash values will be completely different. This salted hashing mechanism effectively resists rainbow table attacks and pre-computed dictionary attacks, significantly increasing the difficulty for attackers to reverse engineer passwords using hash values, and further enhancing the security of password storage.
[0045] S204: Retrieve the target hash value corresponding to the pre-stored target password.
[0046] In this embodiment, the target password is concatenated with the salt value to obtain the target concatenated string. A hash operation is then performed on the target concatenated string to obtain the target hash value corresponding to the target password.
[0047] S205: Compare the hash value to be verified with the target hash value to determine whether the hash value to be verified and the target hash value match.
[0048] In this embodiment, the hash value to be verified and the target hash value are compared to see if they are completely consistent.
[0049] If the hash value to be verified is exactly the same as the target hash value, the hash value to be verified and the target hash value are determined to match, i.e., the match is successful. Alternatively, if the hash value to be verified and the target hash value are not the same, the hash value to be verified and the target hash value are determined to not match, i.e., the match fails.
[0050] S206: When the hash value to be verified matches the target hash value, confirm that the authentication result of the input string is successful.
[0051] In this embodiment, the authentication result is either successful or unsuccessful.
[0052] In this embodiment, after successful authentication, the access control device performs the unlocking operation and displays a message such as "Welcome Home".
[0053] In this embodiment, when the hash value to be verified and the target hash value do not match, the sliding window is moved with a step size of 1, and the substring covered by the sliding window is re-extracted as the substring to be verified. Step S205 is repeated until a match is successful or the sliding window moves to the end of the input string (i.e., the end of the sliding window is at the end of the input string). Moving the sliding window to the end of the input string means that the sliding window has traversed all positions of the input string.
[0054] If, after the sliding window has traversed all positions of the input string, no matching hash value is found, the authentication result is confirmed as authentication failure. Upon authentication failure, the access control device displays "Incorrect password, please re-enter" and records the failure event. If the number of consecutive failures exceeds a preset threshold (e.g., 5 times), the access control device locks the input function and triggers an alarm.
[0055] The verification method based on dummy ciphers provided in this application is applicable to scenarios where plaintext ciphers are not stored.
[0056] In this embodiment, only the target hash value is stored. Do not store the target password , This represents the salt value corresponding to the target password. When the user inputs an input string containing dummy bits... ,in, This indicates the input string. This is represented as a prefix dummy character, which is the first dummy character located before the user's password. This is represented as a suffix dummy character, which is the second dummy character following the user's password. The sum of the lengths of the prefix dummy character and the suffix dummy character equals the actual length of the dummy character, and verification is required. Does it contain the correct That is, user password and target password Are they the same?
[0057] By inputting a string The size of the upward slide is The window calculates the hash value to be verified segment by segment and compares it with the target hash value. As an example, the target password can be... The length is used as the size of the sliding window. .
[0058] As another example, there is a starting position for the sliding window. and the size of the sliding window satisfy: .
[0059] Indicates the length of the input string. Indicates the length of the target password. Tolerance parameter (default) ), This indicates the number of characters in the input string. Starting from the beginning position (Start), cut length is The substring to be verified. Indicates the hash value to be verified, where This is a tolerance parameter used to tolerate possible user input errors.
[0060] This application embodiment uses a sliding window to extract a substring from an input string containing dummy characters, and then performs a hash operation on the extracted substring and compares it with a pre-stored target hash value. Since only the hash value of the target password is stored, rather than the plaintext, even if the database is leaked, the user's password cannot be recovered, fundamentally eliminating the risk of password exposure due to data leakage. Simultaneously, the sliding window's traversal method automatically adapts to the presence of dummy characters, eliminating the need to pre-remove dummy characters, simplifying the verification process, and achieving effective verification of dummy passwords while ensuring high security.
[0061] In one possible implementation, the verification method based on the dummy cipher further includes steps Sa1 to Sa4.
[0062] Sa1: Determines the length of the phantom characters in the input string as the actual phantom length.
[0063] In this embodiment, when the hash value to be verified and the target hash value match (match successful), the actual phantom length is... .
[0064] Sa2: Obtain the target recommendation length range.
[0065] In this embodiment, the target recommended length range is the recommended length range of the decoy characters when the user enters an input string. The target recommended length range is also the recommended length range of the decoy characters displayed on the access control device when the user enters an input string.
[0066] Sa3: Determine whether the actual virtual length belongs to the target recommended length range and obtain the judgment result.
[0067] In this embodiment, the determination result includes whether the actual phantom length belongs to the target recommended length range or whether the actual phantom length does not belong to the target recommended length range.
[0068] Sa4: Update the user's corresponding virtual length recommendation table based on the judgment result and the authentication result of the input string.
[0069] In this embodiment, the virtual length recommendation table includes multiple recommendation combinations. Each recommendation combination includes a recommended length range and a corresponding recommended value for that length range. The larger the recommended value, the greater the probability that the corresponding recommended length range will be recommended.
[0070] In addition, the virtual length recommendation table specifically includes different user behavior states, as well as multiple recommendation combinations for each user behavior state.
[0071] User behavior status describes a user's current behavioral characteristics and input habits; for example, it can be numbered as follows: , , ...each state corresponds to multiple recommended combinations.
[0072] Each user maintains an independent Q-table for recommending virtual lengths.
[0073] { “ ”:{“ “: 0.5, “ 0.3, 0.1, :0.0, ":0.0}, “ ”:{“ 0.2, 0.6, 0.4, 0.1, ":0.0}, ...}
[0074] , , , , This represents the action performed under the corresponding user behavior state, and also represents the corresponding recommendation length range. The values 0.5, 0.3, 0.1, 0.0, and 0.0 below represent... , , , , The corresponding recommended value.
[0075] As an example, action The corresponding recommended length range is This indicates that there is no empty space, and the action... The corresponding recommended length range is , indicating a short false position, action The corresponding recommended length range is This indicates a medium-sized empty space, indicating an action. The corresponding recommended length range is , indicating a long empty space, action The corresponding recommended length range is , indicating an excessively long decoy position.
[0076] User behavior state S is represented by a five-dimensional behavioral feature vector. .
[0077] This represents the historical success rate, specifically the success rate of the last 20 authentication attempts. The historical success rate is the ratio of the number of successful authentications in the last 20 attempts to the total number of authentications. This embodiment, by introducing the historical success rate dimension, reflects the stability of a user's recent authentication activity, thus balancing user proficiency and security needs when recommending the phantom length. For example, if a user's historical success rate is high, it indicates that their input habits are relatively stable, and the recommended phantom length can be appropriately shortened to improve input efficiency. Conversely, if the historical success rate is low, the recommended phantom length can be appropriately lengthened to enhance security.
[0078] This represents the average phantom length, the average of the actual phantom lengths over the last 20 iterations. By introducing the average phantom length dimension, this embodiment reflects the user's overall preference for phantom length, making the recommendation strategy more aligned with the user's input habits. For example, if the user prefers shorter phantom lengths, the system can prioritize recommending shorter phantom ranges, reducing the user's adaptation cost.
[0079] The standard deviation of the phantom length reflects the stability of user input. It is the standard deviation of the actual phantom length over the last 20 inputs and is used to quantify the fluctuation of the phantom length in user input. This embodiment, by introducing the phantom length standard deviation dimension, can identify users with stable input behavior and those with highly volatile input behavior. For users with a smaller standard deviation, the system can recommend a more precise phantom length range. For users with a larger standard deviation, the system can recommend a wider range to accommodate diverse user input.
[0080] The time factor reflects the sensitivity of different time periods (higher at night). This application pre-divides a 24-hour day into different time periods, each with a different time factor. For example, the time factor is 0.3 for [06:00-18:00), 0.6 for [18:00-23:00), and 1.0 for [23:00-06:00]. This embodiment introduces the time factor dimension, enabling the system to dynamically adjust the recommended phantom length based on the user's authentication time period. For example, during the night (23:00-06:00), when security risks are higher, the system can automatically recommend a longer phantom length to enhance protection. During daytime, the phantom length can be appropriately shortened to improve convenience.
[0081] This indicates the security level of the access control device, reflecting the security level of the environment in which it is deployed. In this embodiment, different security levels can be preset for different deployment environments. For example, if the deployment environment is a closed indoor environment (such as a residential interior or office interior), with low environmental risk, the security level is low.
[0082] The deployment environment is a semi-open environment (such as a corridor, hallway, or unit lobby in a residential community), with moderate environmental risk and a medium security level.
[0083] The deployment environment is an open outdoor environment (such as community entrances and exits, open-air parking lots, and street-facing access control), which has a high environmental risk and a high security level. The security level of the access control equipment reflects the risk level of the deployment environment, that is, the required security protection level for that environment. The higher the risk of the environment, the higher the required security level, and the longer the system-recommended phantom bit length.
[0084] As an example, each dimension is discretized into 3-4 levels. For instance, historical success rate is divided into 3 levels: [0, 0.7) for low success rate, [0.7, 0.9) for medium success rate, and [0.9, 1.0] for high success rate. Average dummy length is divided into 4 levels: [0, 2) for short, [2, 5) for medium-short, [5, 9) for medium-long, and [9, 20] for long. Dummy length standard deviation is divided into 3 levels: [0, 1) for stable, [1, 3) for medium, and [3, 20] for fluctuating. Time factor is divided into 3 levels: low (0.3), medium (0.6), and high (1.0). Access control device security level is divided into 3 levels: low security level, medium security level, and high security level. There are a total of 3 × 4 × 3 × 3 × 3 = 324 user behavior states.
[0085] This embodiment can determine the security level of different deployment environments through pre-configuration. For example, the security level can be directly mapped according to the area type to which the device is installed, such as low security level for indoor enclosed environments, medium security level for semi-open environments, and high security level for outdoor open environments.
[0086] In addition, this embodiment can also set different environmental indicators, such as monitoring coverage, pedestrian density, historical security incident rate, lighting conditions, etc. After normalizing each environmental indicator, the security score of the deployment environment of the access control equipment is calculated by weighted summation, and the corresponding security level is determined according to the range of the security score. For example, a security score in the range [0, 0.3) corresponds to a low security level, [0.3, 0.7) corresponds to a medium security level, and [0.7, 1.0] corresponds to a high security level.
[0087] The method provided in this application records the actual phantom length and corresponding authentication result for each user authentication, and dynamically updates the phantom length recommendation table accordingly. This mechanism can continuously learn the user's input habits, allowing the recommended phantom length range to gradually adapt to the user's personalized needs, meeting the needs of different users and effectively improving the user's input experience while ensuring security.
[0088] This embodiment models the user password verification process as a Markov Decision Process (MDP), using quadruples. The system is structured as follows: State space D represents the user's current behavioral characteristics, consisting of five dimensions: historical success rate, average phantom length, phantom length standard deviation, time factor, and access control device security level. It characterizes the user's input habits and security needs at different times and in different environments. Action space A represents the recommended phantom length range, including discrete actions such as no phantom, short phantom, medium phantom, long phantom, and ultra-long phantom. Each action corresponds to a specific recommended length range. Reward function R represents the immediate feedback of the authentication result. It calculates the reward value based on whether the authentication was successful and the degree of matching between the actual phantom length and the recommended length range, evaluating the suitability of the current action (recommendation strategy) for the user's current authentication. State transition function P represents the evolution of user behavior over time, i.e., the probability distribution of transitioning to the next state after the user performs an action in the current state, reflecting the dynamic changes in the user's input habits.
[0089] In one possible implementation, Sa4 updates the user's corresponding virtual length recommendation table based on the judgment result and the authentication result of the input string, including steps Sb1 to Sb2.
[0090] Sb1: Calculate the instant reward value based on the judgment result and the authentication result of the input string.
[0091] In this embodiment, the instant reward value is used to reflect the degree to which the target recommendation length range is adapted to the user's current authentication.
[0092] Sb2: Update the target recommendation value in the target recommendation combination based on the immediate reward value.
[0093] The method provided in this application introduces a reward mechanism from reinforcement learning to quantify the authentication result into a specific reward value, and uses this reward value to iteratively update the recommendation value of the corresponding recommendation combination in the recommendation table. This feedback-based update method enables the recommendation strategy to be continuously optimized as the number of times the user uses the service increases, gradually converging to the most suitable balance point between safety and convenience for the user, thus achieving intelligent and adaptive recommendation of dummy length.
[0094] In one possible implementation, Sb1 calculates the instant reward value based on the judgment result and the authentication result of the input string, including steps Sc1 to Sc4.
[0095] Sc1: Calculate the adoption reward value based on the judgment result.
[0096] In this embodiment, the adoption reward value is determined based on the deviation between the actual virtual length and the midpoint value of the target recommended length interval; the smaller the deviation, the larger the adoption reward value.
[0097] Sc2: If the authentication result of the input string is successful, then calculate the first reward value based on the adoption reward value and the actual phantom length.
[0098] Sc3: If the authentication result of the input string is authentication failure, then calculate the second reward value based on the actual phantom length, and the second reward value is less than the first reward value.
[0099] Sc4: Determine the first or second reward value as the immediate reward value.
[0100] In this embodiment, the adoption reward value is calculated as follows: .
[0101] This indicates that the actual phantom length falls within the target recommended length range. Indicates the target recommendation length range. This represents the minimum value within the target recommendation length range. This represents the maximum value within the target recommendation length range. This indicates the reward value for adoption. This indicates that the actual virtual length does not belong to the target recommended length range. This represents the midpoint value of the target recommendation length interval. .
[0102] The reward function for calculating the instant reward value is: .
[0103] This represents the immediate reward value obtained by performing action a in state s. Indicates the actual phantom length. This indicates the reward value for adoption. This represents the first reward value. This represents the second reward value.
[0104] The method provided in this application establishes different reward benchmarks for successful and failed authentication scenarios, and provides additional adoption rewards for behaviors that follow the target recommended length range, thus constructing a clear guiding signal. This reward mechanism encourages users to use the recommended decoy length range as much as possible while ensuring successful authentication, and at the same time, by penalizing failed behaviors, it tends to recommend a more reliable recommended length range, thereby improving security while continuously optimizing the user experience.
[0105] In this embodiment, the Q-learning algorithm can be used to update the target recommendation value in the target recommendation combination.
[0106] The state-action value function is updated using the Q-learning algorithm. .
[0107] This means that the system iteratively updates the Q-value (recommendation value) of the current state-action pair based on the sum of the immediate reward obtained from this certification and the estimated future income, so that the Q-value gradually approaches the true value estimate, thereby continuously optimizing the dummy length recommendation strategy.
[0108] in, This represents the user's behavioral state at time t, belonging to , , ……one of the. This represents the recommended virtual length interval at time t, i.e., the target virtual length interval. This represents the immediate reward value a user receives after completing this authentication process, calculated using a reward function. This indicates the next state the user will be transitioned to after completing this authentication. This represents the learning rate, which controls the weight of new information in updating the Q-value (recommendation value). The larger the value, the greater the impact of new information on the Q-value. This represents the discount factor, which controls the importance of future rewards to the current Q value update. The larger the value, the more the system values long-term accumulated rewards. Indicates the next state The largest Q-value among all available actions is used to estimate future revenue. Hyperparameter configuration: learning rate. It can be 0.1, representing the weight of new information, a discount factor. It could be 0.9, indicating the importance of future rewards.
[0109] Next state The state transition function P is used to determine the current state of the user. Next action After determining the recommended virtual length range, the five behavioral feature values (historical success rate, average virtual length, virtual length standard deviation, time factor, and security level of the access control device) are updated based on the authentication result (success or failure) and the actual virtual length. The updated feature vector is then mapped to the corresponding state number according to a preset discretization rule to obtain the state at the next moment. For example, the state at the next moment. The corresponding user behavior state number is .
[0110] In this application, if the user has existing historical data, the Q-learning algorithm described above can be used to recommend the phantom length. The system initializes the Q-table based on the user's historical authentication records and continuously updates the recommendation strategy based on the ε-greedy strategy to achieve personalized dynamic optimization of the phantom length. If the user is a new user with no historical data, a phased strategy is adopted, as shown in Table 1.
[0111] Table 1. Phased Strategy Table
[0112] In phase 1, the system uses In Phase 1, the system randomly selects actions based on probability, i.e., it recommends a completely randomized dummy length range to collect initial user input behavior data. In Phase 2, the system adopts a conservative strategy, fixing the dummy length at 6 to ensure basic security while accumulating data. In Phase 3, the system has accumulated sufficient user behavior data and enters the normal Q-learning optimization process, dynamically adjusting the recommendation strategy based on the user's actual performance.
[0113] In one possible implementation, before obtaining the user input string collected by the access control device, the verification method based on the dummy password further includes: Obtain the recommended virtual length table, select the target recommended length range from the virtual length recommended table, and display the target recommended length range through the access control device.
[0114] In this embodiment, the method of selecting the target recommended length interval from the virtual length recommendation table adopts an ε-greedy action selection strategy to balance exploration and exploitation.
[0115] Action selection follows an ε-greedy strategy: .
[0116] This represents the action selected at time t. The corresponding recommended length interval is the target recommended length interval selected from the virtual length recommendation table at time t. Indicates the selection state Select the action with the highest recommendation value from all recommended combinations under the corresponding user behavior state.
[0117] This means uniformly and randomly selecting an action from the action space A, that is, randomly selecting one with equal probability from all recommendation combinations under all user behavior states, in order to explore new recommendation strategies.
[0118] Specifically, the system generates a random number x for each recommendation, with x ranging from [0, 1].
[0119] When the random number x is greater than At that time, with probability Select current status The action that maximizes the Q value, i.e. We can use existing experience to select the best recommendation.
[0120] When the random number x is less than or equal to At that time, with probability Randomly select an action from action space A, that is... Explore new recommendation strategies.
[0121] Exploration rate With the number of authentications Exponential decay: .
[0122] in , Exploration rate It can be 0.2, representing the initial value of ε-greedy.
[0123] The method provided in this application offers clear operational guidance to users by proactively displaying the recommended range of phantom characters before user input. Users no longer need to manually determine how many phantom characters to add, reducing the cognitive burden and ensuring that the recommendation strategy effectively guides user behavior. This allows the system to collect data that better aligns with the strategy's expectations, accelerating the personalized learning process.
[0124] In one possible implementation, the verification method based on dummy ciphers also includes: If the hash value to be verified and the target hash value do not match, the authentication result of the input string is confirmed as authentication failure.
[0125] The method provided in this application explicitly determines authentication failure when hash value comparisons are inconsistent, establishing a clear logic for determining authentication results. This determination method avoids misjudgments caused by input errors, provides an accurate data foundation for subsequent reward calculations and policy updates, and ensures the reliability of the entire verification process and the effectiveness of closed-loop feedback.
[0126] As another example, such as Figure 3 As shown, the system architecture involved in the verification method based on virtual ciphers in this application includes a keypad (access control device), a smart center, and storage. The verification system based on virtual ciphers includes a device layer, a smart center (gateway) layer, and a storage layer.
[0127] The device layer, including access control devices, is responsible for collecting user input strings and forwarding authentication requests, but does not store any user credential information.
[0128] The intelligent center (gateway) layer is used to receive authentication requests, send query requests to the storage layer to query user information, receive user information returned by the storage layer, determine the user's behavior status based on the user information, select action a based on the user's behavior status, and the recommended length range corresponding to action a is the target recommended length range. The target recommended length range is then returned to the device layer and displayed to the user by the access control device.
[0129] The intelligent center (gateway) layer specifically includes a password verification engine, a reinforcement learning optimizer, and a user management module. The password verification engine performs sliding window hash comparison verification on the user's input string. The reinforcement learning optimizer selects action 'a' based on the user's behavior state and updates the target recommendation value in the target recommendation combination. The user management module manages user information and the phantom length recommendation table.
[0130] At the device layer, the user inputs an input string M containing dummy bits based on the target recommended length range displayed by the access control device. The access control device collects the input string M and forwards it to the smart center (gateway) layer. The password verification engine performs hash comparison verification on the input string M through a sliding window traversal method. After verification, the reinforcement learning optimizer calculates the reward (instant reward value) based on the authentication result and updates the target recommendation value (the recommendation value corresponding to the target recommendation length range) in the target recommendation combination.
[0131] User information includes user storage fields as shown in Table 2.
[0132] Table 2 User Storage Fields
[0133] The id is used to identify the user and locate the corresponding user information record in the authentication request.
[0134] st is used to distinguish whether a user is a new user (st=0 or 1), and to decide whether to use a phased strategy or normal Q-learning optimization.
[0135] st=0 indicates that the user has been created but has not yet completed the initial authentication and has no historical behavior data. For example, an account is created when a property manager adds a new resident.
[0136] st=1 indicates that the user has completed the first authentication, but there is insufficient historical data (less than 20 times). After the user completes the first authentication, the value changes from st=0 to st=1.
[0137] st=2 indicates that the user has enough historical data (≥20 authentications) and enters normal Q-learning optimization. After the user's cumulative authentication count reaches 20, it changes from st=1 to st=2.
[0138] st=3 indicates that the user has been frozen by the property manager and cannot be authenticated. The property manager has manually disabled the user (e.g., due to resident moving out or unauthorized use).
[0139] The value ty determines the verification method. When ty=km5, the sliding window hash comparison verification method of this application is used. When ty=nfc, the card ID is directly compared.
[0140] The target hash value stored in tk is the comparison target for sliding window hash comparison.
[0141] Salt participates in the hash calculation, ensuring that even if two users set the same password, the stored hash values will be different.
[0142] pwd_len is the target password length, used to determine the size of the sliding window during sliding window traversal.
[0143] KP is used for access control devices to control permissions, allowing authentication only when the user has permission to access the device.
[0144] pl is used to calculate the time factor, with different time factor values corresponding to different time periods.
[0145] The 'mn' keyword is used to distinguish between ordinary residents and property management personnel. Management personnel can configure user permissions and manage device access lists.
[0146] Taking a smart residential community building access control system as an example, a community installs Keypad access control devices at the entrance of each building, allowing residents to open doors using passwords or NFC cards. Property management personnel need to manage resident access permissions for each building. A typical interaction flow is as follows: Resident C returns home and opens the door. The access control screen displays: "Please enter your password (it is recommended to add 5-8 dummy characters)." Resident C enters their password "123456" and the dummy characters "abcdef," for example, the input string is: "abc123456def." Authentication result: Authentication successful → Door lock opens → Screen displays "Welcome home." System learning: This authentication was successful; the actual dummy length is 6. Within the target recommended length range [5, 8], an adoption reward is obtained, the Q-table (dummy length recommendation table) is updated, and the Q value (recommendation value) of a2(5-8) increases in this state.
[0147] As an example, access control device permission configuration: { "user_id": 1001 "name": "User C" "kp": "[B001][B002]", / / Only allowed in Units 1 and 2 of Building B "pl": "{"weekday": "06:00-23:00"}" / / Entry is prohibited after 23:00. }
[0148] Most decoy password schemes employ a fixed-length strategy (e.g., 3 digits followed by 2 digits), which cannot be dynamically adjusted based on user habits and environmental security levels. Different users have vastly different needs for input convenience and security: high-frequency usage scenarios (such as family members opening the door daily) require shorter decoys to improve the user experience, while high-risk scenarios (such as late at night or outdoor devices) require longer decoys for enhanced protection. Fixed-length schemes either sacrifice security for user experience or sacrifice user experience for security, failing to achieve a dynamic balance between the two. Furthermore, the differentiated needs of new and experienced users, and different device locations (indoor vs. outdoor), cannot be met.
[0149] This application utilizes a sliding window hash comparison algorithm to complete decoy password verification without storing plaintext passwords, completely eliminating the risk of database leakage. It introduces a Q-learning reinforcement learning model to dynamically recommend the optimal decoy password length range based on multiple dimensions, including the user's historical authentication success rate, average decoy password length, time period, and device security level. The system guides user behavior through a reward mechanism, significantly improving user experience while ensuring high security.
[0150] This application aims to achieve zero-plaintext storage for decoy password verification. Through a sliding window hash comparison algorithm, even if the database is compromised, the user's password cannot be recovered. It introduces Q-learning reinforcement learning to dynamically optimize the decoy length, automatically recommending a personalized optimal decoy range based on multiple dimensions such as the user's historical success rate, average decoy length, time factor, and device security level. Thirdly, it guides user behavior through a reward mechanism to achieve an adaptive strategy, minimizing the user's input burden and improving the overall authentication experience while ensuring high security.
[0151] This application eliminates the need to store plaintext passwords, ensuring that passwords cannot be recovered even if the database is compromised. It can dynamically optimize the recommended length of phantom characters. Phantom password verification can be achieved through sliding window hash comparison without storing plaintext passwords, and reinforcement learning is used to dynamically optimize the recommended phantom length, automatically learning the optimal phantom length for each user.
[0152] Figure 4 This is a schematic diagram of an electronic device provided in an embodiment of this application. See below for details. Figure 4 This diagram illustrates a suitable structural schematic for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from memory 408 into random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the electronic device. The processor 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0153] Typically, the following devices can be connected to I / O interface 405: input devices 406, including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, etc.; output devices 407, including, for example, liquid crystal displays (LCDs), speakers, etc.; memory devices 408, including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although... Figure 4Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0154] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from memory 408, or installed from ROM 402. When the computer program is executed by processor 401, it performs the functions defined in the dummy password-based verification method of embodiments of this application.
[0155] Figure 4 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0156] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc. Further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessors, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the dummy password-based verification method shown in the above embodiments is implemented.
[0157] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0158] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method of authentication based on a virtual bit password, characterized in that, The method includes: The system acquires an input string collected by the access control device, the input string consisting of a user password and a decoy character; the decoy character includes at least one, which is located before and / or after the user password in the input string; The size of the sliding window is determined based on the length of the target password, and a preset movement step is used. The sliding window is moved over the input string according to the movement step to obtain a cropped substring to be verified with the size of the sliding window. The target password is the password that the user has preset for authentication. Perform a hash operation on the substring to be verified to obtain the hash value to be verified; Obtain the target hash value corresponding to the pre-stored target password; The hash value to be verified and the target hash value are compared to determine whether they match. When the hash value to be verified matches the target hash value, the authentication result of the input string is confirmed as successful.
2. The method of claim 1, wherein, The step of performing a hash operation on the substring to be verified to obtain a hash value to be verified includes: Obtain the pre-stored salt value corresponding to the target password; The substring to be verified is concatenated with the salt value to obtain a concatenated string; Perform a hash operation on the concatenated string to obtain the hash value to be verified.
3. The method of claim 1, wherein, The method further includes: The length of the phantom character in the input string is determined as the actual phantom length; Obtain the target recommended length range; the target recommended length range is the length range of the phantom characters recommended when the user inputs the input string; Determine whether the actual virtual length belongs to the target recommended length range to obtain a judgment result; The virtual length recommendation table corresponding to the user is updated based on the judgment result and the authentication result of the input string; the virtual length recommendation table includes multiple recommendation combinations, each recommendation combination includes a recommendation length range and a recommendation value corresponding to the recommendation length range; the larger the recommendation value, the greater the probability that the corresponding recommendation length range will be recommended.
4. The method of claim 3, wherein, The step of updating the virtual length recommendation table corresponding to the user based on the judgment result and the authentication result of the input string includes: Based on the judgment result and the authentication result of the input string, an instant reward value is calculated; the instant reward value is used to reflect the degree of fit between the target recommendation length range and the user's current authentication. Update the target recommendation value in the target recommendation combination based on the instant reward value.
5. The method of claim 4, wherein, The step of calculating the instant reward value based on the judgment result and the authentication result of the input string includes: The adoption reward value is calculated based on the judgment result; the adoption reward value is determined based on the deviation between the actual virtual length and the midpoint value of the target recommended length interval, and the smaller the deviation, the larger the adoption reward value. If the authentication result of the input string is successful, then the first reward value is calculated based on the adoption reward value and the actual virtual length; If the authentication result of the input string is authentication failure, then a second reward value is calculated based on the actual phantom length, and the second reward value is less than the first reward value; The first reward value or the second reward value is determined as the instant reward value.
6. The method of claim 4, wherein, Before obtaining the input string collected by the access control device from the user input, the method further includes: Obtain a recommended virtual length table, select a target recommended length range from the recommended virtual length table, and display the target recommended length range through the access control device.
7. The method of claim 1, wherein, The method further includes: If the hash value to be verified and the target hash value do not match, the authentication result of the input string is confirmed as authentication failure.
8. The method of claim 1, wherein, The size of the sliding window is equal to the length of the target password, and the movement step is 1.
9. An electronic device, comprising: include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the steps of the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the steps of the method according to any one of claims 1 to 8.
