Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(4)  |  Derive(0)  |  Import(3)
generates the HMAC key of keysize. Should be 20 or 32
THe key is returned as a hexlified string

        def generate_otpkey(key_size=20):
    '''
    generates the HMAC key of keysize. Should be 20 or 32
    THe key is returned as a hexlified string
    '''
    log.debug("generating key of size %s" % key_size)
    return binascii.hexlify(geturandom(key_size))
        


src/l/i/LinOTP-2.6.1.1/linotp/controllers/selfservice.py   LinOTP(Download)
from linotp.lib.util import getLowerParams
from linotp.lib.util import check_selfservice_session
from linotp.lib.util import generate_otpkey
from linotp.lib.util import remove_empty_lines
 
                # otherwise qrcode.js will fail.Change to 32!
                # Usually the URL is 106 bytes long
                otpkey = generate_otpkey(20)
 
                log.debug("[userwebprovision] Initializing the token serial: %s, desc: %s for user %s @ %s." %
 
                # ideal: 32 byte.
                otpkey = generate_otpkey(32)
                t_type = "hmac"
                if type.lower() == "googleauthenticator_time":

src/l/i/LinOTP-2.6.1.1/linotp/lib/tokens/totptoken.py   LinOTP(Download)
from linotp.lib.HMAC    import HmacOtp
from linotp.lib.util    import getParam
from linotp.lib.util    import generate_otpkey
from linotp.lib.config  import getFromConfig
 
            if 1 == genkey:
                # if hashlibStr not in keylen dict, this will raise an Exception
                otpKey = generate_otpkey(keylen.get(self.hashlibStr))
                del param['genkey']
            else:

src/l/i/LinOTP-2.6.1.1/linotp/lib/tokenclass.py   LinOTP(Download)
 
from linotp.lib.util import getParam
from linotp.lib.util import generate_otpkey
 
from linotp.lib.config  import getFromConfig
            else:
                otpkeylen = 20
        return generate_otpkey(otpkeylen)
 
    def setDescription(self, description):