Our testor (Ms. Phương) talk to me about, duplication of passphrase will become invalid passphrase in our wallet.
Look at BIP39 there are no duplication check. So I give it a try.
Create bip39.js
var bip39 = require('bip39')
function scanDuplicated(value){
let buff = value.split(' ');
let found = false;
let tripple = [];
for(let i = 0; i < buff.length; i++){
tripple[i] = (!tripple[i]) ? 0 : tripple[i];
for(let j = 0; j < buff.length; j++){
if(buff[i] == buff[j] && i != j){
tripple[i]++;
}
if(tripple[i] >= 2){
console.log(value);
found = true;
break;
}
}
if(found) break;
}
}
while(true){
scanDuplicated(bip39.generateMnemonic());
}
Install bip39
npm install bip39
Test and take result:
chiro@moonfang:~/bip39$ node bip39.js
cruise loan drop drop mansion regular drop length two present property caution
roast body roast roast cry fitness vendor nasty memory hollow curve duck
pretty nest electric explain wrong spread loyal fee spread eyebrow rebel spread
capable fiction hybrid fiction outdoor wing fiction jeans various monitor oblige curious
cube anchor pride dog anchor lock claim cable anchor what pull height
Let's take a look:
cube anchor pride dog anchor lock claim cable anchor what pull height