使用 Web App 安全產生種子的方法

考量到網頁產生器仍然是多數人在接觸新的貨幣錢包,產生私鑰最常用的手段(像以太通常大家應該會最先使用 MEW)。以下提供由 IOTA knowledge base 推薦的 Web App,並提供簡單步驟就能確保產生種子時基本上是安全的。最下方是檢查此 Web App 的安全與完整性,可以選擇略過。

使用瀏覽器產生種子

如果真的想用 Web App 來產生 IOTA 種子的話可以參考以下步驟:

Web App 安全性驗證

The Stanford Javascript Crypto Library is a project by the Stanford Computer Security Lab to build a secure, powerful, fast, small, easy-to-use, cross-browser library for cryptography in Javascript.

以下是主要的程式碼並附上一些註解:

//Random number generator.
var gen = new sjcl.prng(10);

//start the built-in entropy collectors
gen.startCollectors();

//Called when generator is done.
sjcl.random.addEventListener("seeded", function() { document.getElementById("seed").innerText = genSeed(); });

//Called each time entropy is added.
sjcl.random.addEventListener("progress", function(p) {
    if(p != 1) {
        document.getElementById("seed").innerText = "Collecting entropy, please move your mouse/device\nProgress: " + p * 100 + "%"
    }
});

//sjcl.random.randomWords(nwords, paranoia) generates several random words, and return them in an array.
//sjcl.codec.base64.fromBits() converts from a bitArray to a base64 string.
//Remove all characters not belong to "A-Z9"
//Return the seed which is 81 characters long
function genSeed() {
    var seed = "";
    for(;seed.length < 81;seed += sjcl.codec.base64.fromBits(sjcl.random.randomWords(33, 10)).replace(/[^A-Z9]+/g, '')) {};
    return seed.substring(0,81);
}

results matching ""

    No results matching ""