CN105279442A - Efficient method for verifying permission of electronic key - Google Patents

Efficient method for verifying permission of electronic key Download PDF

Info

Publication number
CN105279442A
CN105279442A CN201510610169.3A CN201510610169A CN105279442A CN 105279442 A CN105279442 A CN 105279442A CN 201510610169 A CN201510610169 A CN 201510610169A CN 105279442 A CN105279442 A CN 105279442A
Authority
CN
China
Prior art keywords
lock
data
identification code
call number
index data
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.)
Pending
Application number
CN201510610169.3A
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201510610169.3A priority Critical patent/CN105279442A/en
Publication of CN105279442A publication Critical patent/CN105279442A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

This invention discloses an efficient method for verifying permission of an electronic key. The method comprises the following steps: S1, a lock index information area with continuous addresses is arranged in a flash memory space of the electronic key to continuously store lock index data; S2, an index number is provided for each lock index data in sequence according to the address storing sequence of the lock index data, and the index number is in one-to-one correspondence to the lock index data; S3, a lock data information area with continuous addresses is arranged in the flash memory space of the electronic key to continuously store lock identification code data; S4, each lock index data is in one-to-one correspondence to the lock identification code data, and each lock index data is starting storage addresses corresponding to lock identification code data. The method of this invention has the characteristics of quick search and simple algorithm; the required lock identification code data can be searched quickly and accurately only through two times of simple address mapping calculations; moreover, the system resource consumption is small; since the data information is stored in a continuous mode, the occupation of the system space can be reduced effectively.

Description

A kind of high efficiency electron key method for verifying authority
Technical field
The present invention relates to a kind of electron key method for verifying authority, especially for the efficient method for verifying authority fast of the electron key of large quantity (reaching more than 10,000).
Background technology
Electron key generally adopts MCU(micro-control unit, MicrocontrollerUnit) realize, its processing power and memory headroom are all smaller.When the seek scope of electron key is less, during the negligible amounts of namely electron key, no matter take what method to search, the time spent is all very nearly the same.In this case, simple on algorithm, and storage format is required that lower linear search just can meet our requirement undoubtedly.But when the scope that will search reaches to a certain degree, existing querying method is consuming time, and system processing power, the problem on system resources consumption and restriction just highlight gradually.When the quantity of electron key is larger, process especially will be difficult on electron key Authority Verification.
Querying method conventional in prior art has following several, comprising: linear search, binary search, Fibonacci searches and interpolation is searched.
Linear search, is sequential search again, is to search the first stroke data to compare from array, if found, returns to this value or this position, if do not found, it is investigated to look for compare toward next stroke count, until find finishing touch data.Linear search is simple in thinking, and code easily realizes, and one when being a small amount of electron key of process is well selected; But the time complexity due to its long-run average is O (n), along with the increase of electron key data volume, its efficiency just obviously reduces, and at this moment we just should select other method.
Binary search, is binary chop again, and it takes full advantage of the order relation between data, adopts divide-and-conquer strategy, can complete search mission in the worst case with the time of O (logn).The basic thought of the method is, n data are divided into the roughly the same two halves of number, gets a [n/2] and makes comparisons for the x searched, if x=a [n/2], then finds x, and algorithm stops.If x<a [n/2], as long as the data that then we suppose in array at the left side of array a continuation search x(are ascending order arrangement herein).If x>a [n/2], as long as then we continue search x at the right-hand part of array a.The application of binary search is extremely extensive, and its thought easy to understand; But when the data volume of electron key large to a certain extent time, just need a large amount of system resource, or need a large amount of time to carry out sorting operation.
Fibonacci searches and searches with interpolation, it is all the distortion of binary search, and similar with binary search method, Fibonacci searches and searches with interpolation is data search scope cut in half, until can determine that concrete position or the data of searching are not within scope.But they also have certain difference in efficiency and range of application.Binary search uses division arithmetic to reduce seek scope, and Fibonacci searches, and make use of Fibonacci ordered series of numbers and sets up corresponding tree structure, in the process reduced the scope, only used plus-minus method.Due in computer disposal operational order, the efficiency of plus and minus calculation is higher than multiplication and division computing, so the efficiency that Fibonacci searches also can be better than binary search.But for the data of inequality distribution, but and bad, even under the worst situation, time complexity reaches identical with linear search to its efficiency.
For electron key, the information of particular lock to be retrieved from 10,000 even more locks, use algorithm that is complicated and occupying system resources with existing resource, cannot realize at all, but realize by simple method and need to take the longer time, it is very poor that interactivity becomes.
Summary of the invention
The object of this invention is to provide a kind of high efficiency electron key method for verifying authority, search rapidly, algorithm is simple, and system resources consumption is little.
For achieving the above object, technical scheme of the present invention is to provide a kind of high efficiency electron key method for verifying authority, and its space allocation method comprises following steps:
S1, plot location continuous print lock index information region is set in the Flash storage space of electron key; Comprise N number of lock index data deposited continuously in this lock index information region, N is the quantity of all locks of electron key correspondence management, and the length of each lock index data is i byte;
S2, each described lock index data deposit order number of indexing successively from 0 s according to its address, make call number and lock index data one_to_one corresponding; Therefore have: call number is the initial memory address=lock index information region first address+n × i of the lock index data of the lock of n, wherein, n=0,1 ..., N-1 and adopt hexadecimal representation;
S3, plot location continuous print lock data information area is set in the Flash storage space of electron key; Comprise N number of lock identification code data deposited continuously in this lock data information area, the length of each lock identification code data is j byte;
S4, each described lock index data and lock identification code data one_to_one corresponding, and the relative initial memory address of the lock identification code data of each lock index data corresponding to it, therefore have: the initial memory address=lock data information area first address+m × j of the lock identification code data of lock index data corresponding to m.
When needing interpolation call number to be the lock information of n, comprise following steps:
SA1, lock data information area current last lock identification code data after increase new lock identification code data, make storage address continuous;
SA2, the lock identification code data newly increased deposited the first address that first address deducts lock data information area, then divided by j, obtain the lock index data corresponding to lock identification code data that this newly increases;
SA3, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SA4, the initial memory address of lock index data that obtains from SA3, write the lock index data obtained in SA2 successively continuously.
When needing deletion call number to be the lock information of n, comprise following steps:
SB1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SB2, initial memory address according to the lock index data obtained in SB1, find call number to be the lock index data of the lock of n;
SB3, original lock index data is revised as FFFFH.
When needing amendment call number to be the lock information of n, comprise following steps:
SC1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SC2, initial memory address according to the lock index data obtained in SC1, find call number to be the lock index data of the lock of n;
SC3, the lock index data obtained in SC2 is multiplied by j, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SC4, initial memory address according to the lock identification code data obtained in SC3, find call number to be the lock identification code data of the lock of n;
SC5, original lock identification code data is revised as new lock identification code data.
When need to search call number be the lock information of n time, comprise following steps:
SD1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SD2, initial memory address according to the lock index data obtained in SD1, find call number to be the lock index data of the lock of n; Judge whether this lock index data is not FFFFH, in this way, then continues SD3; As no, then show that call number is that the lock identification code data of the lock of n is deleted, return and do not find lock identification code data;
SD3, the lock index data obtained in SD2 is multiplied by j, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SD4, initial memory address according to the lock identification code data obtained in SD3, find call number to be the lock identification code data of the lock of n, read and return the lock identification code data that call number is the lock of n.
High-level efficiency electron key method for verifying authority provided by the present invention, search rapidly, algorithm is simple, only needs to be calculated by twice simple address maps, just can find required lock identification code data fast and accurately, and realize the reasonable management to all lock identification code datas simultaneously; Secondly, system resources consumption is little, because data message is deposited in a continuous manner, effectively reduces taking system space.
Accompanying drawing explanation
Fig. 1 is the allocation of space schematic diagram of the high-level efficiency electron key method for verifying authority in the present invention;
Fig. 2 is the information interpolation process flow diagram of the high-level efficiency electron key method for verifying authority in the present invention;
Fig. 3 is the information deletion process flow diagram of the high-level efficiency electron key method for verifying authority in the present invention;
Fig. 4 is the information modification process figure of the high-level efficiency electron key method for verifying authority in the present invention;
Fig. 5 is the information inquiry process flow diagram of the high-level efficiency electron key method for verifying authority in the present invention.
Embodiment
Below in conjunction with Fig. 1 ~ Fig. 5, describe a preferred embodiment of the present invention in detail.
High-level efficiency electron key method for verifying authority in the present invention, it comprises following steps:
S1, plot location continuous print lock index information region is set in the Flash storage space of electron key; Comprise N number of lock index data deposited continuously in this lock index information region, N is the quantity of all locks of electron key correspondence management, and the length of each lock index data is in i byte(the present embodiment, is described below for 2 byte);
S2, each described lock index data deposit order number of indexing successively from 0 s according to its address, make call number and lock index data one_to_one corresponding; Therefore have: call number is initial memory address=first address+n × 2, lock index information region of the lock index data of the lock of n, wherein, n=0,1 ..., N-1 and adopt hexadecimal representation;
S3, plot location continuous print lock data information area is set in the Flash storage space of electron key; Comprise N number of lock identification code data deposited continuously in this lock data information area, the length of each lock identification code data is in j byte(the present embodiment, is described below for 16 byte);
S4, each described lock index data and lock identification code data one_to_one corresponding, make the relative initial memory address of the lock identification code data of each lock index data corresponding to it, therefore have: initial memory address=first address+m × 16, lock data information area of the lock identification code data of lock index data corresponding to m.
As shown in Figure 1, in the present embodiment, the lock had corresponding to 10000 electron keys needs management, and the size of therefore locking index information region is 2 × 10000byte, and first address is 000000H; And the size of locking data information area is 16 × 10000byte, first address is 010000H.Such as, call number is the initial memory address of the lock index data of the lock of 0: 000000H+0 × 2=000000H, find this initial memory address, call number just can be found to be the lock index data 0000H of the lock of 0, and its storage address is 000000H ~ 000001H; The initial memory address of the lock identification code data corresponding with this lock index data 0000H should be: 010000H+0000H × 16=010000H, finds this initial memory address, and call number just can be found to be the lock identification code data of the lock of 0.Again such as, call number is that to convert sexadecimal to be 270D to 9997() the initial memory address of lock index data of lock should be: 000000H+270D × 2=004E1AH, find this initial memory address, call number just can be found to be the lock index data 0020H of the lock of 9997; The initial memory address of the lock identification code data corresponding with this lock index data 0020H should be: 010000H+0020H × 16=010200H, finds this initial memory address, and call number just can be found to be the lock identification code data of the lock of 9997.
As shown in Figure 2, when needing interpolation call number to be the lock information of n, following steps are comprised:
SA1, lock data information area end, namely current last lock identification code data after increase new lock identification code data, make storage address continuous;
SA2, the lock identification code data newly increased deposited the first address that first address deducts lock data information area, then divided by 16, obtain the lock index data corresponding to lock identification code data that this newly increases;
SA3, call number n is multiplied by 2, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SA4, the initial memory address of lock index data that obtains from SA3, write the lock index data obtained in SA2 successively continuously.
As shown in Figure 3, when needing deletion call number to be the lock information of n, following steps are comprised:
SB1, call number n is multiplied by 2, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SB2, initial memory address according to the lock index data obtained in SB1, find call number to be the lock index data of the lock of n;
SB3, original lock index data is revised as FFFFH.
That is, when the lock index information of certain lock is FFFFH, the lock identification code data namely representing this lock is deleted.As shown in Figure 1, wherein call number is that the lock index information of the lock of 2,9998 and 9999 is FFFFH, and now, it does not have corresponding lock identification code data in lock data information area, namely shows that the lock identification code data that those are locked is deleted.
As shown in Figure 4, when needing amendment call number to be the lock information of n, following steps are comprised:
SC1, call number n is multiplied by 2, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SC2, initial memory address according to the lock index data obtained in SC1, find call number to be the lock index data of the lock of n;
SC3, the lock index data obtained in SC2 is multiplied by 16, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SC4, initial memory address according to the lock identification code data obtained in SC3, find call number to be the lock identification code data of the lock of n;
SC5, original lock identification code data is revised as new lock identification code data.
As shown in Figure 5, when need to search call number be the lock information of n time, comprise following steps:
SD1, call number n is multiplied by 2, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SD2, initial memory address according to the lock index data obtained in SD1, find call number to be the lock index data of the lock of n; Judge whether this lock index data is not FFFFH, in this way, then continues SD3; As no, then show that call number is that the lock identification code data of the lock of n is deleted, return and do not find lock identification code data;
SD3, the lock index data obtained in SD2 is multiplied by 16, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SD4, initial memory address according to the lock identification code data obtained in SD3, find call number to be the lock identification code data of the lock of n, read and return the lock identification code data that call number is the lock of n.
High efficiency electron key method for verifying authority provided by the present invention, one piece of lock index information region is set in the Flash storage space of electron key, it is used for depositing the corresponding relative storage address locking identification code data, so that find required lock lock identification code data fast and accurately by allocation index.Therefore, the present invention, compared to prior art, searches rapidly, algorithm is simple, its needs are calculated by twice simple address maps, just can find required lock identification code data fast and accurately, and realize the reasonable management to all lock identification code datas simultaneously; Secondly, system resources consumption is little, because data message is deposited in a continuous manner, effectively reduces taking system space.
Although content of the present invention has done detailed introduction by above preferred embodiment, will be appreciated that above-mentioned description should not be considered to limitation of the present invention.After those skilled in the art have read foregoing, for multiple amendment of the present invention and substitute will be all apparent.Therefore, protection scope of the present invention should be limited to the appended claims.

Claims (5)

1. a high efficiency electron key method for verifying authority, is characterized in that, comprise following steps:
S1, plot location continuous print lock index information region is set in the Flash storage space of electron key; Comprise N number of lock index data deposited continuously in this lock index information region, N is the quantity of all locks of electron key correspondence management, and the length of each lock index data is i byte;
S2, each described lock index data deposit order number of indexing successively from 0 s according to its address, make call number and lock index data one_to_one corresponding; Therefore have: call number is the initial memory address=lock index information region first address+n × i of the lock index data of the lock of n, wherein, n=0,1 ..., N-1 and adopt hexadecimal representation;
S3, plot location continuous print lock data information area is set in the Flash storage space of electron key; Comprise N number of lock identification code data deposited continuously in this lock data information area, the length of each lock identification code data is j byte;
S4, each described lock index data and lock identification code data one_to_one corresponding, and the relative initial memory address of the lock identification code data of each lock index data corresponding to it, therefore have: the initial memory address=lock data information area first address+m × j of the lock identification code data of lock index data corresponding to m.
2. high efficiency electron key method for verifying authority as claimed in claim 1, is characterized in that, when needing interpolation call number to be the lock information of n, comprises following steps:
SA1, lock data information area current last lock identification code data after increase new lock identification code data, make storage address continuous;
SA2, the lock identification code data newly increased deposited the first address that first address deducts lock data information area, then divided by j, obtain the lock index data corresponding to lock identification code data that this newly increases;
SA3, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SA4, the initial memory address of lock index data that obtains from SA3, write the lock index data obtained in SA2 successively continuously.
3. high efficiency electron key method for verifying authority as claimed in claim 1, is characterized in that, when needing deletion call number to be the lock information of n, comprises following steps:
SB1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SB2, initial memory address according to the lock index data obtained in SB1, find call number to be the lock index data of the lock of n;
SB3, original lock index data is revised as FFFFH.
4. high efficiency electron key method for verifying authority as claimed in claim 1, is characterized in that, when needing amendment call number to be the lock information of n, comprises following steps:
SC1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SC2, initial memory address according to the lock index data obtained in SC1, find call number to be the lock index data of the lock of n;
SC3, the lock index data obtained in SC2 is multiplied by j, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SC4, initial memory address according to the lock identification code data obtained in SC3, find call number to be the lock identification code data of the lock of n;
SC5, original lock identification code data is revised as new lock identification code data.
5. high efficiency electron key method for verifying authority as claimed in claim 3, is characterized in that, when need to search call number be the lock information of n time, comprise following steps:
SD1, call number n is multiplied by i, adds lock index information region first address, obtain the initial memory address that call number is the lock index data of the lock of n;
SD2, initial memory address according to the lock index data obtained in SD1, find call number to be the lock index data of the lock of n; Judge whether this lock index data is not FFFFH, in this way, then continues SD3; As no, then show that call number is that the lock identification code data of the lock of n is deleted, return and do not find lock identification code data;
SD3, the lock index data obtained in SD2 is multiplied by j, adds lock data information area first address, obtain the initial memory address that call number is the lock identification code data of the lock of n;
SD4, initial memory address according to the lock identification code data obtained in SD3, find call number to be the lock identification code data of the lock of n, read and return the lock identification code data that call number is the lock of n.
CN201510610169.3A 2015-09-23 2015-09-23 Efficient method for verifying permission of electronic key Pending CN105279442A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510610169.3A CN105279442A (en) 2015-09-23 2015-09-23 Efficient method for verifying permission of electronic key

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510610169.3A CN105279442A (en) 2015-09-23 2015-09-23 Efficient method for verifying permission of electronic key

Publications (1)

Publication Number Publication Date
CN105279442A true CN105279442A (en) 2016-01-27

Family

ID=55148435

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510610169.3A Pending CN105279442A (en) 2015-09-23 2015-09-23 Efficient method for verifying permission of electronic key

Country Status (1)

Country Link
CN (1) CN105279442A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111833496A (en) * 2020-07-17 2020-10-27 长园共创电力安全技术股份有限公司 Unlocking method and device based on intelligent key and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102629234A (en) * 2012-01-18 2012-08-08 物联微电子(常熟)有限公司 Fast retrieval method for data of built-in Flash of single chip microcomputer
US20140032935A1 (en) * 2012-07-24 2014-01-30 Samsung Electronics Co., Ltd. Memory system and encryption method in memory system
CN104462280A (en) * 2014-11-27 2015-03-25 国网上海市电力公司 Data information storage and fast inquiry method used for embedded system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102629234A (en) * 2012-01-18 2012-08-08 物联微电子(常熟)有限公司 Fast retrieval method for data of built-in Flash of single chip microcomputer
US20140032935A1 (en) * 2012-07-24 2014-01-30 Samsung Electronics Co., Ltd. Memory system and encryption method in memory system
CN104462280A (en) * 2014-11-27 2015-03-25 国网上海市电力公司 Data information storage and fast inquiry method used for embedded system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111833496A (en) * 2020-07-17 2020-10-27 长园共创电力安全技术股份有限公司 Unlocking method and device based on intelligent key and storage medium

Similar Documents

Publication Publication Date Title
CN110413611B (en) Data storage and query method and device
CN102682116B (en) Method and device for processing table items based on Hash table
CN101692651A (en) Method and device for Hash lookup table
CN106326475B (en) Efficient static hash table implementation method and system
CN107368527B (en) Multi-attribute index method based on data stream
CN105468642A (en) Data storage method and apparatus
CN102890719B (en) A kind of method that license plate number is searched for generally and device
CN102169491B (en) Dynamic detection method for multi-data concentrated and repeated records
CN106599091B (en) RDF graph structure storage and index method based on key value storage
CN102546299A (en) Method for detecting deep packet under large flow
CN105117433A (en) Method and system for statistically querying HBase based on analysis performed by Hive on HFile
CN116450656B (en) Data processing method, device, equipment and storage medium
CN115576899B (en) Index construction method and device and file searching method and device
WO2023143095A1 (en) Method and system for data query
CN105335481A (en) Large scale character string text suffix index building method and device
CN100530194C (en) Key words matching method and system
CN109800228B (en) Method for efficiently and quickly solving hash conflict
CN104462280A (en) Data information storage and fast inquiry method used for embedded system
CN103077198A (en) Operation system and file cache positioning method thereof
CN105279442A (en) Efficient method for verifying permission of electronic key
CN107294855B (en) A kind of TCP under high-performance calculation network searches optimization method
CN110825747B (en) Information access method, device and medium
Ahsan et al. An Efficient Encoding Scheme to Handle the Address Space Overflow for Large Multidimensional Arrays.
CN116737664B (en) Efficient index organization method of object-oriented embedded database
Gupta et al. A Framework for hierarchical clustering based indexing in search engines

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160127

RJ01 Rejection of invention patent application after publication