Skip to content

Commit

Permalink
Remove data:[<media type>][;base64], from the data URI prior to hashi…
Browse files Browse the repository at this point in the history
…ng. All we want is the base64 string.

Updated the address accordingly in the Fun & Games section of the README.md.
  • Loading branch information
coreyphillips committed Jun 26, 2019
1 parent 2804c25 commit d0e5801
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This project turns any file into a mnemonic phrase allowing users to generate Bi
This was simply a fun project created as a proof-of-concept. As I learn more about Bitcoin I become tempted to tinker and experiment. This is the result of one of those experiments.

#### Fun & Games
Taking inspiration from Andreas' use of steganography in [this image](https://twitter.com/aantonop/status/603701870482300928?lang=en) I have sent 0.01 BTC to the following address, [bc1q4cxvtlfq8ee7jz33rnz2evtguvme30dwtywmwf](https://blockstream.info/address/bc1q4cxvtlfq8ee7jz33rnz2evtguvme30dwtywmwf). This address was generated using the aforementioned image along with a BIP39 passphrase. If you manage to claim it, congrats! I'd also love to know how you managed to do it so please feel free to reach out.
Taking inspiration from Andreas' use of steganography in [this image](https://twitter.com/aantonop/status/603701870482300928?lang=en) I have sent 0.01 BTC to the following address, [bc1qcyrndzgy036f6ax370g8zyvlw86ulawgt0246r](https://blockstream.info/address/bc1qcyrndzgy036f6ax370g8zyvlw86ulawgt0246r). This address was generated using the aforementioned image along with a BIP39 passphrase. If you manage to claim it, congrats! I'd also love to know how you managed to do it so please feel free to reach out.

#### Contributing
1. Fork it (<https://github.com/coreyphillips/bitimage>)
Expand Down
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ <h2>Turn Any Image, Document or Audio File Into A BIP39 Mnemonic</h2>

var file = picFile.result;

//Replace experimental MIME type strings.
if (file.includes("data:application/x-")) file = picFile.result.replace("data:application/x-", "data:application/");
if (file.includes("data:video/x-")) file = picFile.result.replace("data:video/x-", "data:video/");
if (file.includes("data:image/x-")) file = picFile.result.replace("data:image/x-", "data:image/");
if (file.includes("data:audio/x-")) file = picFile.result.replace("data:audio/x-", "data:audio/");
//Remove data:[<media type>][;base64], we only want the base64 <data> string.
var n = 0;
var word = ",";
if (file.includes(word)) n = file.lastIndexOf(word);
if (n > 0) file = file.slice(n+word.length, file.length);

//Create SHA256 hash of the file
var hash = Bitcoin.crypto.sha256(file);
Expand Down

0 comments on commit d0e5801

Please sign in to comment.