Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions site/brainwallet.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!doctype html>
<html>
<head>
<title>Brainwallet Generator</title>
<meta charset="utf-8">
<script src="js/jquery.min.js"></script>
<script src="js/crc32.js"></script>
<script src="js/mnemonic.js"></script>
<script src="js/biginteger.js"></script>
<script src="js/config.js"></script>
<script src="js/crypto.js"></script>
<script src="js/base58.js"></script>
<script src="js/qrcode.js"></script>
<script src="js/sha3.js"></script>
<script src="js/cn_util.js?2"></script>
<script src="js/site.js"></script>
<style>
body {
font: 13px "Lucida Sans Unicode", "Lucida Grande", sans-serif;
}
.form-style {
margin:10px;
max-width: 1000px;
padding: 20px 12px 10px 20px;

}
.form-style label {
display:block;
margin-bottom: 10px;
}
.form-style label > span{
display: inline-block;
float: left;
width: 150px;
font-weight: bold;
}
.form-style input,
.form-style textarea,
.form-style select{
border:1px solid #BEBEBE;
padding: 7px;
margin:0px;
outline: none;
width: 810px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.form-style input:focus,
.form-style textarea:focus,
.form-style select:focus{
-moz-box-shadow: 0 0 8px #88D5E9;
-webkit-box-shadow: 0 0 8px #88D5E9;
box-shadow: 0 0 8px #88D5E9;
border: 1px solid #88D5E9;
}
.form-style input[type=button],
.form-style select{

}
.form-style .field-textarea{
height: 100px;
}
.form-style input[type=button]{
width: 100px;
background: #4B99AD;
padding: 8px 15px 8px 15px;
border: none;
color: #fff;
}
.form-style input[type=button]:hover, .form-style input[type=button]:hover{
background: #4691A4;
box-shadow:none;
-moz-box-shadow:none;
-webkit-box-shadow:none;
}
.form-style .required{
color:red;
}
.explain {
margin:10px;
max-width: 960px;
padding: 20px 12px 10px 20px;
}
.vanity {
color: #999999;
}
</style>

</head>
<body>
<div id="main-wrapper">
<div class="explain">
<h1>Brainwallet Generator</h1>
<div id="expText">
<p>
A <em>brainwallet</em> is a Monero address and keyset derived from a user-defined passphrase. This allows the seed to literally <em>never</em> be written down or typed, and therefore ensures (in theory) that the funds in the
associated address are safe forever within the brain of the creator. In reality, humans are shockingly poor sources of entropy and the phrases that they create are notoriously easy to crack (albiet far more difficult in Monero than Bitcoin due to the underlying architecture). Nevertheless, in very specific scenarios and use cases (e.g. highly adversarial environments for short periods) they do have a role. If you are unsure - <b>DO NOT USE A BRAINWALLET</b>.
</p>
<p>
<a href="https://www.youtube.com/watch?v=foil0hzl4Pg">Here</a> is a good talk on how someone managed to gain access to large numbers of Bitcoins by exploiting poor entropy in brainwallet creation in Bitcoin. Don't be a statistic :)
</p>
<center class="vanity">
This tool was made by <a href="https://www.reddit.com/user/taushet">taushet</a> on top of Luigi1111's toolkit. If you want to donate Monero, send it here: <a href="http://donate.getmonero.org">donate.getmonero.org</a>
</center>
</div>
</div>
<div id="bwGen">
<form class="form-style" onsubmit="bwGen();" method="post">
<label for="coinType"><span>Coin: </span>
<select id="coinType" onchange="coinType(this.value);">
<option value="12">Standard XMR</option>
<option value="01">BBR</option>
<option value="48">(the real) DaSH</option>
<option value="b201">AEON</option>
<option value="35">XMR Testnet</option>
<option value="13">XMR Integrated</option>
<option value="11">XMR Truncated</option>
</select>
</label>
<label for="mnDict">
<span>Dictionary:</span>
<select id="mnDict">
<option value="english">English (Monero default)</option>
<option value="electrum">Electrum (Aeon default)</option>
<option value="spanish">Spanish</option>
<option value="portuguese">Portuguese</option>
<option value="japanese">Japanese</option>
</select>
</label>
<label for="pubAddrNetByte"><span>Network Byte: </span>
<input type="text" id="pubAddrNetByte" value="12" size="4"/>
</label>
<label for="bw_input">
<span><b>Phrase:</b> </span><input class="mainInput" id="bw_input" rows="2" placeholder="Enter brainwallet phrase." required="true" />
</label>
<label>
<span>&nbsp;</span><input type="button" onclick="bwGen();" value="Generate" />
</label>
<br>
<h3>Wallet:</h3>
<label for="bw_mnemonic">
<span>Seed: </span><textarea id="bw_mnemonic" rows="2" readonly></textarea>
</label>
<label for="bw_hexSeed">
<span>Hex Seed: </span><input id="bw_hexSeed" readonly/>
</label>
<label for="bw_privSpend">
<span>Private Send Key: </span><input id="bw_privSpend" readonly/>
</label>
<label for="bw_privView">
<span>Private View Key: </span><input id="bw_privView" readonly/>
</label>
<label for="bw_pubSpend">
<span>Public Spend Key: </span><input id="bw_pubSpend" readonly/>
</label>
<label for="bw_pubView">
<span>Public View Key: </span><input id="bw_pubView" readonly/>
</label>
<label for="bw_pubAddr">
<span>Address: </span><input id="bw_pubAddr" readonly/>
</label>
</form>
</div>
<br>
</div>
</body>
</html>
61 changes: 61 additions & 0 deletions site/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,68 @@ window.onload = function(){
derivedViewKeyTag = document.getElementById('derivedViewKey');
if (dataHashTag !== null){
hashUpdate(document.getElementById('theData').value);
}//BrainWallet
bw_phrase = document.getElementById('bw_input');
bw_hexSeed = document.getElementById('bw_hexSeed');
bw_privSpend = document.getElementById('bw_privSpend');
bw_pubSpend = document.getElementById('bw_pubSpend');
bw_privView = document.getElementById('bw_privView');
bw_pubView = document.getElementById('bw_pubView');
bw_pubAddr = document.getElementById('bw_pubAddr');
bw_mnemonic = document.getElementById('bw_mnemonic');
}

//BrainWallet, blame Taushet if there is an error here, not Luigi1111
function bwGen() {

//Clear
bw_hexSeed.value = "";
bw_privSpend.value = "";
bw_pubSpend.value = "";
bw_privView.value = "";
bw_pubView.value = "";
bw_pubAddr.value = "";

//Generate Hex Seed
var hs = keccak_256(bw_phrase.value);

//Generate Keys
var pID = "";
var netbyte = pubAddrNetByte.value;
if (netbyte === "11"){
if (hs.length == 64){
var privSk = sc_reduce32(hs);
var privVk = sc_reduce32(cn_fast_hash(sec_key_to_pub(privSk)));
} else {
var privSk = sc_reduce32(cn_fast_hash(hs));
var privVk = sc_reduce32(cn_fast_hash(sec_key_to_pub(privSk)));
}
} else {
if (hs.length == 64){
var privSk = sc_reduce32(hs);
var privVk = sc_reduce32(cn_fast_hash(privSk));
} else {
var privSk = sc_reduce32(cn_fast_hash(hs));
var privVk = sc_reduce32(cn_fast_hash(cn_fast_hash(hs)));
}
if (netbyte === "13"){
pID = rand_32().slice(0,16);
}
}
var pubVk = sec_key_to_pub(privVk);
var pubSk = sec_key_to_pub(privSk);
var address = toPublicAddr(netbyte, pubSk, pubVk, pID);

//Generate MN
bw_mnemonic.value = mn_encode(hs, mnDictTag.value)

//Publish
bw_hexSeed.value = hs;
bw_privSpend.value = privSk;
bw_pubSpend.value = pubSk;
bw_privView.value = privVk;
bw_pubView.value = pubVk;
bw_pubAddr.value = address;
}


Expand Down