Skip to content

Commit d0e5801

Browse files
committed
Remove data:[<media type>][;base64], from the data URI prior to hashing. All we want is the base64 string.
Updated the address accordingly in the Fun & Games section of the README.md.
1 parent 2804c25 commit d0e5801

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This project turns any file into a mnemonic phrase allowing users to generate Bi
1717
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.
1818

1919
#### Fun & Games
20-
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.
20+
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.
2121

2222
#### Contributing
2323
1. Fork it (<https://github.com/coreyphillips/bitimage>)

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ <h2>Turn Any Image, Document or Audio File Into A BIP39 Mnemonic</h2>
137137

138138
var file = picFile.result;
139139

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

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

0 commit comments

Comments
 (0)