* (Optional) remove bias in password generation
This commit is contained in:
18
ewpass.js
18
ewpass.js
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
'checksum': undefined,
|
'checksum': undefined,
|
||||||
'DEFAULT': [ 16, 1, true ],
|
'DEFAULT': [ 16, 1, true, false ],
|
||||||
'domains': {}
|
'domains': {}
|
||||||
};
|
};
|
||||||
var currentDomain = undefined;
|
var currentDomain = undefined;
|
||||||
@@ -44,6 +44,9 @@
|
|||||||
var n = 0;
|
var n = 0;
|
||||||
|
|
||||||
while (m > 0) {
|
while (m > 0) {
|
||||||
|
if (!allowBias && m < l)
|
||||||
|
break;
|
||||||
|
|
||||||
m = Math.floor(m / l);
|
m = Math.floor(m / l);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
@@ -100,6 +103,7 @@
|
|||||||
$('#iteration').prop('disabled', 'disabled');
|
$('#iteration').prop('disabled', 'disabled');
|
||||||
$('#nextiter').prop('disabled', 'disabled');
|
$('#nextiter').prop('disabled', 'disabled');
|
||||||
$('#extended').prop('disabled', 'disabled');
|
$('#extended').prop('disabled', 'disabled');
|
||||||
|
$('#allowbias').prop('disabled', 'disabled');
|
||||||
$('#storedomain').prop('disabled', 'disabled');
|
$('#storedomain').prop('disabled', 'disabled');
|
||||||
$('#docopy').prop('disabled', 'disabled');
|
$('#docopy').prop('disabled', 'disabled');
|
||||||
|
|
||||||
@@ -122,11 +126,18 @@
|
|||||||
$('#iteration').val(_settings[1]);
|
$('#iteration').val(_settings[1]);
|
||||||
$('#extended').prop('checked', _settings[2] ? 'checked' : '');
|
$('#extended').prop('checked', _settings[2] ? 'checked' : '');
|
||||||
|
|
||||||
|
if (_settings[3] === undefined) {
|
||||||
|
$('#allowbias').prop('checked', 'checked');
|
||||||
|
} else {
|
||||||
|
$('#allowbias').prop('checked', _settings[3] ? 'checked' : '');
|
||||||
|
}
|
||||||
|
|
||||||
if (_settings !== settings.DEFAULT) {
|
if (_settings !== settings.DEFAULT) {
|
||||||
$('#length').prop('disabled', '');
|
$('#length').prop('disabled', '');
|
||||||
$('#iteration').prop('disabled', '');
|
$('#iteration').prop('disabled', '');
|
||||||
$('#nextiter').prop('disabled', '');
|
$('#nextiter').prop('disabled', '');
|
||||||
$('#extended').prop('disabled', '');
|
$('#extended').prop('disabled', '');
|
||||||
|
$('#allowbias').prop('disabled', '');
|
||||||
$('#storedomain').prop('disabled', '');
|
$('#storedomain').prop('disabled', '');
|
||||||
$('#docopy').prop('disabled', '');
|
$('#docopy').prop('disabled', '');
|
||||||
|
|
||||||
@@ -138,7 +149,8 @@
|
|||||||
_settings = [
|
_settings = [
|
||||||
parseInt($('#length').val()),
|
parseInt($('#length').val()),
|
||||||
parseInt($('#iteration').val()),
|
parseInt($('#iteration').val()),
|
||||||
$('#extended').prop('checked')
|
$('#extended').prop('checked'),
|
||||||
|
$('#allowbias').prop('checked')
|
||||||
];
|
];
|
||||||
|
|
||||||
settings.domains[currentDomain] = _settings;
|
settings.domains[currentDomain] = _settings;
|
||||||
@@ -162,7 +174,7 @@
|
|||||||
|
|
||||||
const ENTROPY_SIZE = 8;
|
const ENTROPY_SIZE = 8;
|
||||||
const map = settings.domains[currentDomain][2] ? EXTENDED_MAP : BASIC_MAP;
|
const map = settings.domains[currentDomain][2] ? EXTENDED_MAP : BASIC_MAP;
|
||||||
const rounds = calcRounds(map.length);
|
const rounds = calcRounds(map.length, settings.domains[currentDomain][3] === undefined ? true : settings.domains[currentDomain][3]);
|
||||||
|
|
||||||
if (settings.domains[currentDomain][0] > ENTROPY_SIZE * rounds) {
|
if (settings.domains[currentDomain][0] > ENTROPY_SIZE * rounds) {
|
||||||
settings.domains[currentDomain][0] = ENTROPY_SIZE * rounds;
|
settings.domains[currentDomain][0] = ENTROPY_SIZE * rounds;
|
||||||
|
|||||||
10
index.html
10
index.html
@@ -51,6 +51,16 @@
|
|||||||
<label><input type="checkbox" id="extended" checked="checked" /> Use special characters</label>
|
<label><input type="checkbox" id="extended" checked="checked" /> Use special characters</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="allowbias" /> Use all entropy<br />
|
||||||
|
<div style="padding-left: 2em; font-size: 70%;">
|
||||||
|
(Allows for longer passwords, but <br />makes them slightly more predictable)
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<input type="button" id="storedomain" value="Store" onclick="ewpass.storeSettingsForDomain();" />
|
<input type="button" id="storedomain" value="Store" onclick="ewpass.storeSettingsForDomain();" />
|
||||||
|
|||||||
Reference in New Issue
Block a user