• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

The Coder's Lounge

Leviathan

[span="font-family:ubuntu; color: whitesmoke; padd
1,103
Posts
10
Years
Aye, AWS is such a lovely platform to work with, I must say. Had to set up a database on it for a group project in college back in January, and the place I'm currently working in uses it extensively too.

I just wish I understood more of its features, haha. That Route 53 stuff in particular is new territory to me, but I'm slowly getting there, I suppose. Amazon's documentation has been extremely useful and clear to read, thankfully.
 

Leviathan

[span="font-family:ubuntu; color: whitesmoke; padd
1,103
Posts
10
Years
I'm hearing lots about AWS, but I'm still really undecided as to what hosting I want to go with. I could get dirt cheap shared hosting, but I'd like to have dedicated hosting and perhaps set up HTTPS as a best practice measure even though I'm not sending any information on the website... At least yet.

Mind recommending a few dirt cheap hosting sites? Thinking of making a personal site, so the cheaper the better. I used a particular host for a project earlier in the year which nearly drove me spare - had a very poor service with lots of downtime.

And Johnny, maybe try using cookies or sessions? Could try storing data in a file, too, if you wish to do so without reading a DB.
 

Leviathan

[span="font-family:ubuntu; color: whitesmoke; padd
1,103
Posts
10
Years
Say, I'm due to start learning about Android development in the fall, with a huge project lurking in the wings that might require some kind of android app integration. Would anyone be able to recommend me some resources/tutorials to look at? I've got that Android Studio IDE installed and I'm thinking of checking out Lynda.com, and maybe Youtube later... No clue what language to use either, but I'm open to suggestions.
 

string555

Banned
1,373
Posts
6
Years
Does anyone want free malwarez? :O

Joking, relax. XD

I've been studying perl for a number of years now, I've barely started on learning C for one of my next daughters. She's going to be a Win10 Keylogger with Rootkit capabilities, for research.
 

string555

Banned
1,373
Posts
6
Years
In hindsight, that was a terrible introduction to this thread. >_<

How about this instead:

I've had an idea for a while now that I've never got a chance to implement. I call it the "Crypto Easter Egg".

The problem with easter eggs in any game is that someone can just pick apart the game's code as soon as it is released and find out any secrets and easter eggs, which IMO defeats the purpose. I believe they should only be found after the player explores almost every corner of the game and stumbles across it by accident.

So, the idea is to take the part of the game's code that has the easter egg and store it in encrypted form. When the player goes to a certain location of the game and does a certain action, a bunch of variables are taken from certain events along with the different characters' stats, and combined into a string. That string is then run through a cryptographic hash and compared to a hash digest embedded in the game's code. If it matches exactly, then that original string, the unhashed one, is converted to bytes and used to decrypt the easter egg code, which of course is then executed.

How does that sound? :D

If my explanation doesn't make enough sense, I can write up a quick and dirty perl script to demonstrate.
 

string555

Banned
1,373
Posts
6
Years
Been super busy to reply to pretty much anything haha

In all honesty, depending on what your game's platform is, you can probably get away with system security. But, the thing is that no matter what, people will try reverse-engineering it if they're that committed, or, once one person finds out, it'll get on the internet and everyone will know it. I wouldn't go to that great of a length to try hiding an easter egg, because once it's found and mentioned online, everyone will know about it.

Besides, if all your scripts and text are all unencrypted except for one random portion, it'll basically draw attention to itself because of its nature. If you do all of the text and scripts, once someone decrypts them, then it's found anyway. There's no good way of going about it. It may slow them down for a time, but at the end of the day, it won't really be too much for anyone to do.

That's very true that once someone figures out how to unlock it, it would be all over the internet. It could take some time if enough variables were put into the key, which would make brute-forcing it unreasonable. At the same time, if too little were put into the key, brute-forcing it would be a cakewalk. Also, that would be why the key is stored in the code as a hash digest, the original key would only be used if it's digest matched that one. That way you couldn't pick apart the game's code for the key.

It seems funny if there was an easter egg in a game that nobody could ever unlock, if the key was a ridiculous size and the algorithm was something like RSA... :P
 

string555

Banned
1,373
Posts
6
Years
Yeah, at that point you might as well invest in some form of DRM system that allows for game content to be encrypted, then it'll slow them down a bit. In addition, using in-house formats that store content with, say, a different character encoding may also help. As well, try making your build system create obfuscated file names will also slow down RE attempts because they'd have to document the files first.

At that point, why not just make it into a rootkit? XD
 

Honest

Hi!
11,676
Posts
15
Years
Been meaning to post in here since forever.

Hey guys! I'm Honest, but you can just call me Dipu. I majored undergrad with a degree in Media Studies concentrating in Emerging Media/Web Development, as well as a minor in Computer Science. Currently I work as a software developer trainee. I'm proficient with HTML5, CSS3, JavaScript, JQuery, AngularJS, SQL, and Java. I have also dabbled with C++, Python, and Unix. Also dabbled with C# thanks to Unity. I intend to learn NodeJS and pHp when I can.

Now that the formalities are out of the way, I was wondering if anyone could help me understand something. I was doing some JPA (Java Persistence API), which is essentially manipulating databases with Java. While doing some assertion tests, I ran into this error that I simply could not wrap my mind around. My trainer could not figure it out either (I actually had to remove the test case completely cause I could not figure it out in the 2 days I had). Here are the code.

This is the method from my DBReadCommand class, along with the EntityManagerFactory and EntityManager being used to connect to the database and handle my User entity:
Spoiler:

Here are my write and delete User commands from my DBWriteCommand class
Spoiler:

And here is my test case that kept failing, with the set-up and teardown (this is JUnit)
Spoiler:

Now the test case SHOULD pass. But it does not, and it keeps giving me, if I recall correctly, an error saying I'm attempting to delete a null/non-existent entity. What I do know is that after deleting the added user, in the tear down, my findUser method reportedly finds the user in the database, even though he does not exist. So upon the attempted delete within the if-block, it throws an error. Another thing I know is that if I do not use the listUser method, the test compiles and runs just fine.

If anyone happens to know what's going on, I'd greatly appreciate it!
 

Honest

Hi!
11,676
Posts
15
Years
So in looking at your code, have you had a chance to look, in a debugger, at what em.find() is returning in removeUser()? I feel that line is probably the only place that it could possibly fail, especially that it fits in context with the fact that it's trying to delete something nonexistent/null and is still visible when you do the teardown. In addition, are the keys that you're searching by being properly fulfilled? Are there any nulls that could be throwing off results?

Edit: I noticed in your test function where compares sizes that you're passing a full instance of a User to removeUser() yet the function uses a String username as a parameter. Is this intentional?

I'll get back to you on the first part within the week, my source code is at work. Regarding the removeUser() method, that was my mistake just now, it should be USERNAME. Sorry!
 

Honest

Hi!
11,676
Posts
15
Years
Any updates on this? I'm curious to see what came of this.

Oh I completely forgot to update you guys, sorry!

Sadly, I spent maybe 2 more days on it, but neither me nor my trainers could make heads or tails of the situation. In the end, I scrapped the test and simply used a different variation.

Sorry for the disappointing outcome :'(
 

string555

Banned
1,373
Posts
6
Years
I looked into the next AES competition, called CAESAR. The encryption algorithms submitted have to have a built-in authentication function. Upon looking at the submissions, I noticed one called 'Deoxys'. I thought, must be some kind of coincidence, probably means something else to its authors. Then I saw the previous round of submissions, and there was one called 'Joltik', by the same authors. I knew then that this was no coincidence.

I think that's pretty cool that some fans of Pokemon put in some entries for that contest, and it seemed relevant to put here. Here's hoping one of those entries wins. :D

Here's the submissions for the contest:
https://competitions.cr.yp.to/caesar-submissions.html
 

Raffy98

[color=#2d9bce][b][span="font-family: 'century got
2,153
Posts
7
Years
Noob question time.
Hi! I honestly didn't know where to post this, but I thought that this one was the most appropriate place rather than making a new thread.
Anyway, I was looking to start learning how to program smartphone apps, specifically Android apps, because I thought it could be interesting and also useful for my job (they asked me if I could make Android apps and unfortunately I had to say no).
So my question is, any tips for a beginner like me? Some recommended developing environments or languages? Thanks in advance!
 

Legendary Silke

[I][B]You like dragons?[/B][/I]
5,925
Posts
13
Years
  • Age 30
  • Seen Dec 23, 2021
Since @Incineroar thought that this might be a good place to continue a discussion on the Discord channel, I'll be posting it here.

I've been thinking about Android app ideas, or maybe writing Python for a change, for the first time. Just me trying to learn new things ;)

Right now I've been thinking of a random name generator (perhaps useful for running a tabletop RPG or playing a video game where you can name your character), though I've been a bit on the fence about it...

There's also Python... perhaps there are good resources to getting to know Python. Hopefully it's not much of a stretch coming from C, C++, C#, and Java.
 

string555

Banned
1,373
Posts
6
Years
I finally learned enough of the necessary ingredients in ANSI C to start making some very basic file encryption programs. For each version, I did a test encrypt/decrypt of a small text file and an image file of about 200kb. Everything was working fine and dandy up till the 6th version, shown here:
Spoiler:


For the 7th version, all I did was take the repeated code for the S-box initializations and reversing (For decryption) and package them into separate subroutines. That code is shown here:
Spoiler:


I did the same tests, with the same keys, on the same files. It worked perfectly fine for the text file. But here's where it got weird. When I used it on the image file, after decryption, it got corrupted. I restored it from an original copy and tried it several other times with different keys. I carefully examined all my input, it matched exactly between encryption and decryption. So next, I took several other image files of different sizes, the smallest being around 20kb. All of them had the same problem. Then I took another text file of around 10kb and tried it with that, it worked perfectly fine.

Because of these weird inconsistencies, I can't really begin to understand what the problem is, and I'm still pretty new to C programming (I came from mostly perl). I'm in one of those "I'm not sleeping until I figure out the problem" modes. XD

Note: Not sure why it removed everything between the angle brackets in the include statements when posting, must be some kind of whitelist thing going for the BBS. :O

Edit1: So I stared at the code for a good while, it still won't confess its problems. :/

Next, I thought that maybe for some reason the problem was related to the size of the input file. So I made a 30kb text file, 10kb larger than the smallest image file I tried it on. It worked fine. XD

Then, just to try a different file type, I encrypted/decrypted a 9mb mp4 file. Same corruption problem. :/
And just to add to that, the previous 6th version worked perfectly fine on that very same file.

Normally, at this point, I would try peppering the code with debug statements, but I don't think that method will work in this case.

Final Edit: Well, it's been 1 week and I still haven't solved the problem. Instead of repeatedly banging my head against the wall of code, I decided to continue work from the 6th version until I figured it out. I added a loop for variable number of cycles, and a layer of diffusion in the version now known as 'LEA' (Little Encryption Automator). But, I came across another problem that I didn't (And still don't) understand. I'll skip the details on that one, though.

Then, yesterday, I had some free time after work, so I used the computer there to start working on a key schedule. It all worked fine there, so I printed out the page of code. Then today, I typed it up exactly as written, and lol, didn't work on my computer. So much for ANSI C being easily portable... But, it was simple code, so I dissected it thoroughly. I came up with the idea of changing all the int and char arrays to be the matching unsigned char type. That fixed it, though I'm not completely sure why. XD

Then I decided that since it worked for that one, and since I should probably keep everything matching on LEA for when I tie the code into her, I tried the same solution for her. Much lulz ensued as it made her work just fine. I was hoping that this same solution could be applied to xorc7, and so I tried it, but it still has that same problem. I will keep trying to figure it out, but in the meantime, the next step is working more on the key schedule code and then tying it into the next version of LEA. Here is her code for now:
Spoiler:

Edit X: Okay, so I said that last edit would be in fact, the last, but I had no trouble implementing the key schedule, so I decided to share it. :P

Here it is:
Spoiler:

If nothing else, maybe it's interesting to see the development of a (weak) cipher, step by step. :P
 
Last edited:

Flowerchild

fleeting assembly
8,709
Posts
13
Years
<p>i started to write a discord bot in coffeescript bc i wanted to experiment with discord.js but couldn't stand actually writing js, so now i'm just compiling to it.</p>
 

Leviathan

[span="font-family:ubuntu; color: whitesmoke; padd
1,103
Posts
10
Years
I enjoyed tinkering briefly with a discord bot in c# I if I remember correctly? Coulda been C++, been ages since I last looked at it.

Finally got started on android development too. So far, so good, and now I've got to do a dissertation on a shopping list app I've chosen to develop for my final year project.
 

string555

Banned
1,373
Posts
6
Years
Does anyone else actually enjoy the debugging process? As long as it's not someone else's code, I actually like doing it. It's kind of like solving a puzzle that I created on accident. :D

Not to mention that when the bugs are clear and everything works the way you wanted it to, it gives a very good feeling. ^_^
 

string555

Banned
1,373
Posts
6
Years
Debugging is complete hell if you have no idea what's wrong, but something is wrong.

Even worse is when you figure out how to fix the bug, but you have no idea WHY it fixes it. XD

For example, I was recently learning how to play with argc and argv in C. Here's a snippet of the code I finished:
Spoiler:

So to run this one-line mode, you enter "-c" after the name of the program, allowing you to then write out all the input on the rest of the line in one go. During a test, I printed argv[0] and argv[1], which showed that the first argument was the name of the program, and the second was "-c". However, the program would not want to jump into that if statement, going instead to the else (Not shown). So, for some reason I decided to change that part to try and use argv[0] instead, on a whim. It then successfully jumps into the if block. Now, I know damn well that argv[0] contains the name of the program, because as I stated earlier, I printed out the first 2 arguments and saw that to be true.

So why does it now work as if argv[0] contains "-c"? I have no psyducking clue... XD
 

Venia Silente

Inspectious. Good for napping.
1,230
Posts
15
Years
Even worse is when you figure out how to fix the bug, but you have no idea WHY it fixes it. XD

For example, I was recently learning how to play with argc and argv in C. Here's a snippet of the code I finished:
Spoiler:

So to run this one-line mode, you enter "-c" after the name of the program, allowing you to then write out all the input on the rest of the line in one go. During a test, I printed argv[0] and argv[1], which showed that the first argument was the name of the program, and the second was "-c". However, the program would not want to jump into that if statement, going instead to the else (Not shown). So, for some reason I decided to change that part to try and use argv[0] instead, on a whim. It then successfully jumps into the if block. Now, I know damn well that argv[0] contains the name of the program, because as I stated earlier, I printed out the first 2 arguments and saw that to be true.

So why does it now work as if argv[0] contains "-c"? I have no psyducking clue... XD

Because you are using strcmp wrong, actually >:)

You see, strcmp does not return a bool value for comparison, so you should not use it in an if unless you explicitly compare to a result. strcmp returns zero aka "false" if the strings you are comparing are equal, whereas you are looking for a "true" value, which is any nonzero value - when the strings ae different.

Your line should read

Code:
	if ([b]0 == strcmp(argv[1], "-c")[/b]) {

That it worked out well for argv[0] might have been mostly luck given that the hyphen in "-c" comes before any other valid character in the name of your program and thus "-c" always compared more "favorably". If your program name was started with a dot assuming the filesystem allows it, you'd see how it fails.
 
Last edited:
Back
Top