Random Password Generator

Generate secure random password

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Random Password Generator
// @namespace    https://openuserjs.org/users/burn
// @version      20260207
// @description  Generate secure random password
// @copyright    2026, burn (https://openuserjs.org//users/burn)
// @license      MIT
// @match        *://*/*
// @include      *
// @grant        GM_registerMenuCommand
// @grant        GM.registerMenuCommand
// @grant        GM_setClipboard
// @grant        GM.setClipboard
// ==/UserScript==

// ==OpenUserJS==
// @author burn
// ==/OpenUserJS==

/*jshint esversion: 8 */ 
(function() {
    'use strict';
    const DBG = false;
    const SCRIPT = GM_info.script.name;
    let log = (str) => {
        DBG && console.log(GM_info.script.name + " | " + str);
    };

    function secureRandomIndex(max) {
        const range = 0xFFFFFFFF;
        const limit = range - (range % max);
        const buf = new Uint32Array(1);

        do {
            crypto.getRandomValues(buf);
        } while (buf[0] >= limit);

        return buf[0] % max;
    }

    function pick(str) {
        return str[secureRandomIndex(str.length)];
    }

    Object.defineProperty(Array.prototype, "shuffle", {
        value: function() {
            for (let i = this.length - 1; i > 0; i--) {
                const j = secureRandomIndex(i + 1);
                [this[i], this[j]] = [this[j], this[i]];
            }
            return this;
        },
        enumerable: false
    });

    function generatePassword() {
        const LEN = 19;
        const LOWER = "abcdefghijkmnopqrstuvwxyz";
        const UPPER = "ABCDEFGHJKLMNPQRSTUVWXYZ";
        const NUM = "23456789";
        const SYM = "!@#$%^&*()-_=+[]{};:,.<>?";

        const ALL = LOWER + UPPER + NUM + SYM;

        const result = new Array(
            pick(LOWER),
            pick(UPPER),
            pick(NUM),
            pick(SYM)
        );

        for (let i = result.length; i < LEN; i++) {
            result.push(pick(ALL));
            result.shuffle();
        }

        if (typeof GM_setClipboard !== "undefined") {
            GM_setClipboard(result.join(""), "text");
        } else if (typeof GM !== "undefined" && GM.setClipboard) {
            GM.setClipboard(result.join(""), "text");
        }
    }

    if (typeof GM_registerMenuCommand !== "undefined") {
        GM_registerMenuCommand("Generate Secure Password", generatePassword);
    } else if (typeof GM !== "undefined" && GM.registerMenuCommand) {
        GM.registerMenuCommand("Generate Secure Password", generatePassword);
    }
})();