zoukankan      html  css  js  c++  java
  • [工具分享]wingide 6 算号代码keygen

    import string
    import random
    import sha
    
    BASE16 = '0123456789ABCDEF'
    BASE30 = '123456789ABCDEFGHJKLMNPQRTVWXY'
    
    
    def randomstring(size=20, chars=string.ascii_uppercase + string.digits):
        return ''.join((random.choice(chars) for _ in range(size)))
    
    
    def BaseConvert(number, fromdigits, todigits, ignore_negative=True):
        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 res
    
    
    def AddHyphens(code):
        return code[:5] + '-' + code[5:10] + '-' + code[10:15] + '-' + code[15:]
    
    
    def SHAToBase30(digest):
        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 result
    
    
    def loop(ecx, lichash):
        part = 0
        for c in lichash:
            part = ecx * part + ord(c) & 1048575
        return part
    
    rng = AddHyphens('CN' + randomstring(18, '123456789ABCDEFGHJKLMNPQRTVWXY'))
    print 'License id: ' + rng
    act30 = raw_input('Enter request code:')
    lichash = act30
    hasher = sha.new()
    hasher.update(act30)
    hasher.update(rng)
    lichash = AddHyphens(lichash[:3] + SHAToBase30(hasher.hexdigest().upper()))
    part5 = format(loop(23, lichash), '05x') + format(loop(161, lichash), '05x') + format(loop(47, lichash),
                                                                                          '05x') + format(loop(9, lichash),
                                                                                                          '05x')
    part5 = BaseConvert(part5.upper(), BASE16, BASE30)
    while len(part5) < 17:
        part5 = '1' + part5
    
    part5 = 'AXX' + part5
    print 'Activation code: ' + AddHyphens(part5)
    

      

    via:http://www.hnsdedu.com/kuangsir/?p=199

  • 相关阅读:
    Ehcache2 的配置(不使用配置文件)
    约定优于配置
    Eclipse 3.5使用dropins的插件安装方式
    程序开发为什么要使用框架
    关于远程连接MySQL数据库的问题解决
    python使用open经常报错:TypeError: an integer is required的解决方案
    python仿微软记事本
    抓取oschina上面的代码分享python块区下的 标题和对应URL
    单词翻译
    python多线程下载
  • 原文地址:https://www.cnblogs.com/adislj777/p/6307283.html
Copyright © 2011-2022 走看看