CN109787749B - Door lock password generation method based on DES algorithm and password management method thereof - Google Patents

Door lock password generation method based on DES algorithm and password management method thereof Download PDF

Info

Publication number
CN109787749B
CN109787749B CN201910012371.4A CN201910012371A CN109787749B CN 109787749 B CN109787749 B CN 109787749B CN 201910012371 A CN201910012371 A CN 201910012371A CN 109787749 B CN109787749 B CN 109787749B
Authority
CN
China
Prior art keywords
door lock
password
address
key
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910012371.4A
Other languages
Chinese (zh)
Other versions
CN109787749A (en
Inventor
徐新
李玮堂
马凤鸣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CETC 7 Research Institute
Original Assignee
CETC 7 Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CETC 7 Research Institute filed Critical CETC 7 Research Institute
Priority to CN201910012371.4A priority Critical patent/CN109787749B/en
Publication of CN109787749A publication Critical patent/CN109787749A/en
Application granted granted Critical
Publication of CN109787749B publication Critical patent/CN109787749B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a cipher generation method based on DES algorithm and a cipher management method thereof, the invention is a plaintext consisting of date information, effective day information and product ID address, and simultaneously generates 8-byte temporary cipher A by combining a key which generates 8 bytes from the door lock ID address through transformation and bit complement through DES algorithm, and forms an encryption method of a cipher text group through the method, and the arrival rate of the cipher distribution can reach 100%; the time-efficient temporary password distribution of the door lock terminal is realized through the password management method. The invention is suitable for the technical field of door lock passwords.

Description

Door lock password generation method based on DES algorithm and password management method thereof
Technical Field
The invention relates to the technical field of door locks, in particular to a door lock password generation method based on a DES algorithm and a password management method thereof.
Background
The password distribution arrival rate is the ratio of successfully receiving the distributed password by the door lock in unit time and transmitting the password to the terminal door lock through the network by the background. In the prior art, the network distribution password arrival rate of the door lock cannot reach 100%, so that the user experience is poor and the safety is not high.
Therefore, the invention provides a password generation method based on DES algorithm and a password management method thereof. The DES algorithm is a symmetric cryptosystem in the cryptosystem, is also called as the American data encryption standard, and is a symmetric cryptosystem encryption algorithm developed by the American IBM company in 1972. The plain texts are grouped according to 64 bits, the key length is 64 bits, the key is actually 56 bits and participates in DES operation (8 th, 16 th, 24 th, 32 th, 40 th, 48 th, 56 th, 64 th bits are check bits, each key has odd number of 1), and the grouped plain texts and 56 bits of keys form an encryption method of a cipher text group by a bit substitution or exchange method.
Disclosure of Invention
The invention provides a password generation method based on a DES algorithm and a password management method thereof, aiming at solving the problems that the password distribution arrival rate cannot reach 100%, so that the user experience is poor and the security is low in the prior art, and the password generation method and the password management method thereof can realize the password distribution arrival rate of 100% and can also realize the time-efficient temporary password distribution of a door lock terminal.
In order to achieve the purpose of the invention, the technical scheme is as follows: a door lock password generation method based on DES algorithm comprises the following steps:
s1: acquiring the current time and the ID address of a door lock;
s2: generating an 8-byte key by converting and complementing the ID of the door lock;
s3: setting the current time, the valid day information and the ID address as a plaintext with 8 bytes, and generating an 8-byte temporary password A by combining a key through a DES algorithm;
s4: and taking the valid days as variables, and obtaining 1 to 31 groups of temporary passwords A which correspond to 1 to 31 days of valid period passwords B respectively after modulus extraction is carried out on each byte in the temporary passwords A and 10 to temporarily store the temporary passwords A for waiting for user input.
Preferably, in step S1, the method for acquiring the current time specifically includes: firstly configuring the door lock delivery time, wherein the door lock delivery time configuring step comprises the following steps:
step S101: if the temporary password does not exist, the configuration key is pressed for a long time for 3s, and a factory time module of the configuration door lock is started;
step S102: inputting a corresponding password of time set by a manufacturer, and entering a door lock delivery time setting interface;
step S103: inputting 4-digit number representing year, pressing a confirmation key and storing;
step S104: inputting 2 digit number to represent month, pressing enter key and saving;
step S105: inputting 2-digit number representing date, pressing a confirmation key and storing;
step S106: inputting 2-digit numbers to represent hours, pressing a confirmation key and storing;
step S107: inputting 2-digit numbers to represent minutes, pressing a confirmation key and storing;
step S108: inputting 2 digit number representing seconds, pressing the confirm key and saving; finishing configuring the delivery time of the door lock;
the door lock time reading module obtains the current time information by reading the door lock factory time module.
Preferably, in step S1, the door lock ID address is composed of 6 bytes, a value range of each byte is 0 to 9, and the configuration method of the door lock ID address specifically includes:
step S111: the configuration key 3s of the door lock ID address configuration module is pressed for a long time under the condition that the temporary password does not exist, and the door lock ID address configuration module is started;
step S112: inputting a corresponding password of a door lock ID address set by a manufacturer, and entering a door lock ID address configuration interface;
step S113: inputting 6-digit numbers to represent the ID address of the door lock, pressing a confirmation key and storing;
completing the configuration of the ID address of the door lock.
Further, in step S2, a specific method for generating the 8-byte key by transforming and complementing the door lock ID includes: during conversion, each byte is shifted to the left by 1 bit to obtain new 6 bytes; adding the new 6 byte values to obtain a decimal value; converting decimal value into 8 bit binary system, converting the first 4 bits into decimal system as the first item of key and the last 4 bits into decimal system as the eighth item of key; the second to seventh items of the key are composed of new 6 bytes.
Preferably, the first byte of the plain text represents the last two years, the second byte represents the month, the third bit represents the date, the fourth bit represents the time, the fifth bit represents the valid days, the sixth byte represents the 1 st and 2 nd bits of the door lock ID address, the seventh byte represents the 3 rd and 4 th bits of the door lock ID address, and the eighth byte represents the 5 th and 6 th bits of the door lock ID address.
The invention also provides a password management method of the door lock password generation method based on the DES algorithm, which comprises the following steps:
h1: acquiring a password input by a user, judging whether an effective password exists, if so, indicating that the password is in a binding stage at present, and taking the effective password as a unique available password until the time efficiency is expired; the valid password is a password which is correctly verified by the user and is still within the valid period;
h2: if no valid password exists, inquiring and matching the password input by the user from the 31 groups of valid passwords B, and when finding that the Nth group of passwords is matched, indicating that the valid passwords B can be used for N days, and calculating the valid time as the current time plus the seconds of N days;
h3: and storing the Nth group of passwords and the valid time N days as valid information to be used as a valid password for waking up next time.
The invention has the following beneficial effects: the invention is a plaintext composed of date information, effective day information and product ID address, and simultaneously generates 8-byte temporary password A by combining the door lock ID address through transformation and bit complementing to generate 8-byte key through DES algorithm, and forms an encryption method of a ciphertext group through the method, wherein the password distribution arrival rate can reach 100%; the time-efficient temporary password distribution of the door lock terminal is realized through the password management method.
Drawings
Fig. 1 shows the conditions and method for generating a cipher based on DES algorithm according to the present invention.
Fig. 2 is a password management method of the present invention.
Detailed Description
The invention is described in detail below with reference to the drawings and the detailed description.
Example 1
As shown in fig. 1, a door lock password generation method based on DES algorithm, the door lock password generation precondition needs to meet the following conditions:
a1: acquiring door lock awakening information, acquiring password information from eeprom, judging whether a password exists or not, and starting a door lock password generation module to generate a new password if the password does not exist;
a2: if the password exists, judging whether the password is overdue, namely judging whether the current time of the password is greater than the effective time, and if not, extracting the password as the effective password;
a3: and if the password is overdue, clearing the eprom password information, and starting the door lock password generation module to generate a new password.
The door lock password generation method for starting the door lock password generation module to generate a new password comprises the following steps:
step S1: acquiring delivery time and an ID address configured for a door lock;
the setting step of the factory time for configuring the door lock comprises the following steps:
step S101: if the configuration key is pressed for 3 seconds without the temporary password, the touch LED lamp is turned on, and the factory time module of the configuration door lock is started;
step S102: inputting a corresponding password of factory set time in the touch screen, pressing a confirmation key, and entering a factory time setting interface;
step S103: after the correct verification, the led lamp flickers for one circle, then 4 digits are input to represent the year, and a confirmation key is pressed and stored;
step S104: after the correct verification, the led lamp flickers for one circle, then 2 digits are input to represent a month, and a confirmation key is pressed and stored;
step S105: after the correct verification, the led lamp flickers for one circle, then 2-digit digital representative date is input, and a confirmation key is pressed and stored;
step S106: after the correct verification, the led lamp flickers for one circle, then 2 digits are input for representing hours, and a confirmation key is pressed and stored;
step S107: after the correct verification, the led lamp flickers for one circle, then 2 digits are input for representing minutes, and a confirmation key is pressed and stored;
step S108: after the correct verification, the led lamp flickers for one circle, then 2 digits are input to represent seconds, and a confirmation key is pressed and stored;
and after the door lock is verified to be correct, the LED lamp flickers for two circles, and the configuration of the factory time of the door lock is completed. Wherein the door lock will synchronize time periodically according to the protocol.
The door lock ID address in this embodiment is composed of 6 bytes, each byte is represented by a decimal number from 000000 to 999999, that is, the value range of each byte is 0 to 9. When leaving a factory, configuring a door lock ID address, and generating a two-dimensional code to be attached to the back of a door lock; the setting method of the ID address of the configuration door lock specifically comprises the following steps:
s111: if the temporary password does not exist, the configuration key is pressed for a long time for 3s, the touch led lamp is turned on, and the door lock ID address configuration module is started; (ii) a
S112: inputting a password corresponding to a door lock ID address set by a manufacturer in a touch screen, and entering a door lock ID address configuration interface;
s113: after the verification is correct, the led lamp flickers for a circle, then 6 digits are input to represent the ID address of the door lock, and a confirmation key is pressed and stored;
and after the verification is correct, the LED lamp flickers for two circles to complete the configuration of the ID address of the door lock.
Step S2: generating an 8-byte key by converting and complementing the ID of the door lock;
during conversion, each byte is converted into a binary system and then shifted to the left by 1 bit to obtain new 6 bytes; adding the new 6 byte values to obtain a decimal value; converting decimal value into 8 bit binary system, converting the first 4 bits into decimal system as the first item of key and the last 4 bits into decimal system as the eighth item of key; the second to seventh items of the key are composed of new 6 bytes.
Assuming the ID address of the door lock is "123456", 6 bytes shift: 1, 2, 3, 4, 5, 6; each byte is shifted 1 bit to the left, resulting in a new 6 bytes, 2,4, 6, 8, 10, 12 respectively. The new 6 byte values are added, resulting in 42. Converting 42 to binary, the first 4 bits to decimal, i.e. 2, as the first item of the key; the last 4 digits are converted into decimal, namely 10, and the decimal is used as an eighth item of the key; the second to seventh items of the key are composed of new 6 bytes; the key is thus generated as: 2,2,4,6,8, 10, 12, 10.
Step S3: setting the delivery time, the valid day information and the ID address into an 8-byte plaintext, and generating an 8-byte temporary password A through a DES algorithm by combining a secret key;
the first byte of the plaintext represents the last two years of the year, which means 20xx years, and xx ranges from 00 to 99;
the second byte represents months, ranging from 1 to 12;
the third bit represents the date, ranging from 1 to 31;
the fourth bit represents time, ranging from 0 to 23;
the fifth bit represents the number of days of validity, ranging from 1 to 31;
the sixth byte represents the 1 st and 2 nd bits of the door lock ID address, the seventh byte represents the 3 rd and 4 th bits of the door lock ID address, and the eighth byte represents the 5 th and 6 th bits of the door lock ID address. If the door lock ID address is 123456, the sixth to eighth bytes are 0x12, 0x34, 0x 56.
Step S4: and taking the valid days as variables, and obtaining 1 to 31 groups of temporary passwords A which correspond to 1 to 31 days of valid period passwords B respectively after modulus extraction is carried out on each byte in the temporary passwords A and 10 to temporarily store the temporary passwords A for waiting for user input.
As shown in fig. 2, this embodiment further provides a password management method based on the above DES algorithm-based door lock password generation method, which includes the following steps:
h1: the method comprises the steps that every time a system is awakened, firstly, a password input by a user is obtained, whether a valid password exists or not is judged, if yes, the valid password is in a binding stage at present, and the valid password is used as the only one available password until the time efficiency is expired; the valid password is a password which is correctly verified by the user and is still within the valid period;
the password expiration judgment basis is that the value of the current time is larger than the valid time of the password.
H2: if no valid password exists, polling the password input by the user from the 31 groups of valid passwords B, and if the matching is unsuccessful, reporting an error and giving an alarm by the door lock system; when the Nth group of passwords are matched, the password B of the validity period represents that the password B can be used for N days, and the validity time is calculated as the current time plus the seconds of N days;
h3: and storing the Nth group of passwords and the valid time N days as valid information to be used as a valid password for waking up next time.
H4: and storing the effective password and the effective time into the eeprom, and realizing unlocking.
The validity password B described in this embodiment is used as an alternative, that is, 31 sets of validity passwords B can be used, and only the corresponding use valid times are different. After the user inputs the password, the user collides with the 31 groups of the valid period passwords B to hit the database, the password is used as the binding password after the user hits the database and then the door is opened, and the unlocking is completed only by inputting the binding password next time.
It should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (5)

1. A door lock password generation method based on DES algorithm is characterized in that: the method comprises the following steps:
s1: acquiring the current time and the ID address of a door lock;
s2: generating an 8-byte key by converting and complementing the ID of the door lock;
s3: setting the current time, the effective day information and the ID address as a plaintext with 8 bytes, and generating an 8-byte temporary password A by combining a secret key through a DES algorithm;
s4: taking the valid days as variables, and obtaining 1 to 31 groups of temporary passwords A which respectively correspond to 1 to 31 days of valid period passwords B and temporarily store the temporary passwords A for waiting for the input of a user after modulus of each byte in the temporary passwords A and 10;
step S2, the specific method for generating the 8-byte key by transforming and complementing the door lock ID includes: during conversion, each byte is shifted to the left by 1 bit to obtain new 6 bytes; adding the new 6 byte values to obtain a decimal value; converting decimal value into 8 bit binary system, converting the first 4 bits into decimal system as the first item of key and the last 4 bits into decimal system as the eighth item of key; the second to seventh items of the key are composed of new 6 bytes.
2. The DES algorithm-based door lock password generation method according to claim 1, wherein: in step S1, the method of acquiring the current time specifically includes: firstly configuring the door lock delivery time, wherein the door lock delivery time configuring step comprises the following steps:
step S101: if the temporary password does not exist, the configuration key is pressed for a long time for 3s, and a factory time module of the configuration door lock is started;
step S102: inputting a corresponding password of factory set time, and entering a door lock delivery time setting interface;
step S103: inputting 4-digit number representing year, pressing a confirmation key and storing;
step S104: inputting 2-digit numbers to represent months, pressing a confirmation key and storing;
step S105: inputting 2-digit number representing date, pressing a confirmation key and storing;
step S106: inputting 2-digit numbers to represent hours, pressing a confirmation key and storing;
step S107: inputting 2-digit numbers representing minutes, pressing a confirmation key and storing;
step S108: inputting 2 digit number representing seconds, pressing the confirm key and saving; finishing configuring the delivery time of the door lock;
the door lock time reading module obtains the current time information by reading the door lock factory time module.
3. The DES algorithm-based door lock password generation method of claim 1, wherein: in step S1, the door lock ID address is composed of 6 bytes, a value range of each byte is 0 to 9, and the configuration method of the door lock ID address specifically includes:
step S111: the configuration key 3s of the door lock ID address configuration module is pressed for a long time under the condition that the temporary password does not exist, and the door lock ID address configuration module is started;
step S112: inputting a corresponding password of a door lock ID address set by a manufacturer, and entering a door lock ID address configuration interface;
step S113: inputting 6-digit numbers to represent the ID address of the door lock, pressing a confirmation key and storing;
completing the configuration of the ID address of the door lock.
4. The DES algorithm-based door lock password generation method according to claim 1, wherein: the first byte of the plaintext represents the last two years, the second byte represents the month, the third bit represents the date, the fourth bit represents the time, the fifth bit represents the valid days, the sixth byte represents the 1 st and 2 nd bits of the door lock ID address, the seventh byte represents the 3 rd and 4 th bits of the door lock ID address, and the eighth byte represents the 5 th and 6 th bits of the door lock ID address.
5. A password management method based on the DES algorithm-based door lock password generation method of any one of claims 1 to 4, characterized in that: the method comprises the following steps:
h1: acquiring a password input by a user, judging whether an effective password exists, if so, indicating that the password is in a binding stage at present, and taking the effective password as a unique available password until the time efficiency is expired; the valid password is a password which is correctly verified by the user and is still within the valid period;
h2: if no valid password exists, inquiring and matching the password input by the user from the 31 groups of valid passwords B, when the Nth group of passwords is matched, indicating that the valid passwords B can be used for N days, and calculating the valid time as the current time plus the seconds of N days;
h3: and storing the Nth group of passwords and the valid time N days as valid information to be used as a valid password for waking up next time.
CN201910012371.4A 2019-01-07 2019-01-07 Door lock password generation method based on DES algorithm and password management method thereof Active CN109787749B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910012371.4A CN109787749B (en) 2019-01-07 2019-01-07 Door lock password generation method based on DES algorithm and password management method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910012371.4A CN109787749B (en) 2019-01-07 2019-01-07 Door lock password generation method based on DES algorithm and password management method thereof

Publications (2)

Publication Number Publication Date
CN109787749A CN109787749A (en) 2019-05-21
CN109787749B true CN109787749B (en) 2022-05-10

Family

ID=66499151

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910012371.4A Active CN109787749B (en) 2019-01-07 2019-01-07 Door lock password generation method based on DES algorithm and password management method thereof

Country Status (1)

Country Link
CN (1) CN109787749B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114445936B (en) * 2022-01-21 2023-06-16 珠海格力电器股份有限公司 Door lock control method and device, door lock and storage medium
CN115171247A (en) * 2022-06-24 2022-10-11 广东汇泰龙科技股份有限公司 Intelligent lock, storage method, decryption method and storage medium
CN115277225A (en) * 2022-07-29 2022-11-01 京东方科技集团股份有限公司 Data encryption method, data decryption method and related equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471903A (en) * 2015-12-31 2016-04-06 中国建设银行股份有限公司 Method for generating electronic lock activation information and related system, device and unlocking method
CN106131179A (en) * 2016-07-05 2016-11-16 林哲敏 The password Rights Management System of a kind of intelligent door lock and method
CN106780880A (en) * 2016-12-12 2017-05-31 国网北京市电力公司 Method for generating cipher code, device and smart lock

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10158490B2 (en) * 2015-08-17 2018-12-18 The Boeing Company Double authentication system for electronically signed documents

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105471903A (en) * 2015-12-31 2016-04-06 中国建设银行股份有限公司 Method for generating electronic lock activation information and related system, device and unlocking method
CN106131179A (en) * 2016-07-05 2016-11-16 林哲敏 The password Rights Management System of a kind of intelligent door lock and method
CN106780880A (en) * 2016-12-12 2017-05-31 国网北京市电力公司 Method for generating cipher code, device and smart lock

Also Published As

Publication number Publication date
CN109787749A (en) 2019-05-21

Similar Documents

Publication Publication Date Title
CN109787749B (en) Door lock password generation method based on DES algorithm and password management method thereof
CN1326353C (en) Method and system for integrated protection of data distributed processing in computer networks
CN1716855B (en) Call signs
US9467293B1 (en) Generating authentication codes associated with devices
US8208627B2 (en) Format-preserving cryptographic systems
US11488134B2 (en) Format-preserving cryptographic systems
US9306741B1 (en) Updating keys for use in authentication
GB2513260A (en) System and method for quorum-based data recovery
JP2013535903A (en) Encryption apparatus and method
CN101535845A (en) Authenticated radio frequency identification and key distribution system therefor
US20050166061A1 (en) Generation and managenent if customer pin's
CN104104517A (en) Method and system for verification of one time password
WO2004051585A2 (en) Identity authentication system and method
EP3313020B1 (en) Method of digital identity generation and authentication
US20030038707A1 (en) Method for secured identification of user's id
KR20200064663A (en) method and system of smart electronic contracting based on block chain
CN108989051B (en) Method for generating dynamic password
CN109104444B (en) Electronic signature method based on block chain
CN110298941A (en) A kind of disposable temporary password generation method of intelligent door lock
CN103580861A (en) Dynamic security authentication method and system
CN109636997B (en) Anonymous voting method using mobile intelligent terminal
CN113726512A (en) Key generation and distribution method, key generation device, and key management system
TW202211647A (en) Communication system, transmission device, receiving device, communication method and programming products dealing with noise received by data to be transmitted
CN106910149A (en) Replacement number generation system and the generation method of a kind of citizen ID certificate number
CN114495330B (en) Method for setting temporary fingerprint in authorization manner

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant