This is our first talk today. Talk is basically the one Bitcoin heist with Joseph Gabay. And here he is. And give him a big round of applause. This is the first talk of DAKON. All right. All right. There you go, buddy. Thank you very much. Hello everyone. Good morning. Thank you all for coming. My name is Joseph Gabay and I stole a Bitcoin from the Internet. And I'm going to tell you how I did it and how you can do it too, but not really. So before I get into this talk, I want to give a basic disclaimer. This is a personal project. It's not affiliated with my employer, with my friends, with anyone. Just don't call my employer asking about this. I've had that happen before. It's an awkward conversation. I'll have my email address at the end if you've got questions. Reach out to me. I'm happy to talk. So what this talk is about. In short, about ten years ago, some anonymous person on the Internet issued a puzzle challenge to the Internet. There is a one Bitcoin prize. There are 20 clues. If you solve all 20 clues, you get the phrase that unlocks the brain wall that contains the Bitcoin. Now this went on claim for a very long time, over 11 years. 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. 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. 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. So, a little bit about me and how I got here. I used to be a robotics engineer. And then I did something very funny with shopping cart wheels. You can check it out at the Physical Security Village later. I've got a little demo booth, but you can control them with your phone by freaking them. I spoke about that at DEF CON 29 and 31, if you're curious at all. And I'm a skydiver, an internet treasure hunter, retired now. I figure I should quit while I'm ahead. And I'm here on stage now. So, the one bitcoin book. This was a puzzle challenge posted to Twitter and Reddit in April 2014. The deal was the first ten people to sign up for it on the website got a free copy of the book. Everyone else had to pay 0.01 bitcoins, which at the time was only four or five dollars. But now is much, much more. The copyright at the bottom of it was to a Spencer Lucas. I've done some basic OSINT on this. I haven't been able to find any social media presence, any name. The website was WhoIsProtected. So, I really have no idea. I've tried reaching out to all of the social media accounts and haven't gotten any responses. Spencer Lucas, if you're out there watching this talk, reach out, please. But there were 20 clues. I'll give some examples of them in just a second. But each clue gave you a single letter, uppercase or lowercase. There were no special characters, no numbers. So, that is a 52 character set for each possible clue. 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. Put that into the Brain Wallet utility. And if you got it right, you get the private key for the address containing one Bitcoin. Reactions to this were a little mixed. A lot of people on Reddit thought this guy was full of crap. Rightfully so. People thought it was suspicious. And , you know, he was, to his defense, engaging with people on Reddit and trying to defend it. He, at one point, had joked if this went well, he might release a 10 Bitcoin book. I'm still waiting for that. I hope he chooses a different technology to base it off of for reasons that will become evident. But, yeah. 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. They thought someone was trying to steal four or five bucks at a time from folks. Which, fair. But, so it goes. Let's go through a couple of the clues. I had some help solving these. One of them is from my friend Ashley who helped me with quite a few of these. She's in the audience here right now. 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. So, this is clue 12, one of the examples that Spencer posted on Twitter publicly. It consists of four shapes with letters in them. 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. So, again, I have no idea how Ashley figured this one out. But you have to take the position index of each shape. So, one, two, three, or four. Count the number of letters in the word for the number of that index. So, one has three letters. That number gives you the number of sides in the polygon. So, one is three, gives you a triangle. Three is five, gives you a pentagon, etc. And then you take the nth letter from the word of the shape and put that in the letter, and that's the pattern. 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. So, that's R. These were fairly complicated, and some of them were a bit involved. Some of them were less so. Oh, no, there's one even more impressive one after this. This is one that I solved. This was a lot easier. They were not all as esoteric. This was a 4x4 grid with some numbers in it and a missing space. If you look at the diagonal, you see KMPH spelled out backwards, and then some numbers. Physicists amongst you, or weirdos, might recognize that the speed of light in kilometers per hour is, in fact, that number. And we know that the speed of light is represented with a lowercase c. So, that's clue four. And here's another one that I actually solved, and I would have never gotten this in a million years. It's a sequence of 12 numbers arranged in five rows, and the last number is unknown. 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. 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. I, again, actually have no idea how you got this, but it's a good one. And you add everything up, you get 325, which corresponds to uppercase B. So, those are some examples of the kinds of clues. You know, a lot of them were pattern-based, some of them were basic. One of them, which I absolutely drove myself nuts on, had three-by-three grids with letters in them. I was trying to solve Sudoku or word searches. No, they were all just airport codes for airports in countries that started with S, and the answer was uppercase S. And I overworked that one really hard. I had a Python program doing Sudoku solving with all the airport codes for countries. It was... it was... But, anyways. So, all of this goes into a brain wallet. What is a brain wallet? 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. I'm going to talk about their cool work in a sec. But brain wallets are basically a method to store Bitcoin in your brain. You create a secret passphrase. This can be anything from, you know, password 123, which you'll be stolen from immediately, to the entire B-movie script. Which, again, you'll be stolen from immediately because people have all of the things people would think of just cycling through. 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. Don't use brain wallets for anything important. We'll talk about the internals and how they work a little later on. But the original website, Brain Wallet, was taken down after another hacker had pointed out some fairly significant security weaknesses in how it worked. And that resulted in people getting their money stolen. 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. 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. That's going to be hashes and elliptic curve cryptography. So, hashes are a special little function that basically act as one-way trap doors. You can take an input of any size. 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. But you can take anything in, and it outputs it to an output of a fixed size. So, any input, a size of 128 bytes, for example. And the important part about hashes is they are repeatable. So, if you hash the same thing twice, you will always get the same result. You can change just a single character in a long text, and it's going to completely change what the hash is. And this means there's no way to go backwards. I can't give you a hash, and you tell me what the original thing was. At least easily. You have to basically brute force it, which is what this talk is about. 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. But they're very important for storing passwords safely. So, if you have a database breach, people don't know all the passwords. You can use them to verify data integrity, because if one little thing changes, the whole hash changes. And, in some cryptographic contexts, they just waste time. 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. And it knows what the answer should be, so you have to do the work. The second important concept is elliptic curve cryptography. 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. You have a private key and a public key. The private key is used to sign messages, encrypt them, and the public key is used to verify or decrypt them. There's a lot of nuance here, but that's the important part for what we're doing here. 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. 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. They're used all over for creating secure connections. Cryptocurrencies use them heavily, as we're about to learn, and they're critical for authentication and identity verification. It's a lot of deep math. They're very cool, but well, well beyond the scope of what I can competently explain. So we have these. How do these make a brain wallet? How do you take a phrase in your head and get Bitcoin out of it? So we take a secret passphrase and we somehow transform it into a Bitcoin address. There's some mystery steps in between. We take the secret passphrase. We'll use hello DEF CON 33 for our example here. And first we run it through a hash algorithm called SHA-256. So this is going to take hello DEF CON and turn it into that string starting with BDA that you see there. Now this is going to be what we use as our private key. The brain wallet application calls this the secret exponent. That's not wrong, but that's not the nomenclature usually used with cryptocurrencies. 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. 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. So that's the beauty of hash algorithms there. 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. And I'm going to tell everyone now there's no Bitcoin on this address, if anyone's already got the site up. So you take this and you do another hash algorithm. 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. 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. 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. In this case it's 15ZC whatever. 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. So, how do we solve the puzzle the intended way? 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, and extract the money. And somehow profit, and pay a bunch of taxes. Well, as you can guess, I didn't do it that way. 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, despite knowing the answer. 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. 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? Let's find out, let's do some math. So, I tricked you all, it's math lesson time. Let's talk about combinatorics. So, combinatorics, very basically, it's a branch of math dealing with counting things. How many ways can you arrange a set of objects? If the order does matter, if the order doesn't matter. And it's a very fun field of math because it can give us some ridiculously large numbers. So, for instance, we have 20 positions, each one having 52 possibilities to solve. That's 52 to the 20th power. And I have just lost my presentation, there we go. So, it's 52 to the 20th power, and that's a really, really big number. Every clue we have a confident answer to divides this number by 52. And you can see I have a little chart to the side there that kind of shows how quickly that grows. 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. There's way too many to test manually with any sort of brute force, so we need to make a computer do this. 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. They're currently suing the UK government for non-binary recognition. I'll have a little plug for them later. But they spoke at DEF CON 23, where they introduced Brain Flare, which was a utility for cracking brain wallets in CPU time. And they are the main reason you should not use brain wallets, or at least up until now, they were the main reason. Now there's two good reasons. You can do whatever you want with your money, I'm not your mom or accountant, but, like, it's not a good idea. It's going to get stolen. 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. So, I do a little bit of testing. My home PC maxes out at 1.4 mega hashes a second. That's 1.4 million hashes per second it can do, possibility-wise. And I've got my computer specs there in case anyone's curious. So now we get to do math with big numbers, which is fun. 1.4 mega hashes is 1.4 times 10 to the 6th. 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. That is 10 orders of magnitude larger than the age of the universe. I am not going to crack the entire puzzle from scratch on my home computer. Thankfully, we already solved a bunch, and that cuts it down significantly. 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. Which... let's do it! And this is just another example of how long it would take to solve each number of unknowns. So, let's crack the puzzle. I wrote a lightweight generator script in C. It pipes its output directly into Brainflare. It is basically just a whole bunch of arrays with characters. 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. So, let's rip through, you know, just a cool 20 billion hashes. No big deal. That was... let me get my alignment better. There we go. So, four hours later, it was easy. Nah, I didn't get anything. Didn't work. I expanded this to a run with seven unknown clues. That took over eight days to run. It was just very weird having my computer on for eight days straight, not using it because it was fully maxed out. And, didn't get it. At this point, it was very discouraging. One of the big problems with this challenge is, there's no feedback in the process. You're putting in... it's like CTS where you're just putting in a flag and being told yes or no. You don't know which clues are right. You don't know which clues are wrong. You don't even know if the puzzle's solvable. 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. So, one would assume that he would have solved it himself. So, the suspicion of, is this even possible? Did the creator make a typo and the money is just lost forever? That started to cross my mind. So, I need to try a different approach. And that involves rolling unknowns. We're doing more combinatorics, I know. Basically, we have a number that we know, and we know at least one of those is wrong. 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. And that's going to increase our solution space significantly. And this lovely equation can tell us by exactly how much. And this table can save you from doing the math. 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. And as we change the number of those, we see that it increases the crack time by a different factor. 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. 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. One of the ones that I was confident in had to be wrong. Nope. So, we got to go fast. GPUs are the best for doing any sort of cryptographic operation. Because they can do stuff in parallel. 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. 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. The catch is, they can only do the same operation at a time. So you have multiple hash candidates all loaded in and they're going through each step one at a time in lockstep. 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? It's a massive, massive time increase and it's the reason cryptocurrency miners have bought up all the graphics cards. Because it's the same crypto math. The other problem for me is, coding for GPUs is hard. Really hard. It is kind of an obscure area that's very specialized. There is not a lot of good tutorials for it. Or not a lot of resources. You know, in the days even before ChatGPT, there was basically nothing. And I did, just out of curiosity, throw up ChatGPT and say, make me a hashcat module to do this. And it can't do OpenCL either. But has someone done it for me? I'm lazy. We'll see. So I was looking at a couple GPU-based projects that do similar things around trying to find a specific Bitcoin address. And there are three major candidates here. VanityGen and its subprogram OCLVanityGen. OCL being OpenCL, which is the GPU programming language. It's used to generate vanity addresses. Let's say you want a Bitcoin address that starts with your name. You can have your GPU generate Bitcoin addresses just at random until it eventually hits one. And you'll go through billions and you'll hit one. But if you can do billions a second, it's pretty all right. This uses GPU. And that's promising. Because you can say, I want to find this pattern of address and it does some sort of cryptography. And it does it very fast. It's in the giga hashes range on my GPU. There's also Bitcrack, which is made to solve a different Bitcoin puzzle. It's not really a puzzle as much as a brute force experimentation. Basically, someone said, I put Bitcoin at this address with a private key that starts with this many zeros. And higher and higher prizes for progressively fewer and fewer known zeros. 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. And that's a whole separate thing. But it's neat. But it's someone doing something similar and maybe I can use that. And then there's Hashcat, which, spoiler, is what I ended up using. But that's a general use CPU password and hash cracking utility. It's not specifically for cryptocurrency. It has a couple of cryptocurrency modules, which we'll use. But it doesn't support brain wallets. So we'll take a look at Vanity Gen real quick. It's very, very fast. You can see I lied a bit. It's actually several hundred mega hashes a second. But that's still pretty good just running on a random cloud instance GPU. I think that was a 3060, no, 3080 I see right there. This turned out to be a bit of a lie when it comes to what I need to do. They do a neat little trick called batch inversion. It's clever, but it unfortunately makes it impossible to do what I need to do. 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. 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. I'm trying to do arbitrary private keys, so that's not exactly going to work. So, what about Bitcrack? This one looks for a pattern matching a specific private key. It also shows a very promising hash rate. It lets you specify a range of key spaces to search. 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. Problem is, it's also using batch inversion. You can see right there in the little highlighted comment where it multiplies together all of the points together before doing the math. 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. And so, Hashcat. And that is, in fact, a hacker known as Hashcat up there. Hashcat is an open source password cracking utility. 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. It's a pretty versatile and neat tool. It's GPU accelerated and has a lot of optimizations. 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. It has its own generator for generating masks and wildcard attacks. It really has a lot of nice utilities. You can feed in passwords via the pipe normally, like I did with my generator. And it handles all the difficult GPU scheduling and tasking stuff for myself. It also provides a framework for custom plugins. But it doesn't support brain wallets. And in order to make custom plugins, you need to be competent in OpenCL, which I wasn't and still aren't. So I had to admit defeat. I brute forced all the ones I could. I have a high confidence in all of the other answers that I think I've solved. It's infeasible to proceed assuming some of those are wrong because I have no idea which ones are wrong. And I don't know OpenCL and I'm not going to learn. I don't even know if it's solvable. This could just very well be dead money that's just going to sit on the Internet forever. And the public address where the Bitcoin was was published, so you could see it was still there and it hadn't moved. But again, the author probably knew the answers. Why didn't they take it back when it hit $100,000? So I'm not going to get weird about this or anything. I'm just going to move on with my life. Totally healthy relationship. This isn't my white whale or anything. But I think I learned that the real Bitcoin was the friends I made along the way. And it wouldn't be a presentation I give if I didn't shoehorn a Terry Pratchett quote into it. So it was a good map. And in studying it, Mr. Wilkinson and his chums would learn a lot about decryption, geography, and devious cartography. 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. 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. And anyone who couldn't simply remember where they'd stashed a great big fortune deserved to lose it, in Moist's opinion. And I think that applies here. And I got thinking about motivation and incentive and growth. And I kept looking at this chart and thinking, is today the day I learn OpenCL? And it was. So I started digging into Hashcat pretty deeply. Thankfully, they have some really great documentation for developing custom plug-ins. You do still need to understand OpenCL and some of the principles there. 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. So, Hashcat does not support brain wallets. But it supports every single one of the cryptographic operations that I just talked about that we need to make a brain wallet. And all of those are optimized for running in the GPU. It's got SecP256K1, which is the specific ECC curve that's used to get the public key from a Bitcoin private key. It's got SHA256, which is used to take the brain wallet phrase and get the private key. And RIPEMD160, which is used to actually generate the Bitcoin address. So what if we just kind of took all these modules and made them kiss? We'll talk about Hashcat. It's a good use case for them. Come on. There we go. First, you find the hash you want to crack. In this case, the Bitcoin wallet. You figure out which module to use, or in this case, to make. You pick your attack mode. I'll talk about that in just a sec. And your dictionary and generator, which is basically the source of things you want to try. If you're doing a password, it's probably going to be a word list of common passwords from database breach. If it's something more complex like this, you can specify random mask rules. And you feed it GPUs and compulsively check it every five minutes for about half an hour. And then forget about it for 15 days. And then remember that you're spending money on cloud GPUs and check it. And this is just a quick example of a Hashcat run on a rather simple hash algorithm called MD5. It's less used for security and more file verification. But I hashed the word password with MD5 and I got that string. I ran Hashcat in mode 0, which is MD5's mode, with an A3. That means it's a wild card attack, which means I'm not passing in things to try. I'm saying, all right, it's going to be eight random letters. Just try all of them. And let it run. Two seconds later, you can see at the top, it tells me you have that hash. And the original phrase was password. And MD5 is very simple, very basic. Something more complex, like SHA-256, a bit more complicated. For that same eight-character password, we're looking at a 13-day crack time on the same computer. So, just because it can go fast doesn't mean it always will. So, Hashcat plugins. What is a plugin? A Hashcat plugin is the thing that actually represents how to crack a specific kind of hash. It is everything you need to do SHA-256 or MD5 or brain wallets. It consists of two main parts. It's a module and a kernel. The module is the overall structure and the information about the hash or algorithm. 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. The module element is written in C and it runs in the CPU. 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. The kernel is where the heavy lifting happens. It handles the actual cryptographic operations and the code that runs in the GPU. It's written in a language called OpenCL. It uses a .cl extension and it's basically C++ but worse. And all of this represents how to crack a specific algorithm. A module consists of a couple important bits of information. They're located in the modules folder if you go to Hashcat source code. 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? It gives you information on how to test the benchmark information and the default pattern for when you're running that benchmark. And later on it also has the information on how to encode and decode your formats. We'll go into that detail in just a sec. So, the module hash decode, that's one of the important functions in your module. That handles every single line in your hash target file. 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. It decodes it into Hashcat's internal structure where it can more easily work with it. It also populates the hash digests that are later compared to against in the comparison function. The hash encode function kind of does the opposite. It goes from the internal Hashcat format to the specific hash format that's going to be recognizable. In this case, a Bitcoin address. The digest size tells us how much memory we need to allocate for each hash that we're going to crack. 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. And same for the benchmark mask and character set. This is an example of the module file that I wrote for this. You can see I specify a few things about it. I specify a default password of Hashcat and the Bitcoin address that the Brain Wallet gives if you do Hashcat. The character sets to try. You'll notice I removed all the special characters since Brain Wallets are never going to do it. I could have removed the numbers too, but that was my mistake. And that just kind of sets it. The other important part is you see the current underscore type. That's where you specify the number for the module or tell it what number it is. So when you do dash M0, in this case it's dash M1337. And then this brings us to the kernel where the heavy lifting happens. The kernel is compiled at run time per graphics card because each graphics card is going to need something different. OpenCL actually compiles it live for you there. They are located in the slash OpenCL folder and they have a slightly different name format. Some of them are designated as pure or optimized. The optimized ones had someone go in and manually tweak around some of the code to take shortcuts where possible. They're quicker, but sometimes a lot less human readable. And sometimes they may have caveats where they're not appropriate for all cracking methods. Sometimes they'll also have a, you see it like underscore A3 or A0. Depending on if you're using a password list or a generator thing. Some algorithms will have performance boosts if you do it slightly differently depending on that. So it also lets you specify different branches to take for that. Inside the kernel file, there are three key functions, init, loop, and comp. Init does the initial setup, initialization, and any non-time intensive calculations. Loop does all of the time intensive calculations until they're done. And comp does the comparison to see, hey, is this the password we were trying to get? The initialization function, and it's usually named something like this, it sets up all of the buffers. It does any one time calculations or initializations, setting up your point curves, and it's run once per candidate that you put in. And it's generally used to set up stuff for the loop. 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. 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. This lets HashCat better organize it and not think that a process is hanging or non-responsive. It lets it also better organize it into batches and be able to suspend one and insert another for execution. We didn't use it in this one because it didn't need it. 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. And lastly, we've got the comparison function. 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. And then if it's right, it does a full comparison to prevent it, but that just saves a little bit of time. And this is the function that actually does it. 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. It's time to gather all the ingredients we need. I took the SHA-256 from the included module there. I borrowed a lot of the initialization and the update and final functions, which are what you need to run the algorithm. I did the same for RIP-EMD-160. And I also yoinked the SEC-P256 from their code, where they do that. They mostly use it in a module for Bitcoin wallet import format private key, in module 28502. 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. So I'm just going to borrow that. I did a little bit of massaging to make the module. I took the module for SHA-256 because that's the first step in that. I might as well use that as the entrance. So I heavily modified module 1400, which is the hashcap module for SHA-256 with no salts. 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. 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. And debugging OpenCL is fun. So I basically smushed all of those together. I took the input parameters. I took the decode function from the target. That's going to be 28.5. And I took the encode function from 28.502 as well. I was doing testing and debugging. Brought me back to CS101 because I made best friends with the printf statement again. 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. So there are a couple workarounds. 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. 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. And you're basically using good old printf and you're printing out debug statements and trying to trace stuff out that way. If you're trying to do this at home and stuff's not working, check your digest size. There's a great write-up on that in the documentation on how to choose that. And if things are working and not segfaulting but your results aren't wrong, make sure your endianness is right. Some modules like doing things in big endian, some like doing them in little endian. There's definitely some parts of my code that are just shifting bits around to the other side. And that actually made it work. So, this works. And I got it working on GPUs. But it was a bit slow. I was getting about 7600 kilohashes a second. Which is, as you'll recall, less than an order of magnitude bigger than what I was getting on my CPU. I was getting maybe 1400 kilohashes a second on my CPU. So this is faster, but certainly not radically faster. Why is that when the individual one used got 142 gigahashes a second for 28.502? And the answer is, not batch inversion. It actually uses a much easier trick, which is, it assumes Hashcat is passing in completely random strings. Not all of those are going to be valid as wallet import format strings. So it's doing a lot of basic filtering looking for the first byte being valid or not and then dropping them. So the vast, vast majority of the candidates that you see in this benchmark were just dropped and ignored. So I eventually removed that code and ran it again and I got similar hash rates, so I moved on. This led me to create my generator generator. I mentioned that combinatorics and how Hashcat can accept masks. It can accept a list of masks. So I made a quick little Python script to generate a different mask list for all 105 possibilities of different combinations of unknown unknowns. And I fed it into Hashcat and I have everything I need. Except compute power. So I went to the cloud. There's a website called Vast AI. You can rent GPUs on the cloud by the minute. It's relatively cheap. I can rent a 3080 for 16 cents an hour. 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. So a couple hours later, success. It's actually funny. 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. But it cracked the brain wall and I had the private key. 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. Thank you. Thank you, thank you. Now some of you might be wondering, what about the money? It's mostly been spent. Not saying on what. Life's expensive. I paid my taxes. The joker doesn't mess with the IRS. 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. I finally got one to call me back and tell me how to put this on my taxes. The rest isn't on my purse in my home. Don't try to hack me. It's not in a brain wallet either. I only did one outrageous thing and I took a zero gravity flight with it. It was an absolutely amazing experience. I have no regrets. That was the one thing I splurged on that I couldn't otherwise justify. 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. I will say one thing. The reason it took me so long is clue 20. It had an ambiguous answer. This was the unknown unknown that blocked me. What is this last clue and what letter is missing to spell it all out? It's clue 20 and there's no why. Right? But it's also a haiku and there's no K. K was the correct answer and I'd assumed Y. 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. So I can't be too, too mad. But come on. There are two unsolved clues. I have the answers. I don't know the solution. I'm offering a small trophy to anyone who can tell me the answer. I have shopping cart wheels that are locked. You can remote control. I will send a custom one to anyone who can tell me the answer. Please. This is bothering my soul so much. I've got my email here. Puzzleanswers at bgaydocrime.com Just, please help me. I'll post on my website if I get the answers. If you want to try this at home I have the custom module on my GitHub repo as well as some very basic instructions. Cavidempter. You get what you pay for. There is a version that does compressed Bitcoin wallet formats. That's 1338. It's basically the same thing, just slightly tweaks how the address comes out. I'd like to give a huge thanks to a bunch of people. The team at Hashcat for making the software. Ryan for doing the awesome things they're doing and Brainflare and kind of keeping me on this path. Spencer Lucas for this whole, whole challenge. My parents, my mom, and dad. My friends and everyone who supported me along the way for this. My partner Daisy. My accountant Jill who actually returned my call for this absolutely insane voicemail. Chuck Kopenspire for helping me get this PowerPoint looking nice. He's a creative and technical consultant for queer and neurodivergent professionals. He's great. If any of you need PowerPoint design, check out his website. 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. And the folks at Zero Gravity for giving me a really, really great time. This is a donation link to Ryan's GoFundMe . They are actively in a legal battle against the government of the UK for recognition of non-binary rights. I'm also a non -binary hacker, so this is important to me. I plan on, after this talk, donating a bit of the prize to their GoFundMe. And if anyone out there thinks this is a worthy cause, I would encourage it. It's a totally safe QR code. If not, you can just search for the GoFundMe on Google. I wouldn't trust me. That's all, folks. Thank you so much for coming. I'll be answering questions. I know the answers to and making up answers to the ones I don't. Thank you all.