mirror of https://github.com/keeweb/keeweb.git
fix #458: improved phonetic.js password generator
This commit is contained in:
parent
f5b75dd874
commit
2416b5fb44
|
@ -1,15 +0,0 @@
|
|||
<component name="libraryTable">
|
||||
<library name="keeweb node_modules" type="javaScript">
|
||||
<properties>
|
||||
<option name="frameworkName" value="node_modules" />
|
||||
<sourceFilesUrls>
|
||||
<item url="file://$PROJECT_DIR$/node_modules" />
|
||||
</sourceFilesUrls>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/node_modules" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
|
@ -71,7 +71,10 @@ var PasswordGenerator = {
|
|||
},
|
||||
|
||||
generatePronounceable: function(opts) {
|
||||
var pass = phonetic.generate({ length: opts.length });
|
||||
var pass = phonetic.generate({
|
||||
length: opts.length,
|
||||
seed: this.generateHash(1024)
|
||||
});
|
||||
var result = '';
|
||||
var upper = [];
|
||||
var i;
|
||||
|
|
|
@ -204,10 +204,12 @@ function getNextPhonetic(phoneticSet, simpleCap, wordObj, forceSimple) {
|
|||
* @returns {number}
|
||||
*/
|
||||
function getNumericHash(data) {
|
||||
var numeric = 0;
|
||||
let numeric = 0;
|
||||
data += '-Phonetic';
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
numeric += data.charCodeAt(i);
|
||||
for (let i = 0, len = data.length; i < len; i++) {
|
||||
let chr = data.charCodeAt(i);
|
||||
numeric = ((numeric << 5) - numeric) + chr;
|
||||
numeric >>>= 0;
|
||||
}
|
||||
return numeric;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue