Python integrated development Environment--wingide License creater

Source: Internet
Author: User
Tags binary to decimal decimal to binary

STEP 1: Install Wingide (: http://wingide.com/downloads);
STEP 2: Create a new suffix named. py file (name casually), add the following code to save;
Import shaimport stringBASE2 = ' BASE10 ' = ' 0123456789 ' BASE16 = ' 0123456789ABCDEF ' BASE30 = ' 123456789ABCDEFGHJKLMNPQRTVWXY ' BASE36 = ' 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ ' BASE62 = ' Abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz ' Basemax = String.printabledef BaseConvert (number,  Fromdigits, todigits, ignore_negative = True): "" "Converts a" number "between the bases of arbitrary the    Input number is assumed to bes a string of digits from the Fromdigits string (which are in order of smallest to largest Digit). The return value is a string of elements from Todigits (ordered in the same). The input and output bases is determined from the lengths of the digit strings.        Negative signs is passed through. Decimal to Binary >>> baseconvert (555,base10,base2) ' 1000101011 ' binary to decimal >>> b  Aseconvert (' 1000101011 ', base2,base10) ' 555 ' integer interpreted as binary and converted to decimal (!)  >>> Baseconvert (1000101011,base2,base10) ' 555 ' base10 to Base4 >>> Baseconvert (99,base10,         "0123") ' 1203 ' Base4 to BASE5 (with alphabetic digits) >>> Baseconvert (1203, "0123", "ABCDE") ' Dee ' BASE5, alpha digits back to base >>> Baseconvert (' Dee ', "ABCDE", BASE10) ' The "decimal to a Base that uses a-z0-9a-z for its digits >>> baseconvert (257938572394l,base10,base62) ' E78lxik '.  Convert back >>> baseconvert (' E78lxik ', base62,base10) ' 257938572394 ' binary to a base with words for Digits (The function cannot convert this back) >>> Baseconvert (' 1101 ', BASE2, (' Zero ', ' One ')) ' Oneonezeroone        ' "" "if not ignore_negative and str (number) [0] = = '-': number = str (number) [1:] neg = 1 Else:  Neg = 0 x = Long (0) for digit in STR (number): x = x * Len (fromdigits) + fromdigits.index (digit) res   = ' While x > 0:     digit = x% len (todigits) res = Todigits[digit] + res x/= len (todigits) If neg:res = '-' + Res return resdef SHAToBase30 (Digest): "" "Convert from a hexdigest form SHA hash to a more compact and Ergonomi  C BASE30 representation.    This results in a ' digit ' number. "" "    Tdigest = ". Join ([C for I, C in enumerate (digest) if I/2 * 2 = = i]) result = Baseconvert (Tdigest, BASE16, BASE30)  While Len (result) < 17:result = ' 1 ' + result return resultdef Addhyphens (code): "", Insert hyphens into Given license ID or activation request to make it easier to read "" "Return Code[:5] + '-' + code[5:10] + '-' + code [10:15] + '-' + code[15:]licenseid= ' cn123-12345-12345-12345 ' #Copy the Request code from the dialogrequestcode= ' Rw517-pkj4f-wnht8-ye3f9 ' hasher = Sha.new () hasher.update (Requestcode) hasher.update (Licenseid) Digest = Hasher.hexdigest (). Upper () Lichash = Requestcode[:3] + SHAToBase30 (Digest) Lichash=addhyphens (Lichash) #CalcUlate the Activation codedata=[7,123,23,87]tmp=0realcode= "for me in Data:for J in Lichash:tmp= (Tmp*i+ord (j)) &A MP;0XFFFFF Realcode+=format (tmp, ' =05x ') Tmp=0act30=baseconvert (Realcode,base16,base30) while Len (Act30) < 17:a Ct30 = ' 1 ' + act30act30= ' AXX ' +act30act30=addhyphens (act30) print "The Activation Code is:" +act30
STEP3:

Python integrated development Environment--wingide License creater

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.