start	end	text
0	1700	This is our first talk today.
3020	8240	Talk is basically the one Bitcoin heist with Joseph Gabay.
8620	10340	And here he is.
10360	12340	And give him a big round of applause.
12340	14780	This is the first talk of DAKON.
15000	15940	All right.
16580	17320	All right.
17320	18260	There you go, buddy.
18260	19620	Thank you very much.
20320	21520	Hello everyone.
21520	22520	Good morning.
22600	24340	Thank you all for coming.
25540	29120	My name is Joseph Gabay and I stole a Bitcoin from the Internet.
29300	33920	And I'm going to tell you how I did it and how you can do it too, but not really.
34520	37300	So before I get into this talk, I want to give a basic disclaimer.
37300	38540	This is a personal project.
38540	42280	It's not affiliated with my employer, with my friends, with anyone.
42740	45740	Just don't call my employer asking about this.
45740	47100	I've had that happen before.
47100	48580	It's an awkward conversation.
49260	51880	I'll have my email address at the end if you've got questions.
51880	52360	Reach out to me.
52360	53400	I'm happy to talk.
54480	56540	So what this talk is about.
56860	63340	In short, about ten years ago, some anonymous person on the Internet issued a puzzle challenge to the Internet.
63580	65320	There is a one Bitcoin prize.
65320	66440	There are 20 clues.
66440	71960	If you solve all 20 clues, you get the phrase that unlocks the brain wall that contains the Bitcoin.
72160	75960	Now this went on claim for a very long time, over 11 years.
75960	83460	And as I'm sure all of you know what the Bitcoin prize has done in those past 11 years, it was definitely interesting that it had never been claimed.
83900	97780	So last year, as the prize continued to spike, I eventually got over my disdain for OpenCL and decided to learn how to botch the other hashcat plugins in order to crack brain wallets and finish the rest of this puzzle.
97880	110600	So this talk is going to talk about the puzzle itself, who wrote it and how it worked, how brain wallets work under the hood, which is the technology that the puzzle relied on, and also the basics of hashcat modules and plugins and how to put them together.
111260	115020	So, a little bit about me and how I got here.
115020	116820	I used to be a robotics engineer.
117120	119920	And then I did something very funny with shopping cart wheels.
119920	122080	You can check it out at the Physical Security Village later.
122080	125820	I've got a little demo booth, but you can control them with your phone by freaking them.
125940	130920	I spoke about that at DEF CON 29 and 31, if you're curious at all.
130920	135980	And I'm a skydiver, an internet treasure hunter, retired now.
135980	137780	I figure I should quit while I'm ahead.
138100	141160	And I'm here on stage now.
141720	143940	So, the one bitcoin book.
144400	149040	This was a puzzle challenge posted to Twitter and Reddit in April 2014.
149360	154240	The deal was the first ten people to sign up for it on the website got a free copy of the book.
154240	159400	Everyone else had to pay 0.01 bitcoins, which at the time was only four or five dollars.
159400	161840	But now is much, much more.
162300	165860	The copyright at the bottom of it was to a Spencer Lucas.
165860	168820	I've done some basic OSINT on this.
168820	172260	I haven't been able to find any social media presence, any name.
172260	174580	The website was WhoIsProtected.
175560	177620	So, I really have no idea.
177620	181300	I've tried reaching out to all of the social media accounts and haven't gotten any responses.
181300	185900	Spencer Lucas, if you're out there watching this talk, reach out, please.
187620	189520	But there were 20 clues.
189680	192180	I'll give some examples of them in just a second.
192200	195860	But each clue gave you a single letter, uppercase or lowercase.
195860	198020	There were no special characters, no numbers.
198020	202540	So, that is a 52 character set for each possible clue.
202780	210900	You took all of these, you combined them, and you added an extra little bonus string that you got as part of the email when you actually paid for it or signed up for free.
210900	213040	Put that into the Brain Wallet utility.
213280	217860	And if you got it right, you get the private key for the address containing one Bitcoin.
218820	220660	Reactions to this were a little mixed.
220660	223540	A lot of people on Reddit thought this guy was full of crap.
223920	225100	Rightfully so.
225740	227300	People thought it was suspicious.
227560	232820	And , you know, he was, to his defense, engaging with people on Reddit and trying to defend it.
232820	236580	He, at one point, had joked if this went well, he might release a 10 Bitcoin book.
236580	238160	I'm still waiting for that.
238160	242720	I hope he chooses a different technology to base it off of for reasons that will become evident.
243300	244220	But, yeah.
244220	250700	It was one of those things where I don't think a lot of people really wanted to engage with it because they didn't think it was legitimate.
250700	253700	They thought someone was trying to steal four or five bucks at a time from folks.
253700	255080	Which, fair.
255240	257360	But, so it goes.
257480	259260	Let's go through a couple of the clues.
259800	261820	I had some help solving these.
261820	264840	One of them is from my friend Ashley who helped me with quite a few of these.
264840	266260	She's in the audience here right now.
266260	275260	If we could just give a big round of applause because she was hugely instrumental in helping me get here and also just keeping my fixation on this alive.
275860	280120	So, this is clue 12, one of the examples that Spencer posted on Twitter publicly.
280440	283920	It consists of four shapes with letters in them.
284100	290120	And it's not said, but you can intuit that you need to figure out the pattern and figure out what letter is in the next shape.
290420	293520	So, again, I have no idea how Ashley figured this one out.
293520	297340	But you have to take the position index of each shape.
297340	298840	So, one, two, three, or four.
298840	302660	Count the number of letters in the word for the number of that index.
302660	304260	So, one has three letters.
304260	308160	That number gives you the number of sides in the polygon.
308160	311220	So, one is three, gives you a triangle.
311820	314980	Three is five, gives you a pentagon, etc.
315960	325620	And then you take the nth letter from the word of the shape and put that in the letter, and that's the pattern.
325620	332720	So, if we continue this on, we get five, which has four sides, which gives us a square, and the fifth letter of square is R.
332720	333860	So, that's R.
334240	339600	These were fairly complicated, and some of them were a bit involved.
339600	341220	Some of them were less so.
341220	343940	Oh, no, there's one even more impressive one after this.
343940	345420	This is one that I solved.
345420	346720	This was a lot easier.
346780	348520	They were not all as esoteric.
348520	352660	This was a 4x4 grid with some numbers in it and a missing space.
353140	360020	If you look at the diagonal, you see KMPH spelled out backwards, and then some numbers.
360120	366720	Physicists amongst you, or weirdos, might recognize that the speed of light in kilometers per hour is, in fact, that number.
366720	370000	And we know that the speed of light is represented with a lowercase c.
370000	371920	So, that's clue four.
371920	376780	And here's another one that I actually solved, and I would have never gotten this in a million years.
376780	382440	It's a sequence of 12 numbers arranged in five rows, and the last number is unknown.
382440	390100	There is a key at the bottom for decoding the final number into the answer, and you can see it's A through Z lower, A through Z upper.
390440	400840	And, yeah, I'm just going to give you the answer for this one, because the nth number is the sum of the nth prime number, Fibonacci number, and perfect square.
402300	409180	I, again, actually have no idea how you got this, but it's a good one.
409180	413400	And you add everything up, you get 325, which corresponds to uppercase B.
413700	416620	So, those are some examples of the kinds of clues.
416620	419280	You know, a lot of them were pattern-based, some of them were basic.
419280	424580	One of them, which I absolutely drove myself nuts on, had three-by-three grids with letters in them.
424580	427820	I was trying to solve Sudoku or word searches.
427820	434420	No, they were all just airport codes for airports in countries that started with S, and the answer was uppercase S.
434580	437440	And I overworked that one really hard.
437440	441300	I had a Python program doing Sudoku solving with all the airport codes for countries.
441300	442720	It was... it was...
443140	444260	But, anyways.
444300	446280	So, all of this goes into a brain wallet.
446280	447820	What is a brain wallet?
447820	454580	And I'm going to say right now, don't use brain wallets to store anything valuable right now, both because of what I've done and what another hacker's done years ago.
454580	456560	I'm going to talk about their cool work in a sec.
456560	460980	But brain wallets are basically a method to store Bitcoin in your brain.
461100	463660	You create a secret passphrase.
463740	474240	This can be anything from, you know, password 123, which you'll be stolen from immediately, to the entire B-movie script.
474240	480020	Which, again, you'll be stolen from immediately because people have all of the things people would think of just cycling through.
480020	487320	People have been like, oh, I've used the first three paragraphs from The Great Gatsby and my money was stolen in, like, five seconds.
487580	490040	Don't use brain wallets for anything important.
490200	493340	We'll talk about the internals and how they work a little later on.
493340	504060	But the original website, Brain Wallet, was taken down after another hacker had pointed out some fairly significant security weaknesses in how it worked.
504060	506280	And that resulted in people getting their money stolen.
506280	521640	But there is a reproduction of it for people who need to reclaim their funds, and it has a big warning at the top at brainwalletx.github.io in case anyone wants to play around with this at home and needs to actually go from the brain wallet phrase to the private key.
522680	530800	So, before we get into how the brain wallet works, I'm going to give a very, very brief overview of two key cryptographic concepts.
530800	535040	That's going to be hashes and elliptic curve cryptography.
535040	540740	So, hashes are a special little function that basically act as one-way trap doors.
540740	542980	You can take an input of any size.
542980	549020	It can be a single letter, or it can be the entire script of the Bee Movie, or it can be the Bee Movie as an MP4 file.
549020	553280	But you can take anything in, and it outputs it to an output of a fixed size.
553280	557540	So, any input, a size of 128 bytes, for example.
558300	562060	And the important part about hashes is they are repeatable.
562060	566200	So, if you hash the same thing twice, you will always get the same result.
566740	572880	You can change just a single character in a long text, and it's going to completely change what the hash is.
572880	574820	And this means there's no way to go backwards.
574820	579220	I can't give you a hash, and you tell me what the original thing was.
579220	580200	At least easily.
580200	583460	You have to basically brute force it, which is what this talk is about.
584040	590800	They're used in a lot of contexts, and this is an entire field of cryptography unto themselves, so I'm not going to go into too much detail.
590800	594100	But they're very important for storing passwords safely.
594100	596860	So, if you have a database breach, people don't know all the passwords.
596860	601520	You can use them to verify data integrity, because if one little thing changes, the whole hash changes.
601700	604760	And, in some cryptographic contexts, they just waste time.
604760	615220	They're computationally expensive, and if you want to make an attacker waste a bunch of time so they can't brute force as fast, you say, all right, do a thousand versions of this hash over and over.
615220	618620	And it knows what the answer should be, so you have to do the work.
618620	622240	The second important concept is elliptic curve cryptography.
622240	631700	This one is even more esoteric, so I'm going to skip over some of the technical details, but the important parts are you have two keys with this.
631700	634700	You have a private key and a public key.
634980	642500	The private key is used to sign messages, encrypt them, and the public key is used to verify or decrypt them.
642500	646760	There's a lot of nuance here, but that's the important part for what we're doing here.
646760	655800	If you have the private key, you can always figure out the public key, but it is impossible to figure out what the private key is from the public key.
655800	664080	That's what a lot of modern cryptography is based on, and until quantum computing becomes in vogue, that's going to be the norm.
664520	667560	They're used all over for creating secure connections.
667640	675060	Cryptocurrencies use them heavily, as we're about to learn, and they're critical for authentication and identity verification.
675660	677120	It's a lot of deep math.
677120	681520	They're very cool, but well, well beyond the scope of what I can competently explain.
682140	683820	So we have these.
684000	685380	How do these make a brain wallet?
685380	689240	How do you take a phrase in your head and get Bitcoin out of it?
689340	693600	So we take a secret passphrase and we somehow transform it into a Bitcoin address.
693600	695320	There's some mystery steps in between.
695980	699660	We take the secret passphrase.
699720	702840	We'll use hello DEF CON 33 for our example here.
702840	707060	And first we run it through a hash algorithm called SHA-256.
707720	713500	So this is going to take hello DEF CON and turn it into that string starting with BDA that you see there.
713980	717560	Now this is going to be what we use as our private key.
717560	720400	The brain wallet application calls this the secret exponent.
720400	724020	That's not wrong, but that's not the nomenclature usually used with cryptocurrencies.
725140	735260	So we're going to take this, and the nice part about the hash algorithm is no matter what input you have, it'll always give you the same size output.
735260	743980	So Bitcoin private keys are expected to be a specific size, so you can use the hash algorithm to force whatever input to be a valid private key.
743980	746260	So that's the beauty of hash algorithms there.
746640	760400	So using that elliptic curve cryptography, we basically plot stuff on some neat parabolas, we can get the public key associated with this private key, and that's that little string starting with 04A.
760400	765840	And I'm going to tell everyone now there's no Bitcoin on this address, if anyone's already got the site up.
766820	770380	So you take this and you do another hash algorithm.
770380	779700	This is called hash 160, and this is kind of specific to Bitcoin, but it's a combination of another round of SHA-256 and then RIP EMD 160.
779700	787900	And the important part is you get 160 character output from RIP EMD 160, and that's what you're going to need to make your address.
788360	799180	And basically getting the address from that is pretty easy, you just shift around a couple bits, add some encoding, add a checksum, and encode it all in base 56, and you have your Bitcoin address.
799180	801820	In this case it's 15ZC whatever.
802200	813560	So, and you can do this with any phrase, if I change the H in Hello Def Con to a lower case H, all of those strings below it would change radically, and I would get a completely different Bitcoin address, and a completely different private key.
814440	817780	So, how do we solve the puzzle the intended way?
818540	832700	The intended way is we solve all 20 clues, we add the secret string, which is another 20 clues that we got in the email to the end of it, we throw this into the Brain Wallet website, we get the private key, we take that private key, put it into our wallet,
832700	833820	and extract the money.
834340	837140	And somehow profit, and pay a bunch of taxes.
838000	840820	Well, as you can guess, I didn't do it that way.
840820	860000	In retrospect, I know this with the clarity of hindsight, I had, me and Ashley had solved 16 of the 20 clues, we didn't know how many, how close we were originally, but we were fairly close, and we still weren't going to cross that finish line, and there's still two that I have no idea how to get the answer to,
860000	861420	despite knowing the answer.
861420	874460	So we're going to do it the hacker way, and this involves some spreadsheets and a bunch of math, but we had a high confidence in at least 70% of the clues, decent guess for 20%, and then the last two, absolutely no idea.
874660	884140	And I thought, what if we just brute force the last 30%, you know, it's only like a couple letters, how hard can it be?
884600	886720	Let's find out, let's do some math.
887480	890280	So, I tricked you all, it's math lesson time.
891200	892880	Let's talk about combinatorics.
892880	897340	So, combinatorics, very basically, it's a branch of math dealing with counting things.
897340	899740	How many ways can you arrange a set of objects?
899740	902480	If the order does matter, if the order doesn't matter.
904180	908860	And it's a very fun field of math because it can give us some ridiculously large numbers.
909840	917000	So, for instance, we have 20 positions, each one having 52 possibilities to solve.
917000	919080	That's 52 to the 20th power.
919080	921880	And I have just lost my presentation, there we go.
921880	926020	So, it's 52 to the 20th power, and that's a really, really big number.
927300	931820	Every clue we have a confident answer to divides this number by 52.
931820	937380	And you can see I have a little chart to the side there that kind of shows how quickly that grows.
937680	948500	You know, we go from only missing 2 to, you know, 2700 possibilities, to missing 17 to already 140,000, and it just grows quite literally, exponentially.
948680	954740	There's way too many to test manually with any sort of brute force, so we need to make a computer do this.
955140	964000	Thankfully, another brilliant hacker by the name of Ryan Castellucci, I don't know how to pronounce their last name, but they're a fellow non-binary hacker.
964180	968620	They're currently suing the UK government for non-binary recognition.
968620	970660	I'll have a little plug for them later.
970660	980120	But they spoke at DEF CON 23, where they introduced Brain Flare, which was a utility for cracking brain wallets in CPU time.
980220	986120	And they are the main reason you should not use brain wallets, or at least up until now, they were the main reason.
986120	987620	Now there's two good reasons.
988160	993820	You can do whatever you want with your money, I'm not your mom or accountant, but, like, it's not a good idea.
993980	995340	It's going to get stolen.
995500	1003660	This only runs in CPU, it is not GPU accelerated, but, you know, given the numbers that I just looked at, depending on the speed I get, that's quite possible.
1004100	1006200	So, I do a little bit of testing.
1006580	1011960	My home PC maxes out at 1.4 mega hashes a second.
1011960	1015840	That's 1.4 million hashes per second it can do, possibility-wise.
1015840	1018640	And I've got my computer specs there in case anyone's curious.
1019380	1022320	So now we get to do math with big numbers, which is fun.
1022760	1026340	1.4 mega hashes is 1.4 times 10 to the 6th.
1026340	1036140	We divide that by our number that's 10 to the 20th, and we get a number on the order of 4.73 times 10 to the 20th years.
1036260	1040220	That is 10 orders of magnitude larger than the age of the universe.
1040280	1044700	I am not going to crack the entire puzzle from scratch on my home computer.
1045260	1048920	Thankfully, we already solved a bunch, and that cuts it down significantly.
1049060	1058260	If we have 15 solved, which is one more than we were confident on, that gets us down to a much more reasonable number, and we can solve it in about 270 seconds.
1058740	1060320	Which... let's do it!
1060920	1069560	And this is just another example of how long it would take to solve each number of unknowns.
1070780	1073280	So, let's crack the puzzle.
1073580	1077760	I wrote a lightweight generator script in C.
1077920	1081020	It pipes its output directly into Brainflare.
1081020	1085020	It is basically just a whole bunch of arrays with characters.
1085280	1097380	It pipes all of the different things in, and Brainflare converts them into a brain wallet, and tells me if it matches the Bitcoin address that I told it in advance.
1097380	1101000	So, let's rip through, you know, just a cool 20 billion hashes.
1101000	1101900	No big deal.
1104600	1107660	That was... let me get my alignment better.
1107780	1108680	There we go.
1109980	1114120	So, four hours later, it was easy.
1114180	1115800	Nah, I didn't get anything.
1116580	1117800	Didn't work.
1117860	1122160	I expanded this to a run with seven unknown clues.
1122280	1124500	That took over eight days to run.
1124500	1130600	It was just very weird having my computer on for eight days straight, not using it because it was fully maxed out.
1130800	1132640	And, didn't get it.
1133560	1135820	At this point, it was very discouraging.
1135820	1139800	One of the big problems with this challenge is, there's no feedback in the process.
1139800	1144280	You're putting in... it's like CTS where you're just putting in a flag and being told yes or no.
1144280	1146820	You don't know which clues are right.
1146820	1149640	You don't know which clues are wrong.
1149980	1153520	You don't even know if the puzzle's solvable.
1153700	1165500	It had been... I'd taken various swings at this over the past ten years, but it had been a significant amount of time, and Bitcoin had increased, and presumably the puzzle creator knew the answers and likes money.
1165500	1169180	So, one would assume that he would have solved it himself.
1169180	1172320	So, the suspicion of, is this even possible?
1172320	1175400	Did the creator make a typo and the money is just lost forever?
1175800	1177360	That started to cross my mind.
1177360	1179180	So, I need to try a different approach.
1179740	1182060	And that involves rolling unknowns.
1182260	1184520	We're doing more combinatorics, I know.
1185800	1191740	Basically, we have a number that we know, and we know at least one of those is wrong.
1191740	1200440	So, we need to rotate through all the possible combinations of ones that we think are right and set them to be the wild card and rotate through all the possibilities.
1200460	1203380	And that's going to increase our solution space significantly.
1203380	1207740	And this lovely equation can tell us by exactly how much.
1207960	1210400	And this table can save you from doing the math.
1210560	1219580	As we can see, I have the number of rotating wild cards and the number of fixed wild cards, that is ones that we know we don't know and are always brute forcing.
1219580	1227640	And as we change the number of those, we see that it increases the crack time by a different factor.
1227640	1235480	For instance, if we have five fixed wild cards and two rotating wild cards, that increases the time to crack by a factor of 105.
1235760	1244720	Which is significant to cross any sort of space, given the fact that there are 20 ones that we don't know that we don't know.
1244720	1248180	One of the ones that I was confident in had to be wrong.
1248180	1249360	Nope.
1250780	1253960	So, we got to go fast.
1254840	1258320	GPUs are the best for doing any sort of cryptographic operation.
1259020	1261380	Because they can do stuff in parallel.
1261380	1269820	So, CPUs basically, they take one hash at a time and do all the math for that one hash, check it, and see if it works.
1270020	1281240	GPUs, because they're used to having to render grids of pixels that are doing the exact same math for the shader over and over, they basically have a bunch of mini-CPUs all in parallel.
1281240	1285340	The catch is, they can only do the same operation at a time.
1285340	1292420	So you have multiple hash candidates all loaded in and they're going through each step one at a time in lockstep.
1292420	1298480	And then at the very end, you can just look through the very end and say, alright, do any of these match what we're looking for?
1298640	1305500	It's a massive, massive time increase and it's the reason cryptocurrency miners have bought up all the graphics cards.
1305500	1308120	Because it's the same crypto math.
1308480	1313240	The other problem for me is, coding for GPUs is hard.
1314380	1315040	Really hard.
1315040	1319800	It is kind of an obscure area that's very specialized.
1319800	1323140	There is not a lot of good tutorials for it.
1323200	1325500	Or not a lot of resources.
1325620	1331860	You know, in the days even before ChatGPT, there was basically nothing.
1331860	1336520	And I did, just out of curiosity, throw up ChatGPT and say, make me a hashcat module to do this.
1336520	1338720	And it can't do OpenCL either.
1340380	1342440	But has someone done it for me?
1342440	1343460	I'm lazy.
1343460	1344320	We'll see.
1344720	1352620	So I was looking at a couple GPU-based projects that do similar things around trying to find a specific Bitcoin address.
1352620	1355380	And there are three major candidates here.
1355500	1358840	VanityGen and its subprogram OCLVanityGen.
1358840	1363400	OCL being OpenCL, which is the GPU programming language.
1363400	1365400	It's used to generate vanity addresses.
1365400	1368160	Let's say you want a Bitcoin address that starts with your name.
1368540	1374760	You can have your GPU generate Bitcoin addresses just at random until it eventually hits one.
1374760	1377500	And you'll go through billions and you'll hit one.
1377560	1380360	But if you can do billions a second, it's pretty all right.
1380500	1381980	This uses GPU.
1382100	1383400	And that's promising.
1383720	1390460	Because you can say, I want to find this pattern of address and it does some sort of cryptography.
1390460	1391620	And it does it very fast.
1391620	1395940	It's in the giga hashes range on my GPU.
1396240	1400120	There's also Bitcrack, which is made to solve a different Bitcoin puzzle.
1400120	1403600	It's not really a puzzle as much as a brute force experimentation.
1404340	1412500	Basically, someone said, I put Bitcoin at this address with a private key that starts with this many zeros.
1412520	1418320	And higher and higher prizes for progressively fewer and fewer known zeros.
1418320	1426780	So there's a bunch of people who are using GPUs to basically go through all of that space and try to find what the private key is and get the money.
1426780	1428360	And that's a whole separate thing.
1428360	1428900	But it's neat.
1428900	1432240	But it's someone doing something similar and maybe I can use that.
1432940	1436960	And then there's Hashcat, which, spoiler, is what I ended up using.
1436960	1441480	But that's a general use CPU password and hash cracking utility.
1441480	1443840	It's not specifically for cryptocurrency.
1443860	1446380	It has a couple of cryptocurrency modules, which we'll use.
1446380	1448200	But it doesn't support brain wallets.
1449260	1452320	So we'll take a look at Vanity Gen real quick.
1453320	1454960	It's very, very fast.
1454960	1456660	You can see I lied a bit.
1456660	1459400	It's actually several hundred mega hashes a second.
1459400	1464820	But that's still pretty good just running on a random cloud instance GPU.
1464820	1468080	I think that was a 3060, no, 3080 I see right there.
1468700	1472360	This turned out to be a bit of a lie when it comes to what I need to do.
1472420	1475160	They do a neat little trick called batch inversion.
1476160	1480020	It's clever, but it unfortunately makes it impossible to do what I need to do.
1480020	1498560	Without getting too far into the math of it, if you don't actually care about your specific inputs, you can put a bunch of related points all together and do the really expensive math operation once and then figure out the result for all of those points based off that one thing.
1498780	1509120	And it's really handy, but that's basically saying, private key and all the private keys within N range of it and do the batch inversion and then figure out the results.
1509500	1514100	I'm trying to do arbitrary private keys, so that's not exactly going to work.
1516700	1519560	So, what about Bitcrack?
1520100	1525300	This one looks for a pattern matching a specific private key.
1525920	1528540	It also shows a very promising hash rate.
1528740	1531940	It lets you specify a range of key spaces to search.
1531940	1539480	This is because people want to be able to coordinate, all right, I'm searching this range of private keys and you can search this one so we're not just doing the same space.
1540480	1543560	Problem is, it's also using batch inversion.
1543560	1551340	You can see right there in the little highlighted comment where it multiplies together all of the points together before doing the math.
1551340	1559660	Because, once again, while you can specify the range, you don't actually care about the inputs, only that they're not the same inputs someone else has tried.
1560340	1562380	And so, Hashcat.
1562380	1565800	And that is, in fact, a hacker known as Hashcat up there.
1566940	1570360	Hashcat is an open source password cracking utility.
1570360	1578340	If you have a hash that you want to find the original or a original input for, you can use it to brute force it.
1578400	1581320	It's a pretty versatile and neat tool.
1581500	1585080	It's GPU accelerated and has a lot of optimizations.
1585080	1596580	People have done hand optimization for some of these algorithms that make them significantly faster, which is very impressive to do, you know, assembly level coding for cryptography in a GPU.
1596760	1601840	It has its own generator for generating masks and wildcard attacks.
1601840	1604480	It really has a lot of nice utilities.
1604480	1608500	You can feed in passwords via the pipe normally, like I did with my generator.
1608500	1612840	And it handles all the difficult GPU scheduling and tasking stuff for myself.
1612840	1616200	It also provides a framework for custom plugins.
1616200	1618840	But it doesn't support brain wallets.
1618840	1624600	And in order to make custom plugins, you need to be competent in OpenCL, which I wasn't and still aren't.
1625860	1627740	So I had to admit defeat.
1627940	1630160	I brute forced all the ones I could.
1630440	1634320	I have a high confidence in all of the other answers that I think I've solved.
1635200	1640500	It's infeasible to proceed assuming some of those are wrong because I have no idea which ones are wrong.
1640760	1643920	And I don't know OpenCL and I'm not going to learn.
1643920	1645600	I don't even know if it's solvable.
1645600	1650420	This could just very well be dead money that's just going to sit on the Internet forever.
1650420	1657940	And the public address where the Bitcoin was was published, so you could see it was still there and it hadn't moved.
1657980	1659920	But again, the author probably knew the answers.
1659920	1662700	Why didn't they take it back when it hit $100,000?
1663680	1666800	So I'm not going to get weird about this or anything.
1667200	1669300	I'm just going to move on with my life.
1669300	1671040	Totally healthy relationship.
1671040	1672720	This isn't my white whale or anything.
1674080	1678500	But I think I learned that the real Bitcoin was the friends I made along the way.
1678680	1683680	And it wouldn't be a presentation I give if I didn't shoehorn a Terry Pratchett quote into it.
1683680	1685300	So it was a good map.
1685300	1686300	And in studying it, Mr.
1686300	1691200	Wilkinson and his chums would learn a lot about decryption, geography, and devious cartography.
1691440	1699640	They wouldn't find in it the whereabouts of Ankh-Morpork $150,000 in mixed currency, though, because the map was a complete and complex fiction.
1699640	1707500	However, Moist entertained a wonderful warm feeling inside to think that they would, for some time, possess the greatest of all treasures, which is hope.
1707500	1713640	And anyone who couldn't simply remember where they'd stashed a great big fortune deserved to lose it, in Moist's opinion.
1714900	1718580	And I think that applies here.
1720360	1726180	And I got thinking about motivation and incentive and growth.
1726180	1733120	And I kept looking at this chart and thinking, is today the day I learn OpenCL?
1733980	1735440	And it was.
1737760	1740780	So I started digging into Hashcat pretty deeply.
1740780	1745600	Thankfully, they have some really great documentation for developing custom plug-ins.
1746400	1750120	You do still need to understand OpenCL and some of the principles there.
1750120	1761080	You can get away with not needing to understand it intimately, but I definitely had some stumbling blocks around memory management that I might not have had should I have been a little more versed in it.
1761280	1765100	So, Hashcat does not support brain wallets.
1765120	1771780	But it supports every single one of the cryptographic operations that I just talked about that we need to make a brain wallet.
1771800	1775160	And all of those are optimized for running in the GPU.
1775340	1783340	It's got SecP256K1, which is the specific ECC curve that's used to get the public key from a Bitcoin private key.
1783340	1789480	It's got SHA256, which is used to take the brain wallet phrase and get the private key.
1789480	1794900	And RIPEMD160, which is used to actually generate the Bitcoin address.
1794900	1798520	So what if we just kind of took all these modules and made them kiss?
1800360	1802460	We'll talk about Hashcat.
1802460	1804140	It's a good use case for them.
1804600	1805860	Come on.
1806600	1807600	There we go.
1808380	1810180	First, you find the hash you want to crack.
1810180	1812100	In this case, the Bitcoin wallet.
1812880	1815780	You figure out which module to use, or in this case, to make.
1816260	1817480	You pick your attack mode.
1817480	1819080	I'll talk about that in just a sec.
1819080	1823240	And your dictionary and generator, which is basically the source of things you want to try.
1823240	1827760	If you're doing a password, it's probably going to be a word list of common passwords from database breach.
1828080	1833100	If it's something more complex like this, you can specify random mask rules.
1833100	1838400	And you feed it GPUs and compulsively check it every five minutes for about half an hour.
1838400	1840920	And then forget about it for 15 days.
1840920	1844380	And then remember that you're spending money on cloud GPUs and check it.
1845460	1852180	And this is just a quick example of a Hashcat run on a rather simple hash algorithm called MD5.
1852180	1854840	It's less used for security and more file verification.
1855060	1859020	But I hashed the word password with MD5 and I got that string.
1859020	1866040	I ran Hashcat in mode 0, which is MD5's mode, with an A3.
1866040	1869520	That means it's a wild card attack, which means I'm not passing in things to try.
1869520	1872700	I'm saying, all right, it's going to be eight random letters.
1872700	1873980	Just try all of them.
1873980	1874980	And let it run.
1874980	1879200	Two seconds later, you can see at the top, it tells me you have that hash.
1879200	1881900	And the original phrase was password.
1882600	1885560	And MD5 is very simple, very basic.
1885560	1889800	Something more complex, like SHA-256, a bit more complicated.
1889800	1895480	For that same eight-character password, we're looking at a 13-day crack time on the same computer.
1896700	1900660	So, just because it can go fast doesn't mean it always will.
1902700	1904580	So, Hashcat plugins.
1904580	1905800	What is a plugin?
1906160	1913120	A Hashcat plugin is the thing that actually represents how to crack a specific kind of hash.
1913120	1918520	It is everything you need to do SHA-256 or MD5 or brain wallets.
1918520	1920000	It consists of two main parts.
1920000	1921740	It's a module and a kernel.
1921740	1928660	The module is the overall structure and the information about the hash or algorithm.
1928660	1941920	It handles the input and output processing of, you know, your input strings or what the mask generator outputs to the outputs of, you know, Hashcat's internal structure to making it look like the hash you're actually trying to crack.
1942680	1946900	The module element is written in C and it runs in the CPU.
1946940	1959560	It's compiled at the same time you build Hashcat and it is generally fairly easy to work with and it's a glorified config file with a little bit of scripting in it.
1959560	1961580	The kernel is where the heavy lifting happens.
1961580	1965800	It handles the actual cryptographic operations and the code that runs in the GPU.
1965840	1968760	It's written in a language called OpenCL.
1968760	1975000	It uses a .cl extension and it's basically C++ but worse.
1975320	1979340	And all of this represents how to crack a specific algorithm.
1979760	1983480	A module consists of a couple important bits of information.
1983480	1987940	They're located in the modules folder if you go to Hashcat source code.
1987960	1998440	They're pre-compiled and they give you information about the digest size which is, you know, when you're comparing through and seeing if it matches, how big should that structure be?
1998440	2007020	It gives you information on how to test the benchmark information and the default pattern for when you're running that benchmark.
2007120	2011820	And later on it also has the information on how to encode and decode your formats.
2011820	2013900	We'll go into that detail in just a sec.
2013900	2018620	So, the module hash decode, that's one of the important functions in your module.
2018620	2021740	That handles every single line in your hash target file.
2021740	2030220	So you feed in a list of target hashes, it processes through and decodes them from whatever, you know, a password hash that you have from a computer.
2030220	2035140	It decodes it into Hashcat's internal structure where it can more easily work with it.
2036120	2041920	It also populates the hash digests that are later compared to against in the comparison function.
2042000	2044800	The hash encode function kind of does the opposite.
2044800	2050760	It goes from the internal Hashcat format to the specific hash format that's going to be recognizable.
2050760	2052800	In this case, a Bitcoin address.
2052800	2060020	The digest size tells us how much memory we need to allocate for each hash that we're going to crack.
2060020	2070520	And the self test pass and self test hash are basically the dummy password and hash combination you put in so it knows that it's working right before it runs.
2070800	2073780	And same for the benchmark mask and character set.
2074220	2077540	This is an example of the module file that I wrote for this.
2077580	2081780	You can see I specify a few things about it.
2081780	2087560	I specify a default password of Hashcat and the Bitcoin address that the Brain Wallet gives if you do Hashcat.
2087700	2089780	The character sets to try.
2089820	2093840	You'll notice I removed all the special characters since Brain Wallets are never going to do it.
2093840	2097060	I could have removed the numbers too, but that was my mistake.
2098340	2099760	And that just kind of sets it.
2099760	2102900	The other important part is you see the current underscore type.
2102900	2107800	That's where you specify the number for the module or tell it what number it is.
2107800	2112420	So when you do dash M0, in this case it's dash M1337.
2113640	2117180	And then this brings us to the kernel where the heavy lifting happens.
2117380	2123260	The kernel is compiled at run time per graphics card because each graphics card is going to need something different.
2123260	2126820	OpenCL actually compiles it live for you there.
2127400	2132720	They are located in the slash OpenCL folder and they have a slightly different name format.
2132820	2136760	Some of them are designated as pure or optimized.
2136760	2143160	The optimized ones had someone go in and manually tweak around some of the code to take shortcuts where possible.
2143160	2145840	They're quicker, but sometimes a lot less human readable.
2145840	2150560	And sometimes they may have caveats where they're not appropriate for all cracking methods.
2151980	2156460	Sometimes they'll also have a, you see it like underscore A3 or A0.
2156840	2160180	Depending on if you're using a password list or a generator thing.
2160180	2165780	Some algorithms will have performance boosts if you do it slightly differently depending on that.
2165780	2169440	So it also lets you specify different branches to take for that.
2169680	2174540	Inside the kernel file, there are three key functions, init, loop, and comp.
2175100	2180940	Init does the initial setup, initialization, and any non-time intensive calculations.
2181320	2184980	Loop does all of the time intensive calculations until they're done.
2184980	2189620	And comp does the comparison to see, hey, is this the password we were trying to get?
2190840	2197500	The initialization function, and it's usually named something like this, it sets up all of the buffers.
2197520	2206080	It does any one time calculations or initializations, setting up your point curves, and it's run once per candidate that you put in.
2206540	2209860	And it's generally used to set up stuff for the loop.
2209860	2221460	In some cases, like ours, we didn't have a time intensive portion that is looped, so all of the actual calculation and hashing is done in the init, and the loop just passes it on to the comparison function.
2222660	2231180	The loop function, if you're doing something that has a lot of internal steps, like do 500 rounds of MD5, that's going to happen in the loop function.
2231180	2237260	This lets HashCat better organize it and not think that a process is hanging or non-responsive.
2237260	2245280	It lets it also better organize it into batches and be able to suspend one and insert another for execution.
2246240	2250220	We didn't use it in this one because it didn't need it.
2250220	2260900	The brain, while algorithm, does not have any repeated or iterated steps, but if something you're trying to do does have iterated steps, the code for that would live in the loop function.
2261100	2263540	And lastly, we've got the comparison function.
2263820	2281540	This takes the result of your init or your loop, which shoves the... and you can specify which possession, but usually the last or first four bytes of your result into a comparison register, and then it compares it with the last four or first four of your target hash.
2281540	2286240	And then if it's right, it does a full comparison to prevent it, but that just saves a little bit of time.
2286540	2288680	And this is the function that actually does it.
2288680	2297140	If you have a large list of hashes, it does a little bit of optimization there, but in this case, it was only just one, so there was nothing special there.
2298280	2300380	It's time to gather all the ingredients we need.
2300500	2305340	I took the SHA-256 from the included module there.
2307160	2314200	I borrowed a lot of the initialization and the update and final functions, which are what you need to run the algorithm.
2314200	2316640	I did the same for RIP-EMD-160.
2317000	2323140	And I also yoinked the SEC-P256 from their code, where they do that.
2323140	2331660	They mostly use it in a module for Bitcoin wallet import format private key, in module 28502.
2331660	2339320	It's not exactly what I need, but part of that step does involve doing the curve cryptography to go from a private key to a public key.
2339320	2341000	So I'm just going to borrow that.
2341900	2346160	I did a little bit of massaging to make the module.
2346160	2351260	I took the module for SHA-256 because that's the first step in that.
2351260	2353360	I might as well use that as the entrance.
2353680	2362920	So I heavily modified module 1400, which is the hashcap module for SHA-256 with no salts.
2362920	2375540	And the only major thing I really had to change here was the digest size because SHA-256 is expecting a smaller output than the public key is.
2375540	2382940	So one big problem I had was I was trying to shove too much data into too small of a bit of memory and I kept getting seg faults.
2382940	2385780	And debugging OpenCL is fun.
2386080	2389700	So I basically smushed all of those together.
2389700	2391400	I took the input parameters.
2391400	2394400	I took the decode function from the target.
2394640	2396560	That's going to be 28.5.
2396560	2403020	And I took the encode function from 28.502 as well.
2403660	2405620	I was doing testing and debugging.
2405620	2410080	Brought me back to CS101 because I made best friends with the printf statement again.
2411880	2427540	Yeah, it's really difficult to do traditional debugging in graphics cards because you have a whole lot of threads all running simultaneously in lockstep and you can't interrupt or introspect a single one without affecting another one.
2427780	2429540	So there are a couple workarounds.
2429540	2437760	One, Hashcat does have a specific set of flags you can put in to force it very unhappily to only attempt to use a single thread.
2437760	2445700	I still kept getting some multi-threaded output with it but it really reduced it from an unreadable console to only a handful of repeated outputs.
2445700	2453440	And you're basically using good old printf and you're printing out debug statements and trying to trace stuff out that way.
2453460	2457600	If you're trying to do this at home and stuff's not working, check your digest size.
2457600	2462680	There's a great write-up on that in the documentation on how to choose that.
2462900	2469900	And if things are working and not segfaulting but your results aren't wrong, make sure your endianness is right.
2470160	2475780	Some modules like doing things in big endian, some like doing them in little endian.
2475900	2481020	There's definitely some parts of my code that are just shifting bits around to the other side.
2481020	2483300	And that actually made it work.
2483660	2485380	So, this works.
2485380	2489120	And I got it working on GPUs.
2489320	2491700	But it was a bit slow.
2491700	2497140	I was getting about 7600 kilohashes a second.
2497140	2505180	Which is, as you'll recall, less than an order of magnitude bigger than what I was getting on my CPU.
2505180	2510500	I was getting maybe 1400 kilohashes a second on my CPU.
2510500	2514720	So this is faster, but certainly not radically faster.
2518720	2527940	Why is that when the individual one used got 142 gigahashes a second for 28.502?
2527940	2531360	And the answer is, not batch inversion.
2531820	2539800	It actually uses a much easier trick, which is, it assumes Hashcat is passing in completely random strings.
2539800	2544440	Not all of those are going to be valid as wallet import format strings.
2544440	2550520	So it's doing a lot of basic filtering looking for the first byte being valid or not and then dropping them.
2550520	2555760	So the vast, vast majority of the candidates that you see in this benchmark were just dropped and ignored.
2557680	2563900	So I eventually removed that code and ran it again and I got similar hash rates, so I moved on.
2564280	2567320	This led me to create my generator generator.
2567460	2572140	I mentioned that combinatorics and how Hashcat can accept masks.
2572140	2573980	It can accept a list of masks.
2573980	2584520	So I made a quick little Python script to generate a different mask list for all 105 possibilities of different combinations of unknown unknowns.
2584520	2590240	And I fed it into Hashcat and I have everything I need.
2590460	2592240	Except compute power.
2592240	2593980	So I went to the cloud.
2594000	2595660	There's a website called Vast AI.
2595660	2599420	You can rent GPUs on the cloud by the minute.
2599420	2600820	It's relatively cheap.
2600820	2605120	I can rent a 3080 for 16 cents an hour.
2605680	2618280	So I just spun up a whole bunch of cards in the cloud and overall in this I maybe spent 50 bucks in cloud compute and it's way cheaper than a cracking rig and it also didn't heat up my house.
2618620	2622140	So a couple hours later, success.
2622500	2624180	It's actually funny.
2624400	2632320	It only took three minutes to crack from when I started it in the cloud and then I checked much later and absolutely freaked out.
2632320	2638120	But it cracked the brain wall and I had the private key.
2638120	2652800	So very, very carefully I disconnected from the internet and I put it into my Bitcoin wallet and I swept the wallet and on December 13th, 2024, I claimed the one Bitcoin prize.
2653980	2655060	Thank you.
2657580	2659020	Thank you, thank you.
2659520	2661740	Now some of you might be wondering, what about the money?
2661740	2662960	It's mostly been spent.
2662960	2663940	Not saying on what.
2663940	2664840	Life's expensive.
2664840	2666180	I paid my taxes.
2666920	2668700	The joker doesn't mess with the IRS.
2668700	2676540	I will say, getting an accountant to call me back and not think I wasn't some sort of delusional or actively in a pig butchering scam was very, very difficult.
2676980	2680360	I finally got one to call me back and tell me how to put this on my taxes.
2680960	2683020	The rest isn't on my purse in my home.
2683020	2684940	Don't try to hack me.
2685680	2687260	It's not in a brain wallet either.
2687260	2691380	I only did one outrageous thing and I took a zero gravity flight with it.
2692940	2697520	It was an absolutely amazing experience.
2698260	2699800	I have no regrets.
2699800	2704720	That was the one thing I splurged on that I couldn't otherwise justify.
2704720	2712680	But that was just because I'd been dreaming of doing that forever and that was what I was going to spend this prize money on in the first place years and years ago.
2713440	2715020	I will say one thing.
2715060	2717380	The reason it took me so long is clue 20.
2717380	2718840	It had an ambiguous answer.
2719880	2722380	This was the unknown unknown that blocked me.
2722520	2726060	What is this last clue and what letter is missing to spell it all out?
2726060	2728520	It's clue 20 and there's no why.
2728520	2729520	Right?
2729900	2733000	But it's also a haiku and there's no K.
2733000	2735960	K was the correct answer and I'd assumed Y.
2736040	2745320	And this had plagued me for about 10 years and ironically had caused a significant increase in the prize money because it took me so long to get to this point.
2745320	2747740	So I can't be too, too mad.
2747740	2749560	But come on.
2750560	2752520	There are two unsolved clues.
2752760	2754200	I have the answers.
2754200	2755660	I don't know the solution.
2755660	2759500	I'm offering a small trophy to anyone who can tell me the answer.
2759600	2762240	I have shopping cart wheels that are locked.
2762240	2763320	You can remote control.
2763320	2767680	I will send a custom one to anyone who can tell me the answer.
2768800	2769620	Please.
2769620	2772700	This is bothering my soul so much.
2773360	2775200	I've got my email here.
2775320	2780600	Puzzleanswers at bgaydocrime.com Just, please help me.
2780600	2783860	I'll post on my website if I get the answers.
2783860	2791060	If you want to try this at home I have the custom module on my GitHub repo as well as some very basic instructions.
2791120	2791760	Cavidempter.
2791760	2793100	You get what you pay for.
2793320	2797360	There is a version that does compressed Bitcoin wallet formats.
2797360	2799000	That's 1338.
2799260	2803160	It's basically the same thing, just slightly tweaks how the address comes out.
2804280	2807380	I'd like to give a huge thanks to a bunch of people.
2807380	2810920	The team at Hashcat for making the software.
2810920	2816600	Ryan for doing the awesome things they're doing and Brainflare and kind of keeping me on this path.
2816600	2819720	Spencer Lucas for this whole, whole challenge.
2819720	2822140	My parents, my mom, and dad.
2822140	2825440	My friends and everyone who supported me along the way for this.
2825440	2826680	My partner Daisy.
2826680	2832540	My accountant Jill who actually returned my call for this absolutely insane voicemail.
2833480	2838100	Chuck Kopenspire for helping me get this PowerPoint looking nice.
2838100	2842640	He's a creative and technical consultant for queer and neurodivergent professionals.
2842820	2843780	He's great.
2843780	2846840	If any of you need PowerPoint design, check out his website.
2846840	2856460	My friend Ashley, of course, for keeping this fixation alive and being the one person I can talk to about this puzzle to an unlimited degree without getting tired.
2856460	2860200	And the folks at Zero Gravity for giving me a really, really great time.
2861180	2864780	This is a donation link to Ryan's GoFundMe .
2864820	2870900	They are actively in a legal battle against the government of the UK for recognition of non-binary rights.
2871300	2874440	I'm also a non -binary hacker, so this is important to me.
2875400	2881360	I plan on, after this talk, donating a bit of the prize to their GoFundMe.
2881360	2885120	And if anyone out there thinks this is a worthy cause, I would encourage it.
2885120	2886920	It's a totally safe QR code.
2886920	2889820	If not, you can just search for the GoFundMe on Google.
2890280	2891760	I wouldn't trust me.
2892960	2893920	That's all, folks.
2893920	2895360	Thank you so much for coming.
2895520	2897260	I'll be answering questions.
2897260	2900200	I know the answers to and making up answers to the ones I don't.
2900380	2901380	Thank you all.
