aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--info/passcheck.texinfo5
-rwxr-xr-xpasscheck.py28
2 files changed, 20 insertions, 13 deletions
diff --git a/info/passcheck.texinfo b/info/passcheck.texinfo
index 11b6dd3..bbe0436 100644
--- a/info/passcheck.texinfo
+++ b/info/passcheck.texinfo
@@ -86,6 +86,11 @@ Use @option{--raw} or @option{-r} if the passphrase may contain a ESC character,
otherwise it is parsed as an ANSI escape sequence wish is ignored in the rating
and allows you to use colours in the passphrases.
+Server with vast amount of RAM memory may want to load the entire blacklist
+into RAM and create a hash set of it. To do this, use @option{--waste-ram} or
+@option{-w}. It is unreasonly to do this unless you have the process running
+indefinitely and (somewhat) continuously feed passphrases.
+
@node Factors
diff --git a/passcheck.py b/passcheck.py
index 7717eb0..084b795 100755
--- a/passcheck.py
+++ b/passcheck.py
@@ -112,18 +112,21 @@ def evaluate(data):
return (rc + 0.5) // 1
-blacklist = None
-try:
- # TODO Converting into a set should be opt-in, and is an optimisation
- # for servers that have the process running indefinitely can
- # continuously feeds passphrases to it. On personal computers,
- # it is better to do a binary search of the file without loading
- # it completely.
- with open('blacklist', 'rb') as file:
- blacklist = set(file.read().decode('utf-8', 'replace').split('\n'))
-except FileNotFoundError:
- sys.stderr.write('File "blacklist" from the git branch "large-files" is not present.\n');
- sys.exit(1)
+
+waste_ram = ('--waste-ram' in sys.argv[1:]) or ('-w' in sys.argv[1:])
+raw = ('--raw' in sys.argv[1:]) or ('-r' in sys.argv[1:])
+
+
+if waste_ram:
+ blacklist = None
+ try:
+ with open('blacklist', 'rb') as file:
+ blacklist = set(file.read().decode('utf-8', 'replace').split('\n'))
+ except FileNotFoundError:
+ sys.stderr.write('File "blacklist" from the git branch "large-files" is not present.\n');
+ sys.exit(1)
+else:
+ pass # TODO
for directory in ['/usr/share/dict/', '/usr/local/share/dict/']:
dictionaries = None
try:
@@ -137,7 +140,6 @@ for directory in ['/usr/share/dict/', '/usr/local/share/dict/']:
blacklist.update(set(file.read().decode('utf-8', 'replace').split('\n')))
-raw = ('--raw' in sys.argv[1:]) or ('-r' in sys.argv[1:])
while True:
line = []
try: