CN110766831B - Dynamic two-dimensional code generation method and device and storage medium - Google Patents

Dynamic two-dimensional code generation method and device and storage medium Download PDF

Info

Publication number
CN110766831B
CN110766831B CN201910947128.1A CN201910947128A CN110766831B CN 110766831 B CN110766831 B CN 110766831B CN 201910947128 A CN201910947128 A CN 201910947128A CN 110766831 B CN110766831 B CN 110766831B
Authority
CN
China
Prior art keywords
dimensional code
user information
timestamp
key
dynamic
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
CN201910947128.1A
Other languages
Chinese (zh)
Other versions
CN110766831A (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.)
Chongqing Yuwu Technology Co.,Ltd.
Original Assignee
Shenzhen Shenlan Vision Technology Co ltd
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 Shenzhen Shenlan Vision Technology Co ltd filed Critical Shenzhen Shenlan Vision Technology Co ltd
Priority to CN201910947128.1A priority Critical patent/CN110766831B/en
Publication of CN110766831A publication Critical patent/CN110766831A/en
Application granted granted Critical
Publication of CN110766831B publication Critical patent/CN110766831B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/00174Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys
    • G07C9/00309Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/00174Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys
    • G07C9/00309Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks
    • G07C2009/00412Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks the transmitted data signal being encrypted
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C9/00Individual registration on entry or exit
    • G07C9/00174Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys
    • G07C9/00309Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks
    • G07C2009/0042Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks the transmitted data signal containing a code which is changed
    • G07C2009/00476Electronically operated locks; Circuits therefor; Nonmechanical keys therefor, e.g. passive or active electrical keys or other data carriers without mechanical keys operated with bidirectional data transmission between data carrier and locks the transmitted data signal containing a code which is changed dynamically

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

The application belongs to the technical field of two-dimension code generation, and provides a dynamic two-dimension code generation method, a device and a storage medium, wherein the dynamic two-dimension code generation method comprises the following steps: acquiring current time information at a preset refreshing frequency to generate a timestamp; when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp; encrypting the user information by adopting the determined key to generate a ciphertext; generating a new frame of two-dimensional code image according to the timestamp and the ciphertext; and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code. The embodiment of the application solves the problem of low safety of the static two-dimensional code by generating the dynamic two-dimensional code.

Description

Dynamic two-dimensional code generation method and device and storage medium
Technical Field
The invention relates to the technical field of two-dimension code generation, in particular to a dynamic two-dimension code generation method, a dynamic two-dimension code generation device and a storage medium.
Background
In order to improve the safety of residential buildings in residential areas and the security of office buildings, door locks or access controls are usually installed at the entrance and exit of the buildings. And along with the development of science and technology nowadays, entrance guard or lock also are along with upgrading into smart machine. At present, the intelligent access control or door lock on the market mostly adopts a radio frequency card technology, a fingerprint technology, a face identification technology or a two-dimensional code identification technology. Compared with an intelligent door lock or door lock realized by other identification technologies, the intelligent door lock or door lock realized by the two-dimensional code identification technology has the advantages of low cost, more convenience in use and wider application.
The existing entrance guard or door lock for identifying the two-dimensional code mostly carries out identity verification on the static two-dimensional code of the user, but the static two-dimensional code is easily copied by modes such as photographing and the like, so that hidden dangers are caused to the safety of an intelligent door lock or entrance guard.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method, an apparatus, and a storage medium for generating a dynamic two-dimensional code, so as to solve the problem of low security of a static two-dimensional code.
A first aspect of an embodiment of the present invention provides a method for generating a dynamic two-dimensional code, including:
acquiring current time information at a preset refreshing frequency to generate a timestamp;
when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp;
encrypting the user information by adopting the determined key to generate a ciphertext;
generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code.
In one example, the determining a key for encrypting user information according to a newly generated timestamp includes:
and selecting the key corresponding to the latest generated timestamp from a key pool according to a preset rule.
In one implementation example, before obtaining the current time information at the preset refresh frequency to generate the timestamp, the method further includes:
and splitting the user information into a plurality of user information subdata.
In one embodiment, the encrypting the user information with the determined key to generate a ciphertext includes:
selecting corresponding user information subdata according to an encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority;
and encrypting the selected user information subdata by adopting the determined key to generate a ciphertext.
A second aspect of an embodiment of the present invention provides an intelligent device, including:
the timestamp generating module is used for acquiring current time information at a preset refreshing frequency to generate a timestamp;
the key determining module is used for determining a key for encrypting the user information according to the latest generated timestamp when each timestamp is generated;
the ciphertext generating module is used for encrypting the user information by adopting the determined key to generate a ciphertext;
the two-dimensional code image generation module is used for generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and the dynamic two-dimensional code generation module is used for updating the displayed image information into the new frame of two-dimensional code image so as to generate the dynamic two-dimensional code.
In one example implementation, the key determination module includes:
and the key selecting unit is used for selecting the key corresponding to the latest generated timestamp from the key pool according to a preset rule.
In one implementation example, the smart device further comprises:
and the data splitting module is used for splitting the required user information into a plurality of user information subdata.
In one example, the ciphertext generation module may include:
the subdata selection unit is used for selecting corresponding user information subdata according to the encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority;
and the ciphertext generating unit is used for encrypting the user information subdata by adopting the determined key to generate a ciphertext.
A third aspect of embodiments of the present invention provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of the method of the first aspect.
A fourth aspect of an embodiment of the present invention provides an intelligent device, including: the dynamic two-dimensional code generating method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the dynamic two-dimensional code generating method in the first aspect when executing the computer program.
According to the dynamic two-dimensional code generation method, the device and the storage medium provided by the embodiment of the invention, the timestamp is generated by acquiring the current time information at the preset refreshing frequency; when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp; encrypting the user information by adopting the determined key to generate a ciphertext; generating a new frame of two-dimensional code image according to the timestamp and the ciphertext; and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code. The generated dynamic two-dimensional code refreshes the two-dimensional code image at a preset refreshing frequency, and the time stamps contained in each frame of the two-dimensional code image are different. And determining a key to encrypt the user information according to the time stamp, so that the key for encrypting the user information in each frame of the two-dimensional code image is different. Therefore, independent encryption is realized, and the encryption property and the non-replicability of the generated dynamic two-dimensional code are enhanced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a dynamic two-dimensional code generation method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a dynamic two-dimensional code generation method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an intelligent device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an intelligent device according to a fifth embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention and the above-described drawings are intended to cover non-exclusive inclusions. For example, a process, method, or system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
Example one
Fig. 1 is a schematic flow chart of a dynamic two-dimensional code generation method according to an embodiment of the present invention. The method can be applied to an application scene of generating the two-dimensional code by the intelligent equipment or the intelligent device, the method can be executed by the intelligent device, and the control device can be an intelligent bracelet, an intelligent terminal, a tablet or an intelligent watch and the like; in the embodiment of the present invention, an intelligent device is used as an execution subject for explanation, and the method specifically includes the following steps:
s110, acquiring current time information at a preset refreshing frequency to generate a timestamp;
the two-dimensional code generated by the smart device may carry data information, for example, when the smart device generates a two-dimensional code for unlocking, the two-dimensional code may carry user information (such as a user name and password). In order to generate the dynamic two-dimensional code and realize that the time information carried by the current frame displayed after the dynamic two-dimensional code is refreshed each time is updated along with the refreshing frequency, the intelligent device can acquire the current time information of the intelligent device according to the preset refreshing frequency and generate the timestamp. Specifically, the intelligent device acquires current time information of the intelligent device once every time interval corresponding to a preset refresh frequency, and generates a corresponding timestamp according to the time information after acquiring the time information. The current time information of the intelligent device can be the time information of the intelligent device after networking, so that the time information is more accurate. Because the timestamp is data carried by the two-dimensional code, the generated timestamp needs to be subjected to standard encryption processing, so that time information contained in the timestamp is prevented from being easily read by scanning the two-dimensional code. Alternatively, the standard Encryption process may include aes (advanced Encryption standard) algorithm Encryption or RC4(Rivest Cipher 4) algorithm Encryption, or the like.
Optionally, the preset refresh frequency can be reasonably set according to the performance of the processor of the unlocking device or the intelligent door lock, and the higher the preset refresh frequency is, the higher the safety is. The time information included in the time stamp is expressed in the number of milliseconds or seconds elapsed from a reference time (e.g., 1/00: 00:00 in 1970).
S120, when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp;
and after the intelligent device generates a time stamp according to the current time information every time, determining a key for encrypting the preset user information to be carried according to the time stamp. In an implementation example, the key corresponding to the latest generated timestamp may be selected from a key pool according to a preset rule. Specifically, a key pool dedicated to user information data encryption can be preset, and a key corresponding to a newly generated timestamp is linearly selected from the key pool according to a preset rule, so that keys for encrypting user information in each frame of two-dimensional code image are different. Thus, independent encryption of user information data is realized.
In one embodiment, the preset rule may be to select a key corresponding to the timestamp from a key pool according to the data parity of the timestamp. Specifically, if there are 2 groups of keys (keys) in the preset key pool, key 1: 1357, preparing a mixture; key2: 2468. When the data of the latest generated timestamp is an even number, selecting a key2 from a key pool according to a preset rule as a key for encrypting user information; when the data of the latest generated timestamp is odd, the key1 is selected from the key pool according to the preset rule as the key for encrypting the user information.
In another embodiment, the preset rule may be to select a key corresponding to the timestamp from the key pool according to a correspondence between the last digit of the timestamp data and the key in the key pool. Alternatively, the correspondence between the last digit of the timestamp data and the key in the key pool may be that the last digit of the timestamp data corresponds to the key numbered as that digit. For example, if there are 10 groups of keys (keys) in the preset key pool:
key1:11111111;
key2:22222222;
key3:33333333;
key4:44444444;
key5:55555555;
key6:66666666;
key7:77777777;
key8:88888888;
key9:99999999;
key0:00000000;
when the last digit of the timestamp data is '1', selecting a key1 from the key pool as a key for encrypting the user information according to a preset rule; when the last number of the timestamp data is '2', selecting a key2 from the key pool as a key for encrypting the user information according to a preset rule; and by analogy, when the last digit of the timestamp data is other digits, selecting a corresponding key from the key pool according to a preset rule as the key for encrypting the user information.
S130, encrypting the user information by adopting the determined key to generate a ciphertext;
and after determining the key according to the timestamp, encrypting the preset user information to be carried by adopting the key to generate a ciphertext. The user information to be carried can be login account information or user information input in advance.
S140, generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and when each time stamp is generated, determining a secret key for encrypting the user information according to the time stamp and encrypting the user information to generate a ciphertext, and generating a new frame of two-dimensional code image by the intelligent device according to the time stamp and the generated ciphertext. The two-dimensional code image comprises a timestamp, a ciphertext corresponding to the user information and a two-dimensional code serial number; the two-dimensional code serial numbers contained in the generated two-dimensional code images are different. In an implementation example, when the user information is encrypted by using the key determined by the timestamp, all the user information to be carried by the two-dimensional code may be encrypted at one time. In an application scenario, a user can log in a pre-registered or registered account through an intelligent device to generate a dynamic two-dimensional code, and user information to be carried can be data information such as a user name and a password of the account. When a user does not change a login account number, acquiring current time information at a preset refreshing frequency to generate a timestamp, and determining a key for encrypting user information from a key pool according to the newly generated timestamp; then, encrypting all required user information once by adopting the determined key to generate a ciphertext; and then generating a new frame of two-dimensional code image according to the time stamp and the generated ciphertext, so that each newly generated two-dimensional code image contains complete user information required to be carried.
And S150, updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code.
After a new frame of two-dimensional code image is generated according to the time stamp and the ciphertext corresponding to the user information, the image information displayed by the intelligent device is updated to the new frame of two-dimensional code image, so that a dynamic two-dimensional code which refreshes the two-dimensional code image at a preset refreshing frequency is generated, and the time stamp and the serial number contained in each frame of two-dimensional code image are different.
According to the dynamic two-dimensional code generation method provided by the embodiment of the invention, the timestamp is generated by acquiring the current time information at the preset refreshing frequency; when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp; encrypting the user information by adopting the determined key to generate a ciphertext; generating a new frame of two-dimensional code image according to the timestamp and the ciphertext; and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code. The generated dynamic two-dimensional code refreshes the two-dimensional code image at a preset refreshing frequency, and the time stamps contained in each frame of the two-dimensional code image are different. And determining a key to encrypt the user information according to the time stamp, so that the key for encrypting the user information in each frame of the two-dimensional code image is different. Therefore, independent encryption is realized, and the encryption property and the non-replicability of the generated dynamic two-dimensional code are enhanced. And when the generated dynamic two-dimensional code is used for unlocking after being collected by the unlocking device, the timestamp contained in a new frame of two-dimensional code image generated in each refreshing process can be used for correcting the system time of the unlocking device.
Example two
Fig. 2 is a schematic flow chart of a dynamic two-dimensional code generation method according to a second embodiment of the present invention. On the basis of the first embodiment, the embodiment further provides a dynamic two-dimensional code generation method that each generated two-dimensional code image contains different user information subdata, so that the complexity of the dynamic two-dimensional code is reduced, and the time consumption for identifying the dynamic two-dimensional code is reduced. The method specifically comprises the following steps:
s210, splitting the user information into a plurality of user information subdata;
when the data contained in the two-dimensional code is excessive, the complexity of the two-dimensional code is too high. When the unlocking device or the intelligent door lock identifies and verifies the dynamic two-dimensional code with high complexity, the phenomenon that the time consumption for identifying the dynamic two-dimensional code is too long can be caused by especially examining the data processing performance of the unlocking device or the intelligent door lock. In order to reduce the complexity of the dynamic two-dimensional code and facilitate the reduction of the identification time consumption of the dynamic two-dimensional code, the user information required to be carried by the dynamic two-dimensional code (such as required for verification) can be split into a plurality of user information subdata containing different information, so that the data volume contained by the two-dimensional code is reduced. Specifically, if the user information includes a user name and a password; the user information can be split into two user information subdata, one user information subdata comprises user name data, and the other user information subdata comprises password data.
S220, acquiring current time information at a preset refreshing frequency to generate a timestamp;
in order to generate the dynamic two-dimensional code and realize that the time information carried by the current frame displayed after the dynamic two-dimensional code is refreshed each time is updated along with the refreshing frequency, the intelligent device can acquire the current time information of the intelligent device according to the preset refreshing frequency and generate the timestamp.
S230, when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp;
s240, selecting corresponding user information subdata according to an encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority;
in order to reduce the complexity of the generated two-dimensional code, corresponding user information subdata can be selected from a plurality of user information subdata split from user information according to an encryption rule for encryption. Specifically, an encryption rule may be preset, where the encryption rule includes a cycle sequence in which a plurality of user information sub-data split from the user information are sequentially encrypted according to the encryption priority.
And after the intelligent device generates each time stamp, selecting corresponding user information data sub-data according to an encryption rule to encrypt and generate a ciphertext according to a key determined by the newly generated time stamp. Therefore, a new two-dimensional code image generated according to the newly generated timestamp and the ciphertext generated by encrypting the selected user information subdata has different time information and user information compared with the previous two-dimensional code image, the complexity of the two-dimensional code image is reduced, and the phenomenon that the identification time of the two-dimensional code is too long is avoided.
For example, if the user information to be carried includes a user name and a password, the user information may be split into two pieces of sub-data, namely, the user name and the password. The preset encryption sequence may be to encrypt the user name and the password sequentially and circularly in sequence. And after each time stamp is generated, adopting a key determined by the newly generated time stamp, and if the corresponding user information subdata is selected as the user name according to the encryption rule, selecting the corresponding user information subdata as the password according to the encryption rule after the next time stamp is generated.
S250, encrypting the selected user information subdata by adopting the determined key to generate a ciphertext;
s260, generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and after each timestamp is generated, selecting corresponding user information subdata according to an encryption rule by adopting a key determined by the newly generated timestamp, encrypting the selected user information subdata to generate a ciphertext, and then generating a new frame of two-dimensional code image according to the newly generated timestamp and the ciphertext. If the data information contained in the new frame of two-dimensional code image is a ciphertext corresponding to the timestamp and the user name; the data information contained in the next two-dimensional code image is the time stamp and the password.
For example, if the user information includes: the user name (admin) and the user password (123456) are used as the sub-data, and the dynamic two-dimensional code is refreshed and displayed at the preset refreshing frequency of 300 ms. The display effect is as follows:
the two-dimensional code displayed in the first frame comprises the following data content: a user name, a timestamp and a two-dimensional code serial number;
example (c): admin-0-1
The second frame displays the two-dimensional code and comprises the following data content: a user password, a timestamp and a two-dimensional code serial number;
example (c): 123456-300-2
The third frame displays that the two-dimensional code contains data content: a user name, a timestamp and a two-dimensional code serial number;
example (c): admin-600-3
The fourth frame displays that the two-dimensional code contains data content: a user password, a timestamp and a two-dimensional code serial number;
example (c): 123456-900-4
……
And S270, updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code.
After a new frame of two-dimensional code image is generated according to the time stamp and the ciphertext corresponding to the selected user information subdata, the image information displayed by the intelligent device is updated to the new frame of two-dimensional code image, so that a dynamic two-dimensional code for refreshing the two-dimensional code image at a preset refreshing frequency is generated, and each frame of two-dimensional code image contains different ciphertexts corresponding to different user information subdata and contains different time stamps and serial numbers.
EXAMPLE III
Fig. 3 shows an intelligent device according to a third embodiment of the present invention. On the basis of the first and second embodiments, the embodiment of the present invention further provides an intelligent device 3, including:
a timestamp generating module 301, configured to obtain current time information according to a preset refresh frequency to generate a timestamp;
a key determining module 302, configured to determine, when each timestamp is generated, a key for encrypting user information according to a timestamp that is generated most recently;
in one example, the key for encrypting the user information is determined according to the latest generated timestamp, and the key determining module 302 includes:
and the key selecting unit is used for selecting the key corresponding to the latest generated timestamp from the key pool according to a preset rule.
A ciphertext generating module 303, configured to encrypt the user information by using the determined key to generate a ciphertext;
in an embodiment, when the user information is encrypted by using the determined key to generate a ciphertext, the ciphertext generating module 303 includes:
the subdata selection unit is used for selecting corresponding user information subdata according to the encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority;
and the ciphertext generating unit is used for encrypting the selected user information subdata by adopting the determined key to generate a ciphertext.
A two-dimensional code image generating module 304, configured to generate a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and a dynamic two-dimensional code generating module 305, configured to update the displayed image information to the new frame of two-dimensional code image, so as to generate a dynamic two-dimensional code.
In one implementation example, the smart device further comprises:
and the data splitting module is used for splitting the user information into a plurality of user information subdata.
According to the intelligent device provided by the embodiment of the invention, the timestamp is generated by acquiring the current time information at the preset refreshing frequency; when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp; encrypting the user information by adopting the determined key to generate a ciphertext; generating a new frame of two-dimensional code image according to the timestamp and the ciphertext; and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code. The generated dynamic two-dimensional code refreshes the two-dimensional code image at a preset refreshing frequency, and the time stamps contained in each frame of the two-dimensional code image are different. And determining a key to encrypt the user information according to the time stamp, so that the key for encrypting the user information in each frame of the two-dimensional code image is different. Therefore, independent encryption is realized, and the encryption property and the non-replicability of the generated dynamic two-dimensional code are enhanced.
Example four
The fourth embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the dynamic two-dimensional code generation method in the first embodiment or the second embodiment are implemented.
Of course, the processor-executable instructions of the computer-readable storage medium provided in the embodiment of the present invention are not limited to the method operations described above, and may also perform related operations in the dynamic two-dimensional code generation method provided in any embodiment of the present invention.
EXAMPLE five
Fig. 4 is a schematic structural diagram of an intelligent device according to a fifth embodiment of the present invention. The device 4 comprises: a processor 41, a memory 42 and a computer program 43 stored in said memory 42 and executable on said processor 41, such as a program for a dynamic two-dimensional code generation method. The processor 41 implements the steps in the above-mentioned embodiment of the dynamic two-dimensional code generation method, such as steps S110 to S150 shown in fig. 1, when executing the computer program 43.
Illustratively, the computer program 43 may be partitioned into one or more modules that are stored in the memory 42 and executed by the processor 41 to accomplish the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 43 in the apparatus. For example, the computer program 43 may be divided into a timestamp generation module, a key determination module, a ciphertext generation module, a two-dimensional code image generation module, and a dynamic two-dimensional code generation module, and each module has the following specific functions:
the timestamp generating module is used for acquiring current time information at a preset refreshing frequency to generate a timestamp;
the key determining module is used for determining a key for encrypting the user information according to the latest generated timestamp when each timestamp is generated;
the ciphertext generating module is used for encrypting the user information by adopting the determined key to generate a ciphertext;
the two-dimensional code image generation module is used for generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and the dynamic two-dimensional code generation module is used for updating the displayed image information into the new frame of two-dimensional code image so as to generate the dynamic two-dimensional code.
The apparatus may include, but is not limited to, a processor 41, a memory 42, and a computer program 43 stored in the memory 42. Those skilled in the art will appreciate that fig. 4 is merely an example of a smart device and does not constitute a limitation of the device and may include more or less components than those shown, or combine certain components, or different components, for example the device may also include input output devices, network access devices, buses, etc.
The Processor 41 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 42 may be an internal storage unit of the smart device, such as a hard disk or a memory of the smart device. The memory 42 may also be an external storage device, such as a plug-in hard disk provided on a Smart device, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 42 may also include both an internal storage unit of the apparatus and an external storage device. The memory 42 is used for storing the computer program and other programs and data required for the dynamic two-dimensional code generation method. The memory 42 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (6)

1. A dynamic two-dimensional code generation method is characterized by comprising the following steps:
acquiring current time information at a preset refreshing frequency to generate a timestamp;
when each timestamp is generated, determining a key for encrypting user information according to the latest generated timestamp;
splitting the user information into a plurality of user information subdata;
encrypting the user information by using the determined key to generate a ciphertext, comprising: selecting corresponding user information subdata according to an encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority; encrypting the selected user information subdata by adopting the determined key to generate a ciphertext;
generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
and updating the displayed image information into the new frame of two-dimensional code image to generate a dynamic two-dimensional code.
2. The dynamic two-dimensional code generation method according to claim 1, wherein said determining a key for encrypting user information according to a newly generated timestamp comprises:
and selecting the key corresponding to the latest generated timestamp from a key pool according to a preset rule.
3. A smart device, comprising:
the timestamp generating module is used for acquiring current time information at a preset refreshing frequency to generate a timestamp;
the key determining module is used for determining a key for encrypting the user information according to the latest generated timestamp when each timestamp is generated;
the ciphertext generating module is used for encrypting the user information by adopting the determined key to generate a ciphertext;
the two-dimensional code image generation module is used for generating a new frame of two-dimensional code image according to the timestamp and the ciphertext;
the dynamic two-dimensional code generating module is used for updating the displayed image information into the new frame of two-dimensional code image so as to generate a dynamic two-dimensional code;
the intelligent device further comprises: the data splitting module is used for splitting the user information into a plurality of user information subdata;
the ciphertext generating module comprises:
the subdata selection unit is used for selecting corresponding user information subdata according to the encryption rule; the encryption rule comprises a circulation sequence of the plurality of user information subdata which are sequentially encrypted according to the encryption priority;
and the ciphertext generating unit is used for encrypting the selected user information subdata by adopting the determined key to generate a ciphertext.
4. The smart device of claim 3, wherein the key determination module comprises:
and the key selecting unit is used for selecting the key corresponding to the latest generated timestamp from the key pool according to a preset rule.
5. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the dynamic two-dimensional code generation method according to claim 1 or 2.
6. An intelligent device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the dynamic two-dimensional code generation method of claim 1 or 2 when executing the computer program.
CN201910947128.1A 2019-09-29 2019-09-29 Dynamic two-dimensional code generation method and device and storage medium Active CN110766831B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910947128.1A CN110766831B (en) 2019-09-29 2019-09-29 Dynamic two-dimensional code generation method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910947128.1A CN110766831B (en) 2019-09-29 2019-09-29 Dynamic two-dimensional code generation method and device and storage medium

Publications (2)

Publication Number Publication Date
CN110766831A CN110766831A (en) 2020-02-07
CN110766831B true CN110766831B (en) 2021-08-20

Family

ID=69330968

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910947128.1A Active CN110766831B (en) 2019-09-29 2019-09-29 Dynamic two-dimensional code generation method and device and storage medium

Country Status (1)

Country Link
CN (1) CN110766831B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111523630B (en) * 2020-04-21 2024-04-19 中钞印制技术研究院有限公司 Two-dimensional code encoding method and device, and two-dimensional code recognition method and device
CN112418373A (en) * 2020-09-29 2021-02-26 武汉格事化信息技术有限公司 Internet of things dynamic two-dimensional code generation method, storage medium and system
CN113891070B (en) * 2021-10-29 2023-12-15 北京环境特性研究所 Method and device for measuring delay time of network camera

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022337A (en) * 2007-03-28 2007-08-22 胡祥义 Network identification card realizing method
CN104463296A (en) * 2014-11-10 2015-03-25 吴涛军 Two-dimension code structured information generation, obtaining and processing method and system
CN105095728A (en) * 2015-06-15 2015-11-25 南京市信息中心 Two-dimensional code identification method based on digital signatures and timestamps
CN107579817A (en) * 2017-09-12 2018-01-12 广州广电运通金融电子股份有限公司 User ID authentication method, apparatus and system based on block chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9721071B2 (en) * 2011-06-29 2017-08-01 Sonic Ip, Inc. Binding of cryptographic content using unique device characteristics with server heuristics
US9652913B2 (en) * 2015-06-05 2017-05-16 Brivo Systems, Llc Geo-location estimate (GLE) sensitive physical access control apparatus, system, and method of operation
CN107277059A (en) * 2017-08-08 2017-10-20 沈阳东青科技有限公司 A kind of one-time password identity identifying method and system based on Quick Response Code
CN108650082B (en) * 2018-05-08 2020-10-30 腾讯科技(深圳)有限公司 Encryption and verification method of information to be verified, related device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022337A (en) * 2007-03-28 2007-08-22 胡祥义 Network identification card realizing method
CN104463296A (en) * 2014-11-10 2015-03-25 吴涛军 Two-dimension code structured information generation, obtaining and processing method and system
CN105095728A (en) * 2015-06-15 2015-11-25 南京市信息中心 Two-dimensional code identification method based on digital signatures and timestamps
CN107579817A (en) * 2017-09-12 2018-01-12 广州广电运通金融电子股份有限公司 User ID authentication method, apparatus and system based on block chain

Also Published As

Publication number Publication date
CN110766831A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
CN110766831B (en) Dynamic two-dimensional code generation method and device and storage medium
US9525550B2 (en) Method and apparatus for securing a mobile application
US9467293B1 (en) Generating authentication codes associated with devices
AU2013101034A4 (en) Registration and authentication of computing devices using a digital skeleton key
EP3337088A1 (en) Data encryption method, decryption method, apparatus, and system
CN105005731A (en) Data encryption and decryption methods and mobile terminal
CN104992120A (en) Picture encryption method and mobile terminal
WO2012131675A2 (en) Authentication system with time attributes
CN108429618A (en) A kind of the symmetric key synchronous method and device of no channel
CN108549824A (en) A kind of data desensitization method and device
CN114780923A (en) Electronic seal management and control method and system
CN107248972B (en) Data encryption and decryption method and device and electronic equipment
CN111177748A (en) Fingerprint storage encryption method, device and system
CN110718004B (en) Unlocking method and device and storage medium
CN111818376A (en) Password setting method, smart television, electronic equipment and readable storage medium
CN116204903A (en) Financial data security management method and device, electronic equipment and storage medium
CN115935391A (en) Card manufacturing method, card issuing method, device, medium, and program product for IC card
CN111885510B (en) Attendance checking method, attendance checking client and attendance checking system
US9398005B1 (en) Managing seed provisioning
US20210203490A1 (en) Managing central secret keys of a plurality of user devices associated with a single public key
CN106992861B (en) RFID (radio frequency identification) key wireless generation method and system with EPC (electronic product code) tag
CN111371563A (en) Password verification method and device, electronic equipment and storage medium
CN115348093A (en) Picture verification method and device, storage medium and picture verification equipment
CN116108412A (en) Face identity authentication method, device, equipment, storage medium and program product
KR101449680B1 (en) Method and Server for user authentication

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
TR01 Transfer of patent right

Effective date of registration: 20231223

Address after: No. 15-6, Building 9, No. 178 Shixin Road, Jiulongpo District, Chongqing, 400000

Patentee after: Chongqing Yuwu Technology Co.,Ltd.

Address before: 518000 room 119, building D, Zhihui innovation center, Hangcheng Industrial Zone, Taoyuan community, Xixiang street, Bao'an District, Shenzhen City, Guangdong Province

Patentee before: Shenzhen Shenlan Vision Technology Co.,Ltd.

TR01 Transfer of patent right