OK so there isn't much more left.
So we have the decrypt function which is go ahead and format the cell.
But there we go we have to decrypt function here.
And this part this part might be a little bit strange to you because the same variable has been utilized
twice basically.
So you first declare it then you stream the contents of the file into it and then you say that.
Then you substitute everything in data with decrypt by.
OK let's take let's take let's take another shot at this.
At what this line does say decrypts 64 and you pass the string data to it.
Then you decrypt whatever is in that string.
And then you put it back into the data string.
So this was done simply to conserve resources.
Because then you would need to declare another string and you would just type it in like this in order
to save the resources to save yourselves Save yourselves from having to declare another string on a
program on this decryption program that has this small.
It really makes little difference but it's just a coding habit that stays with you and it's very difficult
to get rid off.
And there's no point to get rid of it because it's very effective on a large scale project it saves
a ton resources.
For example in Java that is the difference between.
Well not that but that same concept would apply to the applications which do the same things.
For example you have two games and one game wastes your battery like a lunatic and the other one basically
doesn't waste your battery.
So yeah you're just you just get used to writing code in a certain way to conserve RAM and to make the
program as small as possible and to save on the usage of the system resources.
Anyway let's go ahead and continue.
Enough of that.
So now we need the output files so O.F. ups our stream.
Oh and we're going to name this one and this is going to be out.
So we're going to initialize this just going to use out here which is initialized to the second argument
and then we're going to do basically check down below.
So if Oh and if there is nothing in the oh let's go ahead and return cannot write output files so perhaps
that's a crude statement to if there was nothing as long as it as long as it is nothing for whatever
reason maybe it cannot create it maybe you don't have the permissions maybe something else failed and
it did create file but it's empty blah blah blah.
Not just that it's empty.
There is some sort of problem and it cannot read the file which will basically return D which will basically
mean that the return is actually false the return will be interpreted as false.
And if it is false then go ahead and return it just get us out here to know what happened.
So you can not write to put file.
OK.
And then we're going to do an
Sawrey out
and get the single quote here as well just like before and and L and the return code will be fine.
OK.
So down below 0
data
Yep.
So we're now outputting from F-0 back to we're outputting from data into f o file file descriptor which
stands for file space in the crudest sense of the word I guess.
Data and that's call.
So we're taking now the decrypted string data whatever is contained in that string is decrypted information
and we want to put it into a file so that we have it for safekeeping I guess or whatever to see out
the coating.
The coating Plus
the coating was successful.
Close quote marks and type as you call colon and L. And of course we need to do this across the board
because I'm kind of stupid with these things.
Astigmatic ups s d the colon
missing one here.
Colon and a steady Kunkle and here are missing air and semen here.
Odd.
Like I completely forgot that I need to actually utilize it.
There we go.
So now it should be fine let me just oh I have a spelling error here so is.
Remove one L
and add an additional.
OK.
So the coding was successful and go into the next line returns.
So hopefully this is going to work.
This is the entire code needed for decoding decrypting that is.
And we're going to go ahead.
We're going to go ahead and build sexually decoding and decrypting it because it may 64 is an encoding
process.
But since we've added salt it's actually encrypting as well.
So we need to decode and decrypt anyway.
We now need to basically run this program compile this program and can do that with control B Control
beat.
No it doesn't work.
So just build and run air base 64 decode was not declared in the scope or sold to sold three sold one
was not declared in this scope base STDs string.
Ok.
Ah right.
So I have not declared the salts here.
So let's go back to get up and grab the salt's.
So this is salt wants to salt 3.
So we'll just pull them from here.
And and put them like here.
Well actually let's put them above the function
control.
Let's go ahead and build it now.
Base 64 underscore the code.
Right.
Missing a semicolon here.
I'll say it again and run it.
What does it say Now Airbus 64 was it was not declared in this scope.
Ah yes.
OK.
No big deal.
What we are missing is s equals Sultanpur so to three.
So 3PL lock and or not we just see SDD string.
Base 60 for de-code.
OK.
This is a function.
So basically for underscore de-code is a hint that her function from here this is be 64 for encode and
need be 64 de-code So we just need another function to plug it in.
So just go ahead and copy it.
I think it's here you should be here.
So Control C as I said I've written this a while ago and I've completely and it's been a very long time
since I've written it.
OK so let's just go ahead and copy paste this here.
Format that little bit and then basically just pool this as well.
So it Control-C
this tear semi-colon control less it's building right now.
OK let's see what the problem is now.
So every expected primary expression before in
fact was not declared in this scope base 64 code was not declared and the scope was not declared in
the school.
It was not declared in this scope and I this is as well
clewed vector.
Let's see the same areas are going to pop now.
No.
We have a different error.
So base 64.
We just see what's written here.
The 64 codes.
Let's see what we're missing.
OK let's go up up.
OK we're missing the string for the base 64 encoding.
No big deal can plug that in just as easily.
Let's go back home.
So can string control us
on there we go.
So now we're just missing the actual arguments press enter.
But yet ups.
OK so now we're just missing the actual arguments and the code is done.
So just save it.
You actually if you just minimize this not that we've actually built and run it.
If you go to the folder where you have actually saved this I've saved mine to the stuff.
So here we go decrypt Faygo here and if I go in Debug I will have to decrypt that.
And in default.
We're going to do some decryption.
So all the functions and all the strings that I've pulled from get hub you have access to them as well
and they are explained in great detail in the previous lectures of the course.
So don't worry about that if you don't understand it just go back a few tutorials.
I have explained them in great detail.
They're here for decryption process.
I figured I wouldn't explain them twice I would just pull them and paste them into here so I wouldn't
have to retype everything back up again and so that you wouldn't have to retype everything again.
So if you have changed your assaults you need to make appropriate modifications here.
If you have changed the encryption process you need to make the proper modifications to the decryption
64.
And you shouldn't have made any changes to the base 64 encoding because stuff like standardized algorithm
that is used.
OK so with that we have created it compiled it ran it and now we're going to actually do a test run.
I'm gonna have a file which is encrypted by the key logger and I'm going to use this program in order
to decrypt the particular file that I'm going to do in the follow up to Tauriel.