From 21eb55c899b601fd0fa2a92a4c8d16d0d107ec1b Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 3 May 2024 01:59:18 +0200 Subject: Include the diceware web app --- diceware-vt.patch | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 diceware-vt.patch (limited to 'diceware-vt.patch') diff --git a/diceware-vt.patch b/diceware-vt.patch new file mode 100644 index 0000000..8911ed2 --- /dev/null +++ b/diceware-vt.patch @@ -0,0 +1,65 @@ +diff --git a/index.html b/index.html +index 2f26ed9..3b4a2d3 100644 +--- a/index.html ++++ b/index.html +@@ -920,8 +920,19 @@ + + ++ + + +diff --git a/index.js b/index.js +index e95e2a1..9d45377 100644 +--- a/index.js ++++ b/index.js +@@ -238,11 +238,28 @@ function getWordFromWordNum (wordNum) { + function displayWords (words) { + 'use strict' + ++ // get symbol and number for the first and third words (CMD) ++ if (words.length > 1) { ++ var symbols = getWords(1,2) ++ var number = Math.floor(Math.random() * 100) ++ var symbol_pos = Math.floor(Math.random() * words.length) ++ var number_pos = Math.floor(Math.random() * words.length) ++ var capitalize_pos = Math.floor(Math.random() * words.length) ++ } ++ + // add the word to the global array of words + $.each(words, function (index, obj) { + var objEntropy = new Big(obj.entropy) + totalEntropy = totalEntropy.plus(objEntropy) + $('#totalEntropy').text(totalEntropy.toFixed(2)) ++ if (words.length > 1) { ++ // add symbol to random word (CMD) ++ if (index == symbol_pos) obj.word = obj.word + symbols[0].word ++ // add number to random word (CMD) ++ if (index == number_pos) obj.word = obj.word + number ++ // capitalize random word (CMD) ++ if (index == capitalize_pos) obj.word = obj.word.charAt(0).toUpperCase() + obj.word.substring(1) ++ } + wordList.push(obj.word) + }) + +@@ -370,4 +387,4 @@ $(document).ready(function () { + $('#addFiveDieRollWord').val('') + displayCrackTime(wordList) + }) +-}) ++}) +\ No newline at end of file -- cgit v1.2.3