Disclosure of Invention
The application provides a peep-proof cipher device which comprises a key module, a main control circuit, a pulse timer, a vibration module, a vibration counter and a code value register, wherein the key module is used for inputting a cipher code;
the key module comprises a digital button, a confirmation button and a cancel button; each digit in the digital key signal output by the digital button corresponds to a button; the confirmation button outputs a confirmation signal, and the confirmation signal is effective when the button is pressed; the cancel button outputs a cancel signal, and the cancel signal is effective when the button is pressed;
the receiving end of the main control circuit is connected with the key module, the vibration counter and the code value register, and the output end of the main control circuit is connected with the upper computer and the pulse timer; after receiving a digital key signal of a digital button, the main control circuit records a code value into a code value memory and triggers a pulse timer to start outputting a high pulse signal in a pulse period; the vibration module sends out vibration once after receiving the high pulse signal once and updates the value of the vibration counter once; correspondingly recording the value of the vibration counter in a code value register after the key signal is finished;
after receiving a cancel signal of a cancel button, the main control circuit clears the recorded code value and the corresponding vibration count value; and after receiving a confirmation signal of the confirmation button, outputting the code value of each key in the code value register and the value of the corresponding vibration counter to the upper computer.
The anti-peeping cipher device as described above, wherein when the power-on reset or cancel signal of the main control circuit is valid, the main control circuit enters a state of waiting for the 1 st key;
when the digital key signals are invalid, the master control circuit keeps waiting for the ith key state; when at least one signal in the digital key signals is effective, recording the effective signal in the digital key signals, and enabling the main control circuit to enter an ith key timing state;
when the master control circuit is in the ith key timing state and the effective signal is invalid, the master control circuit enables the code value register to record the value of the vibration counter, and the master control circuit enters a waiting key bounce state; otherwise, keeping the ith key timing state;
when the main control circuit is in a waiting key-up state and any signal in the digital key signals is invalid, if the key-pressing times reach a preset password length, the main control circuit enters a waiting confirmation state, otherwise, the main control circuit enters an i +1 th key-pressing waiting state;
when the main control circuit is in a state of waiting for confirmation and the confirmation signal is valid, the main control circuit outputs the value of the code value register and enters a state of waiting for confirmation and invalidity; otherwise, the master control circuit keeps waiting for confirmation;
when the main control circuit waits for the invalid state to be confirmed, and the confirmation signal is invalid, the main control circuit enters a state of waiting for a 1 st key; otherwise, the wait for acknowledge invalid state is maintained.
The peep-proof cipher device further comprises a deleting button, and when the deleting button is pressed down and the main control circuit receives the valid deleting signal, the main control circuit deletes the code value recorded last time and the corresponding vibration count value.
The application also provides a password peep-proof method which is applied to any one of the peep-proof ciphers, and is characterized by comprising the following steps:
when detecting that the digital button is pressed down, starting and resetting the pulse timer and the vibration counter, setting a pulse period, and starting timing and counting;
detecting the pressing duration of the digital button, triggering the vibration module once every pulse period of the pulse timer, updating the value of the vibration counter once, and recording the key code value and the corresponding value of the vibration counter when the key is lifted;
when a confirmation button press is detected, the passwords are organized in the order of the recorded key code values and the order of the recorded vibration counter values.
The password peep-proof method is characterized in that after the key is lifted, the numerical value of the pulse timer and the numerical value of the vibration counter are cleared again, and the duration and the vibration frequency of the pressing of the next digital key are recorded.
The password peep-proof method as described above, wherein the pulse period is a variable value that is changed periodically, and the pulse period is updated after the key is lifted.
In the password peep-proof method, if the duration of the key press does not reach the set pulse period, the vibration counter keeps the original value of 0, and the value of the pulse timer is cleared again when the digital button is lifted, and the duration of the next digital key press is recorded.
The password peep-proof method as described above, wherein if the duration of the key press exceeds the set pulse period, the pulse timer sends a high pulse signal to the vibration module connected to the pulse timer every other set pulse period, the vibration module sends a vibration after receiving the high pulse signal and sends a count signal to the vibration counter connected to the pulse timer, and the vibration counter adds one to the current value of the vibration counter after receiving the count signal.
The password privacy method as described above, wherein when a certain key is pressed for a period of time of x T1, no vibration is generated and no timing is performed.
The password peep-proof method is characterized in that if the first key is pressed and not released and then other keys are pressed, and the first key is released and then the first key is pressed again during the pressing of other keys, only the code value corresponding to the first key is added into the input password sequence, the timing is started only when the first key is pressed for the first time, and the timing is stopped when the first key is released, and the pressing and releasing of other keys do not influence the timing, the vibration and the input password sequence.
The beneficial effect that this application realized is as follows: by adopting the anti-peeping cipher device and the cipher anti-peeping method, the cipher of the user and the duration time for the user to press the key are combined to be used as the final cipher, so that a peeper cannot know the correct cipher even if seeing the character sequence input by the user. The security of the password is ensured.
Example one
The embodiment of the application provides a password peep-proof method, which is applied to a peep-proof password device, and as shown in fig. 1, the peep-proof password device comprises a key module, a main control circuit, a pulse timer, a vibration module, a vibration counter and a code value register;
the key module comprises a digital button, a confirmation button and a cancel button; each digit in the digital key signal output by the digital button corresponds to a button; the confirmation button outputs a confirmation signal, and the confirmation signal is effective when the button is pressed; the cancel button outputs a cancel signal, and the cancel signal is effective when the button is pressed;
wherein, the digital button outputs a group (m) of btn _ down signals, and each button corresponds to one bit; when the ith key is pressed, btn _ down [ i ] is 1, otherwise 0(1< ═ i < ═ m); the confirmation button outputs a submit signal, the submit signal is 1 when the button is pressed, otherwise, the submit signal is 0; the cancel button outputs a cancel signal, the cancel signal is 1 when the button is pressed, otherwise, the cancel signal is 0.
The receiving end of the main control circuit is connected with the key module, the vibration counter and the code value register, and the output end of the main control circuit is connected with the upper computer, the pulse timer, the vibration counter and the code value register;
specifically, after receiving a digital key signal of a digital button, a main control circuit records a code value into a code value memory and triggers a pulse timer to start outputting a high pulse signal in a pulse period; the vibration module sends out vibration once after receiving the high pulse signal once and updates the value of the vibration counter once; correspondingly recording the value of the vibration counter in a code value register after the key signal is finished;
after receiving a cancel signal of a cancel button, the main control circuit clears the recorded code value and the corresponding vibration count value; and after receiving a confirmation signal of the confirmation button, outputting the code value of each key in the code value register and the value of the corresponding vibration counter to the upper computer.
As shown in fig. 1, the master control circuit receives btn _ down, submit, cancel signals, and a count value cnt signal from the counter; when the main control circuit is powered on and reset or the cancel signal is effective, the output ena signal is 0, the tm _ pwd signal is ineffective, and the main control circuit enters a state of waiting for the 1 st key;
when the main control circuit waits for the ith key state and any signal in btn _ down [ m:1] is invalid, the main control circuit outputs ena signal as 0 and keeps waiting for the ith key state; when at least one signal in btn _ down [ m:1] is valid, recording the first valid signal in btn _ down [ j ], wherein 1< ═ j < ═ m; the main control circuit outputs ena signal as 1, the tm _ pwd signal is invalid, and the ith key timing state is entered;
when the master control circuit is in the ith key timing state and btn _ down [ j ] signals are invalid, the master control circuit enables a code value register tm _ pwd _ buf [ i × n-1: i × n-n ] to be equal to (latch) a currently input cnt value, an output ena signal is 0, and the master control circuit enters a key bounce waiting state; when the btn _ down [ j ] signal is continuously effective and cnt is equal to x, the main control circuit outputs ena signal as 0, and keeps the ith key timing state; otherwise, the main control circuit outputs ena signal 1, and keeps the ith key timing state;
when the master control circuit is in a waiting key bounce state and any signal in btn _ down [ m:1] is invalid, if i is m, the master control circuit enters a waiting confirmation state, otherwise, the master control circuit enters an i +1 th key waiting state; otherwise, keeping the waiting key-up state;
when the submit signal is valid in the state of waiting for confirmation, the master control circuit outputs tm _ pwd equal to the value of the code value register tm _ pwd _ buf and enters a state of waiting for confirmation and invalidity; otherwise, the output tm _ pwd of the main control circuit is kept invalid, and a waiting confirmation state is kept;
when the submit signal is invalid under the condition that the main control circuit waits for confirming the invalid state, the main control circuit enters a state of waiting for pressing a key 1; otherwise, the wait for acknowledge invalid state is maintained.
When the ena signal is effective, a pulse timer (preferably adopting a pulse timer with adjustable pulse period) starts to output a high pulse signal with T1 as a pulse period; when the ena signal is invalid, the pulse signal output by the pulse timer is kept to be 0;
the vibration module vibrates once per pulse received from the pulse timer (preferably for a time of T2, T2< T1). And every time the vibration counter receives a pulse from the pulse timer, the vibration count value cnt is added with 1, and the cnt is output to the main control circuit; when ena is invalid, the output cnt signal of the vibration counter is kept to be 0; one group of cnt includes n signals corresponding to a vibration count value represented by n binary numbers.
When the confirm button is pressed and the main control circuit receives that the submit signal is valid, the main control circuit outputs a group of (m × n) tm _ pwd signals to the upper computer as a duration password (it needs to be noted that a circuit for outputting normal key code values is the same as the existing scheme, and is not described herein again); each n bits in the tm _ pwd signal are a group and correspond to the press time count value of one button; where n is log2(x +1) rounded up and x is the maximum time allowed for each key to be pressed/T1. For example, when x is 1, n is 1; when x is 3, n is 2.
When the cancel button is pressed down and the cancel signal received by the main control circuit is valid, the main control circuit clears the recorded code value and the corresponding vibration count value.
In addition, the peep-proof cipher device further comprises a deleting button, and when the deleting button is pressed down, the main control circuit deletes the code value recorded last time and the corresponding vibration count value after receiving the delete signal and enabling the main control circuit to be effective.
According to the password input method and device, on the basis of the password set by the user, the duration of pressing the key on the anti-peeping password device by the user is also used as a part of the password to be processed, and the password value and the vibration times of each password value when being pressed are recorded by the user when the password is set, so that a snooper cannot know the correct password even if seeing the character sequence input by the user. As shown in fig. 2, the password peep-proof method specifically includes the following sub-steps:
step 210, when detecting that the digital button is pressed, starting and clearing a pulse timer and a vibration counter, setting a pulse period, and starting timing and counting;
in the embodiment of the application, the detection of the pressing of the digital button is taken as the starting response of the pulse timer, when the digital button is pressed, the pulse timer and the vibration counter are started, the numerical values of the pulse timer and the vibration counter are cleared, the initial pulse period is set, the duration of the pressing of the button is recorded by the pulse timer, and the vibration times are recorded by the vibration counter;
the pulse period may be a fixed value initially set, or may be changed periodically, for example, the pulse period is changed every time a key is pressed, so that the number of times of the vibration triggered may be different even if the user presses the key for the same time, so that the peeper cannot presume that the user has triggered several times of the vibration when pressing the key by repeated observation.
220, detecting the pressing duration of the digital button, triggering a vibration module once every pulse period of the pulse timer, updating the value of a vibration counter once, and recording the key code value and the corresponding value of the vibration counter when the key is lifted;
specifically, in the pressing duration process of the digital button, if the pressing duration time of the key does not reach the set pulse period, the vibration counter keeps the original value of 0, and when the digital button is lifted, the value of the pulse timer is cleared again, and the pressing duration time of the next digital key is recorded; that is, when T < T1, the value T of the vibration counter becomes 0.
If the duration time of the key press exceeds the set pulse period, the pulse timer sends a pulse signal to a vibration module connected with the pulse timer after every set pulse period, the vibration module sends a vibration after receiving the pulse signal, so that a user senses that the duration time of the key press is over a timing unit, a counting signal is sent to a vibration counter connected with the pulse timer, and the vibration counter adds one to the value of the current vibration counter after receiving the counting signal; for example, if the user continuously presses the number button for 2 seconds while T1 is 0.8 seconds, two vibrations are sensed, and the value of the vibration counter is 2, i.e., when T1< ═ T <2 × T1, the value T of the vibration counter is 1.
In addition, after the key is lifted, clearing the value of the pulse timer and the value of the vibration counter again, and beginning to record the pressing duration and the vibration times of the next digital key;
further, if a pulse period that is changed periodically is adopted, the pulse period is updated after the key is lifted.
It should be noted that, in order to prevent the key press time from being too long, it is necessary to limit the time of each key press, and when a certain key is continuously pressed for x × T1, that is, x times, it is not vibrated and is not counted any more (i.e., when T > x × T1 is pressed for T × x), that is, when x × T1< (x +1) > T1 is pressed for T ═ x.
In addition, the application also makes a corresponding scheme for the special key pressing situation of the user: if the first key is pressed and not released, other keys are pressed again, and the first key is released and pressed again during the pressing of other keys, the code value corresponding to the first key is only added into the input password sequence, timing is started only when the first key is pressed for the first time, timing is stopped when the first key is released (vibration is triggered), and the timing, the vibration and the input password sequence are not influenced by the pressing and the releasing of other keys;
for example the following sequence of operations:
time a: press down 1
Time b: push down 2
And c: press down 3
Time d: loosening 3
Time e: loosening 1
Time f: press down 1
Time g: release 2
Time h: loosening 1
When the timing is started at the time a and stopped at the time e, the user is considered to input "1", and "1" is added to the password sequence.
Referring back to FIG. 2, step 230, when a confirmation button press is detected, the passwords are organized in the order of the recorded key code values and the order of the recorded vibration counter values;
the method comprises the steps that the vibration frequency of each key starting from the pressing duration is also used as a part of a password, and the password uploading upper computer is organized according to the recorded key code value sequence and the recorded vibration counter value sequence; for example, the key sequence is four numbers 1, 2, 3 and 4, the value of the vibration counter pressed by each key is 1, 2, 1 and 3 times respectively, the final password is 12341213, the first four digits are the same as the normal password, and the last four digits are the duration password.
The duration password of each key can be stored by other numbers according to requirements so as to save storage space. For example, if the duration of each key is represented by a one-digit 4-ary number, the duration code for the above example would be 1213 (binary 01100111), decimal 103.
In addition, the duration password can also be determined by recording the duration, namely recording the pulse period and the duration of each key, and the vibration times are not required to be recorded, and when the duration password is acquired, the following formula is used for calculating:
wherein S isiKey press duration for the ith code value, T1 is the pulse period, SiThe lower rounding operation of/T1 obtains xi,xiA continuous password corresponding to the ith code value obtained through calculation; for example, if the key sequence is recorded as four numbers 1, 2, 3 and 4, and the duration of each key press is T1, 2T1, T1 and 3T1, respectively, the final password is 12341213.
If the duration time is determined by periodically updating the pulse period, the duration time of each key and the pulse period corresponding to each key are recorded, the vibration times do not need to be recorded, and when the duration time password is obtained, the following formula is used for calculating:
wherein S isiKey press duration, T, for the ith code valueiPulse period, S, set for the ith code valueiThe lower rounding operation of/T1 obtains xi,xiFor the calculated continuous password corresponding to the ith code value, for example, the key sequence is recorded as four numbers 1, 2, 3 and 4, and the hold of each key pressThe duration is T1, 3T2, 2T3 and 3T4 respectively, and the final code is 12341323.
For example, a user uses a 6 digit numeric password; if the maximum time allowed for each numeric key is T1 (i.e., T ═ 0 or 1 for each key), there are 2 to 6 power (64) possible key time combinations for each cipher sequence; if the maximum allowed time for each numeric key is 3 x T1 (i.e., T0, 1, 2, or 3 for each key), there are 4 to 6 power (4096) possible key time combinations for each cipher sequence. Therefore, even if a peeper sees the whole key sequence, the peeper is difficult to guess the correct password of the user.
The above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the present disclosure, which should be construed in light of the above teachings. Are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.