Generate a random passphrase from the GSL.
549000
def generate(number=4, choice=SystemRandom().choice, words=words, joiner=" "):
    
    return joiner.join(choice(words) for each in range(number))
809361
private static String createSecureRandom() {
        try {
            final String no = "" + SECURE_RANDOM.nextInt();
            final MessageDigest md = MessageDigest.getInstance("SHA-1");
            final byte[] digest = md.digest(no.getBytes());
            return encodeBase64(digest);
        } catch (final NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }
    }
1346884
def generate_secret_key():
    """"""
    import string
    import random

    rng = random.SystemRandom()
    return ''.join(
        rng.choice(string.ascii_letters + string.digits)
        for dummy in range(0, 256)
    )
956615
def _passphrase_callback(passphrase):
    '''
    
    '''
    def f(*args):
        return salt.utils.stringutils.to_bytes(passphrase)
    return f
949620
def random_string(**kwargs):
    
    n = kwargs.get('length', 10)
    pool = kwargs.get('pool') or string.digits + string.ascii_lowercase
    return ''.join(random.SystemRandom().choice(pool) for _ in range(n))
401361
def make_random_key() -> Text:
    

    r = SystemRandom()
    allowed = \
        'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+/[]'

    return ''.join([r.choice(allowed) for _ in range(0, 50)])
373584
def gen_signature(self, privkey, pubkey, sig_path):
        '''
        
        '''
        return salt.crypt.gen_signature(privkey,
                                        pubkey,
                                        sig_path,
                                        self.passphrase)
948841
function genPass(opts, cb) {
    // generate a 10-bytes password
    crypto.randomBytes(10, function(err, buffer) {
      if (buffer) {
        opts.password = buffer.toString("base64");
      }
      cb(err, opts);
    });
  }
294897
def password_generator(length):
    
    return ''.join(random.choice(string.ascii_lowercase + string.digits)
                   for _ in range(length))
673571
def password(password_command):
    """"""
    gui = lambda: has_Gtk() and get_password_gui
    tty = lambda: sys.stdin.isatty() and get_password_tty
    if password_command == 'builtin:gui':
        return gui() or tty()
    elif password_command == 'builtin:tty':
        return tty() or gui()
    elif password_command:
        return DeviceCommand(password_command).password
    else:
        return None
128840
def generate_keypair(curve='secp160r1', randfunc=None):
    
    if randfunc is None:
        randfunc = Crypto.Random.new().read
    curve = Curve.by_name(curve)
    raw_privkey = randfunc(curve.order_len_bin)
    privkey = serialize_number(deserialize_number(raw_privkey), SER_COMPACT)
    pubkey = str(passphrase_to_pubkey(privkey))
    return (privkey, pubkey)
628142
def _get_random_string(length=44,
                       allowed_chars='abcdefghijklmnopqrstuvwxyz'
                       'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
                       secret_key=settings.secret_key_bytes()):
    
    secret_key = _ensure_bytes(secret_key)
    _reseed_if_needed(using_sysrandom, secret_key)
    return ''.join(random.choice(allowed_chars) for i in range(length))
150756
def generate(cls):
        
        return cls(
            random(nacl.bindings.crypto_sign_SEEDBYTES),
            encoder=encoding.RawEncoder,
        )
75576
def generate_msg_signature(encrypt_msg, msg)
        sort_params = [encrypt_msg, @weixin_adapter.current_weixin_token,
                       msg.TimeStamp, msg.Nonce].sort.join
        Digest::SHA1.hexdigest(sort_params)
      end
987571
def generate_password():
    """"""
    if sys.version_info > (3, 6):
        import secrets  # pylint: disable=import-error
        alphabet = string.ascii_letters + string.digits
        password = ''.join(secrets.choice(alphabet) for i in range(20))
        special = ''.join(secrets.choice(string.punctuation) for i in range(3))
        return password + special
    else:
        raise ImportError("Generating passwords require python 3.6 or higher")
363719
def walletpassphrase(self, passphrase, timeout=99999999, mint_only=True):
        """"""
        return self.req("walletpassphrase", [passphrase, timeout, mint_only])
1009908
private String generateRandomSession() {
        final int length = 16;
        final SecureRandom r = new SecureRandom();
        final StringBuilder sb = new StringBuilder();
        while (sb.length() < length) {
            sb.append(Integer.toHexString(r.nextInt()));
        }
        return sb.toString().substring(0, length);
    }