 Oh, I'm not wearing glasses. What kind of an agent is this? It doesn't wear glasses, but right now I don't have. What happened? When will we be able to use Zoom filters? So let me first use the filter. Let me first wear the glasses and then we will talk what are we here for. Okay, I mean this looks good. Yeah, I mean somewhat swaggy, somewhat good, somewhat like an agent, of course we are here to do it. And yes, this is agent with an agent. Now, you must be wondering what an agent wearing with glasses is doing. Cubicon, the cloud native America, Laos, Angeles, North America. Welcome to the conference, but before that you must be wondering why an agent, why an agent is required. You will have to see this. Why? In this 30 minute, I hope that it covers and it is covered in 30 minutes. Why we are required here, why you are required here and why this is going to be a super fun session. This is not going to be like a tutorial. I'm not saying that it's a tutorial. I'm not saying that you will learn go what we are going to learn today in just these 30 minutes, but it's going to be an awesome introduction and you require not a code at this time, you require an agent. So before anything, let's share the screen and please become a little formal till now it has been quite, quite, quite informal. So before I share the screen, let me just see if the screen looks good. Yeah, the screen looks good. Now I will share the screen. The agent always checks everything whether it's fine or not. So yeah, the screen is shared. Now I'm going to present the agent. Oh my God, such a nice plan. Now, what are we here for? Okay, the shivering your way to the world of Golan. I mean, what a name of a talk set, a difficult name first of all, but okay, you're welcome. You're welcome today in the shivering or the shivering, I guess I'm weak at pronunciations, but I think it's written so somewhat it is just a fitting away to the world of Golan. And today, we are here at CubeCon CloudNativeCon North America 2021, happening in a blended mode. And thankfully, we are moving towards the normal routine and hopefully in the next year, we will all be having in-person conference still only. And thank you so much to everybody who has joined us today. And I know that this talk is going to be a little informal, a little story, like a little tale, like because I mean, virtually engaging the audience is difficult, but we can just even do the honors. Let's begin. What are we here for? But what are we here for? Let's see who I am. So, hello. I mean, with my glasses, you already know that I am a different there. I'm also a final year computer science engineering student in India. And also, I have been interning at HyperPan for now about more than three months. And let's not talk about that. Let's talk about the reason why we are here because, you know, I mean, all this is fun, but what? What are we going to do? What is an agent going to do in this? You know, all, I mean, they are also big boarders all out there, all open source committee members and an agent, a spy has come here. There must be something, some very important reason for that. So, a memo, lost vision, a mystery of the second bedroom. Now, I think these few terms that you're seeing, you must be wondering that, yeah, you require an agent, a spy agent, or what kind of agent we don't know. But here we are, and we need to go now before somebody else catches the treasure. But what is the memo about? What is the lost treasure about? Let's see that, the memo. Oh my God. This looks some really, really, really old memo and as they said, a second world war type memo. What is this written? I mean, second world war will end in few days, okay? Yeah, it has ended a long time back, thankfully, and peace will come, peace has come. Thank you so much. But I want to leave something for you. What? A treasure. A treasure? Treasure. And the road to this treasure is written in a code. I mean, a code. Do we have to write a program? Do we write to have code or no, no, no, no, no. They have given a code, okay? Let's refer it below and it's all yours. My God. I mean, this is our code. We have to decipher this. We have to figure out what is this? But we have to figure it out because treasure is involved after all and we are going to hunt it down. But how? I mean, this looks scary. I mean, what is this code? I-7-6-5-6-C-6-3-6-F-F-6-D. I mean, I will forget it. I'm sorry, I will forget it. I hope you are also not, you know, figuring out, trying to figure out like, how can you figure out this? This is, this is scary. I mean, what can be this? How to even solve with this? What can be the approach for this? I mean, I wish, I wish this was an in-person conference. I mean, this is an in-planet conference, but I wish this could have been in-person talk. I could have invited some of you to help me, but I mean, this looks difficult. This looks difficult, but we are ready. I am ready. Are you ready? Are you ready for the treasure hunt? Let's go. Let's go. Let's go. But before going, let's do some homework. Investigation. Agents, love investigation. So now, what are we going to do? We are going to investigate. What? Let's cause the code. Let's go back to the code. Let's go back to the code and try to figure out future. If you look at this, if you look at this code, you know, in the older days, the typewriter used to write one as I. So this is not I. This is one. It's an important point to note. And if you look at this code, there is one, one, one, one interesting observation. They are all X code. You see, that is, if you see the range of alphabets or numerics used, they are between zero to F. What does this mean? This means, of course, that you are, you know, trying to figure out things. If you are trying to figure out things, this is something, something, something, something interesting happening. What can we do? X code. If it is X code, then what, what next? Investigation is on. The code, the code, the code is X code. The next point that if we look at it, it is encrypted. This is encrypted code, of course. Of course, it is encrypted. That is known, I know that. But if you look at this, can it be XOR encryption? Can it be XOR encryption? This is a very, very favorite problem of almost all those involved in encryption and distortion. This is one of the most fundamental things that we are taught there. Can it be that? Can it be that? Can it be that? Of course, they are getting closer. But now, we have to play this gamble. We have to figure it out and we have to think let's try to make something a bit often. Let's try to think that it is going along the lines of encryption and that too, using XOR. Now this, I know I'm scratching my head. I'm sorry for that. But agents need to scratch head and that is a property of XOR. You know that property of XOR? I mean, we all need to know. We all need to learn this today. But there is one interesting property of XOR, that what's encrypted with XOR can be encrypted with XOR. I don't know why it sounds like what happens in Vegas, stays in Vegas, but let's come back to XOR. Let's come back to Los Angeles. I wish I could have been there. But what's encrypted with XOR can be encrypted with XOR. This is good. This is good. This is good. This is good. But what next? What next? There's still something that we need to know. Like we know that it's encrypted. It's hex code. It's encrypted using XOR. And we have the property of XOR that you just need to do the same. And we are going to investigate it all, like how we are going to solve it. But this gives us a hint, very big hint. There is another interesting fact. Our investigative and research team has found out this interesting fact. And if you look at E-T-A-O-I-N-S-H-R-D-L-U, I mean, I don't know how to pronounce that. We are going to use this. Now, what is this? This is another encryption problem. No, this is not an encryption problem. This is not an encryption problem. This is one of the most interesting facts. I mean, I hope approximate facts that this is the approximate order of 12 most used letters in English language, making meaningful words. So the frequency of letters appearing like E would be more than T and then T would be more than A, O more than I, and so on. And we have our dataset team collected frequency for every letter, how they play an important role in making meaningful words in English language. We have this frequency. We have, we know that it's hex code. We know that it's interpret using XOR. So what are we waiting for? I mean, we are getting close, aren't we? I mean, it's going too quick, but we have 30 minutes. We have to be quick. We have to, the agent has to solve this mystery quickly. We will have to help us, okay? So, I mean, let's go for it. Of course, we are in the 21st century now. We are not going to solve it manually with pen paper. We are going to build an application. But how do we, how are we going to build that application? What language we are going to use? Let's go for it. Golan, we are going to use Golan. I mean, this talk is devolving around Golan, of course, we are not coming directly to Golan also. Because we are solving a mystery, right? Yeah, of course, we are solving a mystery. We need to go back and let's build something in Golan. So what will happen now? Now, if you look at this page, this page has an encrypted code. And this encrypted code is nothing but the code that was written in that script in that memo. We have that. Now we need to go and code and fill the decryption message here. We need to do that to find the treasure, okay, where it is located, or where it is. And this looks so, so complex. I mean, really painful to the eyes and need, we need to fix that part. But before we fix that, we need to figure it out first. I mean, one thing, like, how will this our property work? And how will we are up close to solve this problem before we move on to coding it? So follow me, just follow them. Agent. So now if you look at this photo, this photo is very, very, you know, it gives you a little bit idea about how encryption happens. You're not going to talk about decryption here. We are going to use the reverse logic here. We are going to first encrypt something, something that is written in alphabets into characters. Now here's, there is an encryption key and this is 69, okay. And I mean, let it be this encryption key. I mean, you know, there's another interesting fact. Then this is a byte, okay. So all this encryption key is also a byte. So a byte can have how many possibilities? 256, we're going to use that also as an fact. So what is another investigative analysis, right? Okay, so this means that the range of values can be at the max 256. So at the max 256 encryption keys can happen, right? Right. So for now we assume that the encryption key 69, although in our code it would be figured out on our own and we'll discuss it later how, but we see that a is 97, okay. Small a has its, you know, in the form of byte is 97. And when we zored it with 69, it becomes 36. 36 is a dollar. So now a has become dollar. Similarly, B has become, this is single code and this is M person and this is exclamation mark. So if you look at that code, it is very much possible that this is not directly alphabet, but they are, in fact, you know, they're bytes only when they, when these hex code, this is hex code of course, but when these hex code will be converted into bytes, we will have them in this form, no. We will have them in this form. And then we will try to zore them with, how will we zore them? How will we be finding that encryption key? We'll find that with the help of the CTAOI and SSIDLU, okay. They're going to use this fact, this fact and this mapping will help us get the encryption key. We are going to use that in the form of a score. Let's go back, let's go back, let's go back. We are getting close. So this is single byte solider. This is how encryption is happening. That's it, that done. We know that this was a little bit of reverse to what we wanted. This was encryption, but we wanted encryption. But now let's come out to solve this. So loop through all possible codes, okay. We can use brute force here. We don't have a long set of values. So we can use this, no smart, I mean, this is something sticky, but of course, we are going to use it. We are going to loop through all possible bytes and we are going to zore the byte against each byte of our encrypted code. Why? Because that is what being done here. This, and that was what the property of zore. It will be like encrypted message will be here and it will be zored with something and then we will be getting original message. The message that was being tried to figure out. When you will see in the form of code, we might be seeing it better, but we will be looping through all the possible bytes to be zoring the byte against each byte of our encrypted code. And we need a score because we don't have, no directly the encryption key. We are going to assign spring a score based on the mapping, mapping of what? The frequency table. We are going to see that frequency table in that code. And what is that frequency all about? That frequency is all about how letters come up in English alphabet. And this, the string that will be returned with the highest score will be a different message. How is it sounding? Sounding fun, sounding fun, sounding fun, sounding fun. Let's go code. Let's learn Golang now. Enough of slides, enough of all this. Now, I think we should code. So, before we switch the screen, let's switch the screen and we have to cross. So what are we going to do now? Yes, now we are going to study the code. We are going to see how this has been implementing the form of code. We'll try to understand at least a little bit of Golang if not everything, because it's not possible to be honest with you. The study knows we can have everything. So let's go to code. Let's learn how we are solving this interesting problem and how we're getting the output. So let me share the screen and let's go, let's go. Okay, so here we are. Now, if you see this is the main program that we have written, then the file name is main.go because this is the Golang code. And now we need to study how this code works, how it is going to implement whatever we have to stress till now. So, I mean, let's start from the beginning itself. Now, first thing that you see is the package main. So package is basically a way to group functions and Golang has this, you know, important utility. It's one of the founding stones of Golang, like package can be called because it is made up of all the files in the same batteries and it helps in grouping functions. So its features and its implementations will become more and more important when we think deeper in Golang from the sources that we are going to discuss about. So now we can see that this package main is important because whenever we are going to execute a main, whenever the main function, every time the main package is executed, this function will be, you know, it will be called. And from here, whatever is being called, you know, it will be working for our purpose, our goal. So like if we see like this function, main function, it will be the first thing to be called and from main, it will be calling singles or the shipper, which is written here, which we'll be discussing. From single or the shipper, we can see that decode hex is being called and get car weight is being called. What are these we'll be discussing shortly, but here as you can see, these are the functions that have already been written and how the parameters are being passed. We are now able to discuss how they are Golang specific. So now if you see line number nine, this is function decode hex. So as we mentioned, we need to decode the hex code. We have the code in the form of hex at this moment. So hex have to be converted into the form of bytes array. So how is this function being written in Golang? Let us check it out. So function decode hex, x bytes, byte, byte, comma, I don't mind all what is this. So actually if you see, this is just the function name, decode hex, okay? And this is the value that you're going to pass, the variable, okay? So here the variable is, there's a slice or an array of bytes basically, okay? So we need a byte array. So we are also passing a byte array as export, okay? So this is the hex bytes and what we are going to get, we are also, we are going to get the array in the form of bytes, but they will be converted into bytes, right? Now they are hex bytes. They're not hexadecimal, like you're not passing hexadecimal directly. You have converted the hexadecimal to, you know, bytes. And that will be decoded into the form of bytes, which will be, which we will be getting there. You'll be getting in this variable called with ret return. So this will be having the decoded byte set, okay? So here we are dynamically allocating using make, memory to ret and it will, its memory will be equal to the length of x bytes, which is also being decoded. The length is also being decoded as you can see, x dot decoded length x bytes. So this is something, you know, this is just dynamic allocation of byte array that is happening here. And now in the next code, we can see that here an underscore is being returned. Underscore is returned in goal and when we don't want to use, then something is being returned, but it's not going to be used. So we did an underscore that gives us an option, you know, to just, you know, if something is being returned, we don't want to use like it's going to return, you know, int and error. So decodes SIR into length of bytes, retaining the actual number of bytes written to destination. And it also, I mean, returns the error. But if we look at this thing, RET, RET since it is dynamically allocated already and whenever we decode it, it's already getting, you know, passed inside RET. So it is happening internally. We don't need anything else. So we are going to return RET after this. So what will RET contain? RET will contain the bytes array. This hex code that we got in the form of bytes array was decoded, okay? It was decoded and it was decoded and it has been stored in RET and it will be later on called. But it's not being called here. Of course, it's being called in single sort decipher. But before we come to that, let's check it out what we need to do next. We also need a mechanism to calculate the scores because we know that we have to find the highest score and the highest score string and the bytes that we will get with the highest score will actually, when converted to string, will be the answer that we need, okay? So that is the answer that we need. That is the treasure hunt we will be needing. So if you look at this, okay? So now if you look at this, this is just getting, you know, what we talked about ETA, IH, SRW. So my investigative team has, you know, covered all these data. And if we see what is this, this is from what is happening in line number 21 to line number, 40 is nothing but it's actually mapping of all the alphabets as keys to their values. And what is these values? These values are frequency, frequency of their order of the period, frequency of their appearance, approach frequency of alphabets, making meaningful English words. So if you see like E should have the maximum and it is having the maximum and then T is having nine. Similarly, it's all following this order. So this data is something that is available on the internet. We can get it from there. And I've also used the same. And it is, what is it returning? It is returning the, you know, it's returning the weight of the score according to the corresponding key. So whatever key, key is also a form of byte we discussed. Inception key is nothing but a byte itself. So here we are getting the key terms, a form of care byte. So whatever, you know, key is we have, we will return the float value to that. So this is returning basically the value of the alphabet that is coming from here, the key. The key will be passed from this course in a georgia circuit. So this is getting a key here in the form of care byte and character and this is all the type byte. And it is going to return the frequency which is of type float 64. Okay. So because it is a float variable, it has the same places. So it is going to return of type float. So this is basically a hash map. This is nothing but a map, map of keys and values. Here the key is a, b, c, d, and we have converted into form of byte. Okay. So that they are mapped easily. Now we have a mechanism to also calculate our scores. Okay. And we have also that decoded byte array strings. We have two things. Now we need to just execute our algorithm. Okay. And we are going to execute here in this function. What we are going to do here, we are just going to, we are just passing the encoded message in the form of array of bytes and what we will be returning, we'll be returning the answer in the form of bytes. The answer is a decrypted code. And this is just the maximum score which we are returning, but we won't be using for now because that's not what we want. And this was just for debugging in case we had a problem but we didn't have. And this is an error by any chance that it happens. Okay. So what is happening in line number 53? Line number 53 is just calling the function that we made here, decode hex. Now what is happening here? This is getting the encoded message and it is decoding it in the form of byte array. Now we have the byte array. Now what are we going to do? We are going to store each element in this bytes array with the 256 types, all the possible bytes we have are 256 only. So we are going to store them and store them in again an array of bytes. Okay. So this C is nothing, no, it's not C actually, it's just being zored here. It's getting zored. And then we are getting this R. This R is actually the array of bytes where we will be storing the converted, I mean the zored code. So whenever we are going to zore using the zore property, we are going to byte it again. We are going to zore it against its own bytes for all the possible values. So all the possible values for all the possible values, we do that. And after doing that, what are we going to do that? We are going to use this C, whatever it will be, like we remember, when we were discussing that we were zoring it and we were getting a new form of character after zoring because that will be a new byte. So new byte will be a new character and that character will be, there is a chance that it might be the answer. So how to ensure that that chance is the highest by calculating the score? So how will we be calculating the score? We will be giving the string the score by using this function, get car weight and we will be created this here. Now this is happening, like this is happening through a simple logic. We have declared a variable called variable S that will be having the sum and it is of the type floor 64. So it is of the type floor 64 and what it is doing, it is getting the sum of each, like it's going to pass through the entire bytes. So it has to calculate the entire byte array sum. No, it's just like, you know, consider it when you, if you have ever, like if you have a programmed or declared an array and calculated the sum of all the elements in the array. So we are basically doing that only. Just an additional step is that we are mapping it with here so we are mapping the characters and passing them here and then we are adding the sum. After that, what is happening is we are storing that, you know, this character in the corresponding are the resultant array of bytes. Now what we'll be doing after this, all this happens, we are trying to calculate the highest score because the highest scores will only be the corresponding string because that will have the highest probability to be the English word that we wanted. So how to do that, that is also something similar that we might have done in other languages that we have done. It's just like calculating the maximum, you know, element of the array, just like that. So we just want to calculate the maximum highest score there. So now we are getting the scores here. Absolutely, that's right. But we have also variable score defined here in 958 again, of course, 645. Now we are just finding the maximum of it, okay? So if Fs is greater than score, then what will happen? You keep on, means that is better. So you keep on storing it in the answer then you get the maximum score until as soon as you get the maximum score is done. So where, so this, and now if you see that line number 73, it is getting the entire array. This is, this is, this was an array we are just, we are just assigning it directly, you know, to R because we need, you know, because we need the entire array. So this is something that we can do here and we need, and we have done after doing this, what are we going to return? We are going to return this answer, the score and the error, okay? And in this case, okay, and after this, what will happen is like if you see this function, main function, in this main function, we are calling this single sort of shipper code that we have implemented. So now if we go to this code, things will become little more clear. I will try to repeat. Now what is being done? This is the pressure code that we had. This is being passed in single sort of shipper function. Okay, and what are we going to get? We are going to get the answer. The answer is in the form of byte array. So we are just inverting it in the form of string here when we are trying to use FMT. Now FMT was declared here, as you can see. So what is its purpose? Its purpose is basically to print it, format it in the console. So we are going to use that FMT.printer there and decrypted code is in the form of string answer. So overall, this is the code that we wanted to implement. Now if we go and check it out, like how it has been done. So if we see again, single sort of shipper function, it calls this, single sort of shipper calls decode hex, it decodes the xcoded byte message. After decoding, it maps with the weight map that we have created and keeps on adding the sum and on finding the maximum sum, we map it with the corresponding bytes, and then that byte will be the answer, those that array of bytes, which we can put in the form of string. So enough of all this, now it's time to run this program. Now let's just see that what does it does. So let's run, we can go run main.go. Wow, so the answer is decrypted code is welcome to kubecon plus cloud native North America 2021. Oh my God, so that was our treasure. That was our treasure. And now let's go back to our slides and see how far we have reached. So let's go back to our slides. Here we are. So on building in Golan, we found out that the encrypted code had nothing else with the treasure that we are savoring today, the present that we have today. Welcome to kubecon plus cloud natives, conference North America 2021. The link to implemented code is in these slides, but now I know that this is not just, this is just the beginning. In fact, we have just covered a very interesting point of view of Golan. I would not say that this tutorial or this workshop or this talk will tell you everything about Golan. This was not intended actually, this was just to give you the thought of resources as well as the first impression of how to move ahead with it. So the agent that has done it, we will remove his glasses or maybe later on the first, let's figure out what else is left. So installing Golan is something that I have already mentioned here, these resources, please go and check out according to your operating system, you can install it. And why we use Golan, I mean, one of the biggest advantages of Golan is that it's built for conferencing. And it's easier to learn, it's learned to learn and has been adopted by many and used by many cloud native technologies like Kubernetes and they use it because it is built for conferencing. So, and many other features that we have, like the kind of package dependencies handling it that we do with GOMOD, when we go in detail, we will discuss this later. There are other response of resources that I have shared with you all to learn Golan because learning Golan will be requiring, little bit of time, it will take time, but don't worry, you all will learn, you all will enjoy about it. And with this, I would like to end my talk and this talk that we had. And I hope that you enjoyed this journey with Agent Mr. Jett to discover the treasure, the treasure is today, this conference. Thank you so much for coming out. If you want to reach out to me, reach out to me on Twitter at Mr. Srinanipur, if you want to reach on MeStack, on Kubernetes Stack, my name is just Adam. Mr. Jett, you can reach out to me there, don't just end here, we are here to have you, we are here to help you out. And if you have any questions, let's discuss, let's try to solve them, let's try to help you out. Thank you so much for joining. Thank you so much, everybody.