Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
b2a3020c
Commit
b2a3020c
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Give a more meaningful msg if entropy is reduced.
parent
19cc3046
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
diceware/random_sources.py
+5
-1
5 additions, 1 deletion
diceware/random_sources.py
tests/test_random_sources.py
+1
-0
1 addition, 0 deletions
tests/test_random_sources.py
with
6 additions
and
1 deletion
diceware/random_sources.py
+
5
−
1
View file @
b2a3020c
...
...
@@ -137,7 +137,11 @@ class RealDiceRandomSource(object):
raise
ValueError
(
"
Must provide at least %s items
"
%
self
.
dice_sides
)
if
(
self
.
dice_sides
**
num_rolls
)
<
len
(
sequence
):
print
(
"
Warning: entropy is reduced!
"
)
print
(
"
Warning: entropy is reduced! Using only first %s of %s
"
"
words/items of your wordlist.
"
%
(
self
.
dice_sides
**
num_rolls
,
len
(
sequence
))
)
print
(
"
Please roll %s dice (or a single dice %s times).
"
%
(
num_rolls
,
num_rolls
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_random_sources.py
+
1
−
0
View file @
b2a3020c
...
...
@@ -196,6 +196,7 @@ class TestRealDiceRandomSource(object):
assert
picked
==
1
out
,
err
=
capsys
.
readouterr
()
assert
"
entropy is reduced
"
in
out
assert
"
Using only first 6 of 7 words
"
in
out
assert
err
==
""
def
test_no_hint_if_entropy_is_not_decreased
(
self
,
monkeypatch
,
capsys
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment