source code key.py as follows1 Importsha2 Importstring3BASE2 =' on'4BASE10 ='0123456789'5BASE16 ='0123456789ABCDEF'6BASE30 ='123456789ABCDEFGHJKLMNPQRTVWXY'7BASE36 ='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'8BASE62 ='abcdefghijklmnopqrstuvwxyz0123456789abcdefghijklmnopqrstuvwxyz'9Basemax =string.printableTen defBaseconvert (number, fromdigits, todigits, ignore_negative =True): One """converts a "number" between the bases of arbitrary digits A - The input number is assumed to being a string of digits from the - fromdigits string (which is in order of smallest to largest the digit). The return value is a string of elements from Todigits - (ordered in the same). The input and output bases are - Determined from the lengths of the digit strings. Negative - signs is passed through. + - Decimal to Binary + >>> Baseconvert (555,BASE10,BASE2) A ' 1000101011 ' at - binary to decimal - >>> baseconvert (' 1000101011 ', Base2,base10) - ' 555 ' - - integer interpreted as binary and converted to decimal (!) in >>> Baseconvert (1000101011,base2,base10) - ' 555 ' to + Base10 to Base4 - >>> Baseconvert (99,base10, "0123") the ' 1203 ' * $ Base4 to BASE5 (with alphabetic digits)Panax Notoginseng >>> Baseconvert (1203, "0123", "ABCDE") - ' Dee ' the + Base5, alpha digits back to base A >>> baseconvert (' Dee ', ' ABCDE ', BASE10) the ' the ' + - decimal to a base this uses a-z0-9a-z for its digits $ >>> Baseconvert (257938572394l,base10,base62) $ ' E78lxik ' - - .. Convert back the >>> baseconvert (' E78lxik ', Base62,base10) - ' 257938572394 'Wuyi the binary to a base with words for digits (the function cannot convert this back) - >>> baseconvert (' 1101 ', BASE2, (' Zero ', ' One ')) Wu ' Oneonezeroone ' - About """ $ if notIgnore_negative andSTR (number) [0] = ='-': -Number = str (number) [1:] -Neg = 1 - Else: ANeg =0 +x =Long (0) the forDigitinchStr (number): -x = x * Len (fromdigits) +fromdigits.index (digit) $ theres ="' the whileX >0: thedigit = x%Len (todigits) theres = Todigits[digit] +Res -X/=Len (todigits) in the ifneg: theres ='-'+Res About returnRes the the defSHAToBase30 (Digest): the """Convert from a hexdigest form SHA hash to a more compact and + ergonomic BASE30 representation. This results in a ' digit ' - Number .""" theTdigest ="'. join ([C forI, CinchEnumerate (Digest)ifI/2 * 2 = =i])Bayiresult =Baseconvert (Tdigest, BASE16, BASE30) the whileLen (Result) < 17: theresult ='1'+result - - returnresult the defAddhyphens (code): the """Insert hyphens into given license ID or activation request to the Make it easier to read""" the returnCode[:5] +'-'+ Code[5:10] +'-'+ code[10:15] +'-'+ code[15:] - theLicenseid='ENX27-HWM6G-XYVFA-165PG' the #Copy the Request Code from the dialog theRequestcode='RW51N-LW9K6-T5GWP-YVBLP'94Hasher =sha.new () the hasher.update (Requestcode) the hasher.update (Licenseid) theDigest =hasher.hexdigest (). Upper ()98Lichash = Requestcode[:3] +SHAToBase30 (Digest) AboutLichash=Addhyphens (Lichash) - 101 #Calculate the Activation Code102data=[7,123,23,87]103tmp=0104Realcode="' the forIinchData:106 forJinchLichash:107Tmp= (Tmp*i+ord (j)) &0xfffff108Realcode+=format (TMP,'=05x')109tmp=0 the 111act30=Baseconvert (realcode,base16,base30) the whileLen (ACT30) < 17:113Act30 ='1'+Act30 theact30='AXX'+Act30 theact30=Addhyphens (ACT30) the Print "The Activation Code is:"+Act30117 118Raw_input ()