Diceware是一个基于jQuery的高熵但易于记忆的密码生成器,它使用普通骰子从Diceware单词列表中随机选择单词。
密码生成器基于上的建议https://world.std.com/~reinhold/diceware.html,其中虚拟骰子被扮演5次,并且5位数字用于单词查找表。4个骰子给你4个随机单词,这些单词对人类来说很容易记住,但熵很高,很难破解。
1.在页面上包含jQuery库和捆绑的JavaScript&CSS。
<link href="/path/to//dice.css" rel="stylesheet" /> <script src="/path/to/cdn/jquery.slim.min.js"></script> <script src="/path/to/dist/bundle.js"></script>
2.为密码生成器创建HTML。
<!-- This row is completely hidden, but is used to hold elements that get cloned after a dice roll. --> <div class="source" style="display: none; "> <div class="col-md-12" style="height: 0px; "> <div class="die dice1 dice_element" style="float: left; "> <div class="dot center"></div> </div> <div class="die dice2 dice_element" style="float: left; "> <div class="dot dtop dleft"></div> <div class="dot dbottom dright"></div> </div> <div class="die dice3 dice_element" style="float: left; "> <div class="dot dtop dleft"></div> <div class="dot center"></div> <div class="dot dbottom dright"></div> </div> <div class="die dice4 dice_element" style="float: left; "> <div class="dot dtop dleft"></div> <div class="dot dtop dright"></div> <div class="dot dbottom dleft"></div> <div class="dot dbottom dright"></div> </div> <div class="die dice5 dice_element" style="float: left; "> <div class="dot dtop dleft"></div> <div class="dot dtop dright"></div> <div class="dot center"></div> <div class="dot dbottom dleft"></div> <div class="dot dbottom dright"></div> </div> <div class="die dice6 dice_element" style="float: left; "> <div class="dot dtop dleft"></div> <div class="dot dtop dright"></div> <div class="dot center dleft"></div> <div class="dot center dright"></div> <div class="dot dbottom dleft"></div> <div class="dot dbottom dright"></div> </div> <div class="dice_word dice_element" style="float: left; padding-left: 20px; padding-top: 25px; "> </div> <div class="results_words_key" >Your words are: </div> <div class="results_words_value" ></div> <div class="results_phrase_key" >Your passphrase is: </div> <div class="results_phrase_value" ></div> <div class="results_num_possible_key" ># of possible passwords: </div> <div class="results_num_possible_value" ></div> </div> <div class="alert alert-danger bad_crypto" role="alert"> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <span class="sr-only">Error:</span> Whoa there! Your browser doesn't have the getRandomValues() function. This means that dice rolls you make <em>will not be cryptogrpahically secure!</em><br/> Please try another browser. Otherwise, proceed at your own risk. </div> </div> <div class="message" ></div> <h2 class="dice_num"> Number of Dice Rolls: </h2> <div class="btn-group-lg" role="group" aria-label="..."> <button id="button-dice-2" type="button" class="btn btn-default dice_button">2</button> <button id="button-dice-3" type="button" class="btn btn-default dice_button">3</button> <button id="button-dice-4" type="button" class="btn btn-default dice_button">4</button> <button id="button-dice-5" type="button" class="btn btn-default dice_button">5</button> <button id="button-dice-6" type="button" class="btn btn-default dice_button active">6</button> <button id="button-dice-7" type="button" class="btn btn-default dice_button">7</button> <button id="button-dice-8" type="button" class="btn btn-default dice_button">8</button> </div> <br/> <a name="roll_dice_button" ></a> <button type="button" class="btn btn-default btn-lg btn-primary" id="roll_dice"> <span class="glyphicon glyphicon-play" aria-hidden="true" ></span> Roll Dice! </button> <!-- Results will be displayed here. --> <div class="results"> </div>
$ npm install $ npm run dev-build $ http-server $ vim src/lib.js src/index.js $ rm -fv src/index.js && git co src/index.js $ npm run build
2022-02-07