Last active
January 12, 2022 15:32
-
-
Save padamupreti/0fa15180c32ddef70653abfe801ef708 to your computer and use it in GitHub Desktop.
Revisions
-
padamupreti revised this gist
Jan 12, 2022 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,11 +9,10 @@ def choose_specified(group, num=2): return ''.join(choice(group) for _ in range(num)) def get_passphrase(): char_groups = [ascii_lowercase, ascii_uppercase, punctuation, digits, ' '] all_groups_str = ''.join(char_groups) keyphrase = ''.join(choice(all_groups_str) for _ in range(9)) for _ in range(len(char_groups)): index = randbelow(len(char_groups)) keyphrase += choose_specified(char_groups[index]) del char_groups[index] -
padamupreti revised this gist
Nov 27, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # strong passphrase generator and copier from secrets import choice, randbelow from string import ascii_lowercase, ascii_uppercase, punctuation, digits import pyperclip # pip install pyperclip def choose_specified(group, num=2): if len(group) == 1: -
padamupreti revised this gist
Nov 11, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ # strong passphrase generator and copier from secrets import choice, randbelow from string import ascii_lowercase, ascii_uppercase, punctuation, digits import pyperclip -
padamupreti revised this gist
Nov 9, 2021 . No changes.There are no files selected for viewing
-
padamupreti revised this gist
Nov 9, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,4 +18,4 @@ def get_passphrase(): del char_groups[index] return keyphrase pyperclip.copy(get_passphrase()) -
padamupreti created this gist
Nov 9, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ from secrets import choice, randbelow from string import ascii_lowercase, ascii_uppercase, punctuation, digits import pyperclip def choose_specified(group, num=2): if len(group) == 1: return group return ''.join(choice(group) for _ in range(num)) def get_passphrase(): keyphrase = '' char_groups = [ascii_lowercase, ascii_uppercase, punctuation, digits, ' '] keyphrase += ''.join(choice(''.join(char_groups)) for _ in range(9)) length = len(char_groups) for _ in range(length): index = randbelow(len(char_groups)) keyphrase += choose_specified(char_groups[index]) del char_groups[index] return keyphrase pyperclip.copy(get_passphrase())