CN104486067A - Method and device for generating serial number with fixed length - Google Patents
Method and device for generating serial number with fixed length Download PDFInfo
- Publication number
- CN104486067A CN104486067A CN201410724761.1A CN201410724761A CN104486067A CN 104486067 A CN104486067 A CN 104486067A CN 201410724761 A CN201410724761 A CN 201410724761A CN 104486067 A CN104486067 A CN 104486067A
- Authority
- CN
- China
- Prior art keywords
- base32
- coding
- sequence number
- ciphertext
- sequence numbers
- 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.)
- Granted
Links
Landscapes
- Storage Device Security (AREA)
Abstract
The invention discloses a method and a device for generating a serial number with a fixed length. The method comprises the following steps of encrypting a plaintext serial number through a symmetrical encryption algorithm of a data encryption standard to generate a 26-bit cipher text serial number; coding the 26-bit cipher text serial number through Base32, and carrying the information of one bit appointed in the Base32 codes of the 26-bit cipher text serial number on two bits appointed in the Base32 codes of other cipher text serial numbers to obtain codes of a 25-bit cipher text serial number. The technical scheme is high in efficiency, high in usability and wide in application, and can be applied to the field of product development which is associated with various types of software and hardware and needs authentication of serial numbers.
Description
Technical field
The present invention relates to the right-safeguarding technology of software, hardware development, particularly relate to the method and device that generate fixed-length sequence number.
Background technology
The sequence number with regular length is conventional sequence number, is widely used in software and hardware production industry.For example software developer is in order to prevent piracy, can take certain safeguard measure by sequence number to software.The computer software and hardware information can installed according to user software when user's registration generates unique identification code, is generally called machine code, is also sequence number, authentication code, application for registration code etc.If sequence number is personal to the 2nd, so when sequence number is by the 2nd checking, will find that the physical address of network interface card when being verified for the first time first with it is different, 2 people will be found that there is by software developer and use same set of software, thus piracy will be become by the 2nd authentication sequence number.Also having a kind of is by the Disk Serial Number of this locality by certain algorithm, formation sequence number, makes this computer of mounting software first can mounting software, but other computer just cannot install this software.
The sequence number with regular length is espespecially easy to the sequence number of 25 regular lengths of identification, uses a kind of pattern of efficient sequence number especially at present.The sequence number of existing 25 regular lengths is generally generate by random device, instead of by data encryption standard (DES, Data Encryption Standard) encryption, therefore coefficient of safety is lower.And if by the sequence number of regular length by des encryption, the keying sequence length of generation is 26, does not meet sequence number pattern general at present.
Therefore, need to provide a kind of method generating fixed-length sequence number, can be encrypted sequence number with DES and 25 general sequence number patterns can be formed.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of method and the device that generate fixed-length sequence number, can generate the sequence number of 25 general bit sequence number patterns.
In order to solve the problems of the technologies described above, the invention provides a kind of method generating fixed-length sequence number, comprising:
Encrypting step: clear text serial number is encrypted generation 26 ciphertext sequence numbers by data encryption standard symmetric encipherment algorithm;
Coding step: to be encoded these 26 ciphertext sequence numbers by Base32, and in being encoded by the Base32 of described 26 ciphertext sequence numbers, the information of one of agreement carries on two of agreement in the Base32 coding of other ciphertext sequence number, becomes the coding of 25 ciphertext sequence numbers.
Further, also comprise before described coding step:
Two the Base32 codings set for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
Further, described coding step specifically comprises:
Obtain the sequence number of character value in Base32 of the last position in Base32 coding, with the divisor 6 of this sequence number divided by setting, obtain quotient and the remainder; Sequence number is guided to find the lowercase in abcdef to represent the information carried on Z with gained business as first, guide sequence number to find the lowercase in hijklmn to represent the information carried on 8 with gained remainder as second, thus the coding of 26 ciphertext sequence numbers is become the coding of 25 ciphertext sequence numbers.
In order to solve the problems of the technologies described above, the invention provides a kind of device generating fixed-length sequence number, comprise the des encryption module, Base32 coding module and the sequence number that connect successively and to condense module, wherein:
Des encryption module, for encrypting generation 26 ciphertext sequence numbers by data encryption standard symmetric encipherment algorithm by clear text serial number;
Base32 coding module, for these 26 ciphertext sequence numbers of being encoded by Base32;
Sequence number condenses module, carries two of agreement in the Base32 coding of other ciphertext sequence number, become the Base32 coding of 25 ciphertext sequence numbers for the information of one of agreement in being encoded by the Base32 of 26 ciphertext sequence numbers.
Further, Base32 coding module two the Base32 codings preset for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
Further, the sequence number module that condenses obtains the sequence number of character value in Base32 of last position in Base32 coding, with the divisor 6 of this sequence number divided by setting, obtains quotient and the remainder; Sequence number is guided to find the lowercase in abcdef to represent the information carried on Z with gained business as first, guide sequence number to find the lowercase in hijklmn to represent the information carried on 8 with gained remainder as second, thus the coding of 26 ciphertext sequence numbers is become the coding of 25 ciphertext sequence numbers.
The present invention produces based on DES to have fixed-length sequence number.Because DES is conventional and the enciphering and deciphering algorithm of safety, then the present invention is by all assigning in the character string crossed through des encryption to agreement character (such as trailing character or initial character), under the state only needing consumes least computational resource, 26 potential source ciphertexts can be shortened to 25, and also can Quick Casting ciphertext character string, 25 bit sequence number ciphertexts are reduced to the source ciphertext of 26 bit sequence number.Technical scheme efficiency of the present invention is high, ease for use strong and application is wide, can be applicable to the product development field needing sequence number certification that various software and hardware is correlated with.
Accompanying drawing explanation
Fig. 1 is the flow chart of the embodiment of the method for generation fixed-length sequence of the present invention number;
Fig. 2 is the structured flowchart of the device embodiment of generation fixed-length sequence of the present invention number.
Embodiment
Below in conjunction with accompanying drawing and preferred embodiment, technical scheme of the present invention is set forth in detail.Should be appreciated that, the embodiment below enumerated only for instruction and explanation of the present invention, and does not form the restriction to technical solution of the present invention.
As shown in Figure 1, illustrate the flow process of the embodiment of the method for generation fixed-length sequence of the present invention number, comprise step:
110: by DES symmetric encipherment algorithm, clear text serial number is encrypted generation 26 ciphertext sequence numbers;
120: to be encoded these 26 ciphertext sequence numbers by Base32, and in being encoded by the Base32 of 26 ciphertext sequence numbers, the information of one of agreement carries on two of agreement in the Base32 coding of other ciphertext sequence number, becomes the coding of 25 ciphertext sequence numbers.
In said method embodiment,
Two the Base32 codings preset for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
Such as, by DES symmetric encipherment algorithm, clear text serial number being encrypted generation 26 ciphertext sequence numbers, is then JHEVM-254ZX-V7R82-CJMV7-HUXCU-7 by Base32 (ABCDEFGHIJKLMNOPQRSTUVWXYZ345678) this 26 ciphertext sequence numbers of encoding; Wherein last bit value is character " 7 ", and its sequence number in Base32 is 31, and with 31 divided by the divisor 6 of setting, obtaining business is 5, and remainder is 1.
Define extra lowercase abcdef and represent the information carried on Z, namely carry the information of business 5 with Z+5 → e; Defining extra hijklmn is again the number carried on 8, namely carries the information of remainder 1 with 8+1 → h; Through like this process, ciphertext sequence number becomes: JHEVM-254eX-V7Rh2-CJMV7-HUXCU, then by last character " 7 " with its sequence number 31 in Base32 divided by 6 business 5 and remainder 1 carry respectively on lowercase e and h.
By above variation, the Base32 coded data of the ciphertext sequence number after des encryption can be treated as the Base32 coding of the ciphertext sequence number of 25.
In said method embodiment,
When the Base32 of ciphertext sequence number coding being decoded, by finding out of wherein non-ABCDEFGHIJKLMNOPQRSTUVWXYZ345678, i.e. character " e " and character " h ", and the position 5 and 1 that " e " and " h " is corresponding is respectively reverted to predetermined Z and 8, obtain business 5 remainder 1 simultaneously, and obtain the sequence number 31 of Base32 coding according to predetermined divisor 6, final 26 the ciphertext sequence numbers obtaining JHEVM-254ZX-V7R82-CJMV7-HUXCU-7.
Certainly, two Base32 preset for carrying Hidden Codes information encode except being respectively alphabetical last position Z and position 8, numeral end, also letter time last position Y and numeral time last position 7 be can be set as, or letter time time last position X and numeral time time last position 6 are set as ...The divisor obtaining quotient and the remainder except setting Base32 coding is except 6, also can be set as 5,4 ...The position of setting Hidden Codes is outside the last position in the Base32 coding of 26 ciphertext sequence numbers, the position that also can set Hidden Codes is the first place in the Base32 coding of 26 ciphertext sequence numbers, or the position of setting Hidden Codes is the secondary last position in the Base32 coding of 26 ciphertext sequence numbers ... etc..
The present invention is directed to said method embodiment, correspondingly additionally provide the device embodiment generating fixed-length sequence number, its structure as shown in Figure 2, comprises the des encryption module, Base32 coding module and the sequence number that connect successively and to condense module, wherein:
Des encryption module, for encrypting generation 26 ciphertext sequence numbers by DES symmetric encipherment algorithm by clear text serial number;
Base32 coding module, for these 26 ciphertext sequence numbers of being encoded by Base32;
Sequence number condenses module, carries two of agreement in the Base32 coding of other ciphertext sequence number, become the coding of 25 ciphertext sequence numbers for the information of one of agreement in being encoded by the Base32 of 26 ciphertext sequence numbers.
In said apparatus embodiment,
Base32 coding module two the Base32 codings preset for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
In said apparatus embodiment,
The sequence number module that condenses obtains the sequence number of character value in Base32 of last position in Base32 coding, with the divisor 6 of this sequence number divided by setting, obtains quotient and the remainder; The lowercase in abcdef is found to represent the information carried on Z with gained business as guiding sequence number 1, find the lowercase in hijklmn to represent the information carried on 8 with gained remainder as guiding sequence number 2, thus the coding of 26 ciphertext sequence numbers is become the coding of 25 ciphertext sequence numbers.
Claims (6)
1. generate a method for fixed-length sequence number, comprising:
Encrypting step: clear text serial number is encrypted generation 26 ciphertext sequence numbers by data encryption standard symmetric encipherment algorithm;
Coding step: to be encoded these 26 ciphertext sequence numbers by Base32, and in being encoded by the Base32 of described 26 ciphertext sequence numbers, the information of one of agreement carries on two of agreement in the Base32 coding of other ciphertext sequence number, becomes the coding of 25 ciphertext sequence numbers.
2. in accordance with the method for claim 1, it is characterized in that, also comprise before described coding step:
Two the Base32 codings set for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
3. in accordance with the method for claim 2, it is characterized in that, described coding step specifically comprises:
Obtain the sequence number of character value in Base32 of the last position in Base32 coding, with the divisor 6 of this sequence number divided by setting, obtain quotient and the remainder; Sequence number is guided to find the lowercase in abcdef to represent the information carried on Z with gained business as first, guide sequence number to find the lowercase in hijklmn to represent the information carried on 8 with gained remainder as second, thus the coding of 26 ciphertext sequence numbers is become the coding of 25 ciphertext sequence numbers.
4. generate a device for fixed-length sequence number, it is characterized in that, comprise the des encryption module, Base32 coding module and the sequence number that connect successively and to condense module, wherein:
Des encryption module, for encrypting generation 26 ciphertext sequence numbers by data encryption standard symmetric encipherment algorithm by clear text serial number;
Base32 coding module, for these 26 ciphertext sequence numbers of being encoded by Base32;
Sequence number condenses module, carries two of agreement in the Base32 coding of other ciphertext sequence number, become the Base32 coding of 25 ciphertext sequence numbers for the information of one of agreement in being encoded by the Base32 of 26 ciphertext sequence numbers.
5., according to device according to claim 4, it is characterized in that,
Described Base32 coding module two the Base32 codings preset for carrying Hidden Codes information are respectively alphabetical last position Z and position 8, numeral end, and setting Base32 encodes, the divisor obtaining quotient and the remainder is 6; The position of setting Hidden Codes is the last position in the Base32 coding of 26 ciphertext sequence numbers simultaneously.
6., according to device according to claim 5, it is characterized in that,
The described sequence number module that condenses obtains the sequence number of character value in Base32 of last position in Base32 coding, with the divisor 6 of this sequence number divided by setting, obtains quotient and the remainder; Sequence number is guided to find the lowercase in abcdef to represent the information carried on Z with gained business as first, guide sequence number to find the lowercase in hijklmn to represent the information carried on 8 with gained remainder as second, thus the coding of 26 ciphertext sequence numbers is become the coding of 25 ciphertext sequence numbers.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410724761.1A CN104486067B (en) | 2014-12-02 | 2014-12-02 | A kind of method and device for generating fixed-length sequence number |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410724761.1A CN104486067B (en) | 2014-12-02 | 2014-12-02 | A kind of method and device for generating fixed-length sequence number |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104486067A true CN104486067A (en) | 2015-04-01 |
CN104486067B CN104486067B (en) | 2017-12-19 |
Family
ID=52760575
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410724761.1A Active CN104486067B (en) | 2014-12-02 | 2014-12-02 | A kind of method and device for generating fixed-length sequence number |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104486067B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1459724A (en) * | 2002-05-25 | 2003-12-03 | 三星电子株式会社 | Method and apparatus for producing sequence number |
CN101420231A (en) * | 2007-10-25 | 2009-04-29 | 索尼株式会社 | Encoding method and device, and program |
US20110093689A1 (en) * | 2009-10-16 | 2011-04-21 | Dell Products L.P. | System and Method for Bios and Controller Communication |
CN103023641A (en) * | 2012-10-25 | 2013-04-03 | 浪潮电子信息产业股份有限公司 | Serial number generating/verifying method |
CN103093129A (en) * | 2013-01-09 | 2013-05-08 | 上海大唐移动通信设备有限公司 | Registration code generation method and device used for software licensing |
-
2014
- 2014-12-02 CN CN201410724761.1A patent/CN104486067B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1459724A (en) * | 2002-05-25 | 2003-12-03 | 三星电子株式会社 | Method and apparatus for producing sequence number |
CN101420231A (en) * | 2007-10-25 | 2009-04-29 | 索尼株式会社 | Encoding method and device, and program |
US20110093689A1 (en) * | 2009-10-16 | 2011-04-21 | Dell Products L.P. | System and Method for Bios and Controller Communication |
CN103023641A (en) * | 2012-10-25 | 2013-04-03 | 浪潮电子信息产业股份有限公司 | Serial number generating/verifying method |
CN103093129A (en) * | 2013-01-09 | 2013-05-08 | 上海大唐移动通信设备有限公司 | Registration code generation method and device used for software licensing |
Non-Patent Citations (2)
Title |
---|
姜浩: "现代密码学算法在软件序列号保护系统中的应用研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
康辉等: "基于模运算的图像隐写算法", 《计算机应用与软件》 * |
Also Published As
Publication number | Publication date |
---|---|
CN104486067B (en) | 2017-12-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2016206504A1 (en) | Data encryption method, decryption method and apparatus | |
CN110663215B (en) | Elliptic curve point multiplication device and method in white-box scene | |
CN106972918B (en) | Electronic coding data generation method, device and verification method | |
CN101996298A (en) | Encrypting method and decrypting method corresponding to same | |
CN105282090B (en) | A kind of open URL scrambled method of anti-unauthorized access on internet | |
CN106375083B (en) | A kind of encipher-decipher method and its device based on Base64 | |
CN104518865B (en) | A kind of data ciphering method based on code book | |
CN109409101A (en) | The method and terminal device of data encryption | |
CN106358184A (en) | Point-to-point identity authentication method | |
CN1945591A (en) | Encryting anti-fake technology for electronic label | |
CN109412791B (en) | Key information processing method, device, electronic equipment and computer-readable medium | |
CN105718978B (en) | QR code generation method and device, and decoding method and device | |
US20130031373A1 (en) | Product authentication based upon a hyperelliptic curve equation and a curve pairing function | |
WO2015166701A1 (en) | Encryption method, program, and system | |
CN111314270B (en) | Data encryption and decryption method based on validity period uniform distribution symmetric algorithm | |
CN107592963B (en) | Method and computing device for performing secure computations | |
CN104393988B (en) | A kind of reversible data ciphering method and device | |
CN109802962B (en) | Encryption and decryption method in block chain technology | |
CN110784313A (en) | Key protection method, device and storage medium | |
CN116664123A (en) | Digital wallet design method based on blockchain technology | |
CN104486067A (en) | Method and device for generating serial number with fixed length | |
KR101148560B1 (en) | Apparatus and method for encryption using mixture of bit data | |
KR101584332B1 (en) | Method for creating personal information tokens based on character patterns | |
CN106059748A (en) | Lightweight data secure storage method based on block security regeneration codes | |
KR101584220B1 (en) | Encoding Method for Maintaining Sorting Order of Encrypted Data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |