From 31117082f0adec4f01e1851aba701e49f047bdf6 Mon Sep 17 00:00:00 2001 From: Michal Moskal Date: Sat, 22 Jun 2019 20:38:56 -0700 Subject: [PATCH] Improve UX of gen-random; add note to readme --- README.md | 1 + patcher/web.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1c4f25..d4b98f8 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ The reason to pick numbers at random is to minimize risk of collisions in the wild. Do not pick random numbers by banging on keyboard, or by using `0xdeadf00d`, `0x42424242` etc. A good way is to use the following shell command: `printf "0x%04x%04x\n" $RANDOM $RANDOM` +Another good way is the link at the bottom of https://microsoft.github.io/uf2/patcher/ This procedure was unfortunately not used for the SAMD51 and NRF52840 below. #### Family list diff --git a/patcher/web.js b/patcher/web.js index 6cc4689..180fb18 100644 --- a/patcher/web.js +++ b/patcher/web.js @@ -5,7 +5,8 @@ function savePatch(ev) { localStorage["UF2_PATCH"] = text.value } -function genRnd() { +function genRnd(ev) { + ev.preventDefault() let vals = new Uint32Array(1) window.crypto.getRandomValues(vals) document.getElementById("rnd-res").textContent = "Random number: 0x" +