Protect code from theft

I was programming in class the other day when someone asks me to look at their code, so I checked it out to see what was wrong. I decided to compare this code to my own, which I knew worked, when I noticed that their code was almost exactly the same, word for word. They told me they found it online, and I know there are some really smart people in this class who have even keylogged my teacher's computer and are able to use her password and everything.

So, my question is, how do I prevent people from stealing my code and posting it online. One person said it could've been taken from the server folder, but it was in "My Documents". Then they said that it could have been pastebin, but I didn't leave my computer the day I turned it in, and this person needed help after the code was completed and working (mostly). The only option I can think of, then, is that someone stole my password or did something similar and posted my code later. I don't know what happened, but does anyone know how I could prevent this from happening again?
Don't work on public computers? If it's related to class, just notify your teacher. He probably won't be able to do anything about it, but at least she'll know you wrote your code yourself. And once THAT's settled, you don't really have to care anymore.I

f it was after you handed it in, your teachers computer might be the the leak.
GRex2595 wrote:
and I know there are some really smart people in this class who have even keylogged my teacher's computer and are able to use her password and everything.


Are you serious? That anybody would risk expulsion and/or criminal charges in order to get better grades is beyond my comprehension.

I agree with hanst99 - don't expect anything you do on a public computer or network to be safe. Also, try submitting a .cpp file with errors but include the correct .exe file along with the .cpp. That way, if your teacher's computer really is the leak, anyone who steals your work can only submit the error-laden .cpp files. (True, you might be docked some points by your teacher, but who knows - it might yeild some interesting results)
Last edited on
write a command line encryption program and then write a shell script(or if appropriate batch) that compiles it and then encrypts it. so then it will only work for you. i can see some problems with the idea but they could be figured out
I'm confused. They got your working code. Why did he still ask for help?
@Gaminic
It was only partially working. The part he needed help on was a part I made trying to read a file after I had already created it. He hadn't created the file yet, so it wasn't working on his, but it was on mine.

@hanst99 & atropos
We submit code with printouts. I don't think that the teacher actually checks our execute files, only the code. These computers aren't completely public either. We have our own accounts with passwords. Up until yesterday, I thought my 18 character password was safe enough.

@atropos
I don't know what they do with the key logger, but I know that they have her password. I think they just did it to say they can.

@Aramil of Elixia
??? Not sure what you're trying to say with that or how to do that, but I'm sure that would be very helpful if I could do what you're suggesting.
If the teacher checks the code of each student, one would think that she would notice the similarites among the submissions. If I were you, I'd also mention to her that some students are in possession of her password.
I'll mention that next time, but does anyone know any easy ways to protect the code?
These computers aren't completely public either. We have our own accounts with passwords. Up until yesterday, I thought my 18 character password was safe enough.


Password or not, it's still public. There may be security leaks that allow people to access your data whether they have your password or not. What I still don't get is why the hell anyone would spend time and energy trying to steal somebody elses solution rather than just doing their homework. Unless the tasks are incredibly boring of course.

PS: Printouts? Seriously? I really don't think you should try so hard for your course then -_-
You could run your source code through an obfuscator.

There's a neat animation on this page:
http://www.stunnix.com/prod/cxxo/overview.shtml

and I'm sure that there are free products out there as well.

If you're forced to submit code through a public system, then at least you can submit garbage, albeit garbage that works.

PS. Be sure to ask your instructor if that's acceptable or not. I don't want you to get in trouble by following my suggestion.

PPS. There's really nothing that you can do about code that's already out there and people want it. People just love to change a few variable names and re-license your code under the GPL. (and if you move to fight it, the FSF has stronger legal muscles than you do).
Last edited on
The only thing that comes to mind is some sort of encryption algorithm - maybe TEA? It's pretty simple to implement and it does a decent job.
Of course, this would only add a layer of complexity, as your teacher would need the decrypting program on her computer and students already have her password.
Last edited on

PS. Be sure to ask your instructor if that's acceptable or not. I don't want you to get in trouble by following my suggestion.


He said his teacher wants printouts, so that's hardly an option.
@hanst
I try so that I can make myself more better and more creative in my programming. This was actually a program that was somewhat difficult for many people, but I came up with a different way to do it that very few people probably thought of or would have been able to use. That was one of the giveaways, and people would go through the effort because I have some of the best code in class, not to sound self-superior.

@atropos
I could do an encryption program, I've done an incredibly basic one already, but that wouldn't really help me too much if the teacher has to read it on a piece of paper.

@Luc Lieber
Same as to atropos, but also, I don't care about my code being illegally replicated. I really just don't want people using my code when they don't understand it and won't learn from turning it in. The only people who would turn in my code wouldn't have a clue how it functions or why it works. They won't make any money off of my code, so I don't care what they do with my code, but I don't want people just turning the code in to get a good grade and not learning anything, otherwise I'd post it myself.

@everyone
I don't think I've really made clear what I want to know. Is there any way of detecting and possibly negating any programs that might make it possible for people to steal my code? If not, then is there any way to make it so only I can read and write the code using a password or something to gain access to it? If I could lock up my code like that, then I don't think anyone would be able to steal it with or without a key logger.
Last edited on
Well, if you have a personal computer you could do all your work on that and (if you want to screw with people) make obscure code that prints stuff like "Don't steal my code."
So far I've decided to try switching my password every day. It was fuckoffyouassholes last time, but I switched it today. The biggest problem is that I don't know what the programs I'm going to have to make are until I get into class for that week. I guess I could make every program in the book and I won't have any problems, but the programs are so easy to make that I don't really want to do that.
GRex2595 wrote:
@atropos
I could do an encryption program, I've done an incredibly basic one already, but that wouldn't really help me too much if the teacher has to read it on a piece of paper.


So, when you said earlier that
We submit code with printouts
, you meant that you print the contents of the .cpp and turn the printed page? O_o

If that is the case, what about this:
1) Write the assignment code as usual and print it out
2) Save the correct code as a .txt
3) Load the encryption program (store it on a flash drive maybe?)
4) Have the encryptor read in from the correct code .txt
5) Save the encrypted code as a .cpp file
6) Keep the encrypted .cpp on your computer


7) ????
8) Profit!
Sorry, couldn't resist the power of memes... :)
Last edited on
Yes we turn the contents in as a printed page. I think I've probably caused enough time wasting on this forum. I understand what you mean^, but if I do that, then I might as well just delete the code or save the code itself on a flash drive. I just don't really want to do either, so I was wondering if there was a way to protect my code with a password or something.

I guess Portal 2 is right in saying that sometimes the best solution is the easiest one.
as i was saying write an encryption program in c++ that takes your file and encodes the source. keep the key on a text file on a flash drive or something so that way they cant use the exe and then its protected.
Topic archived. No new replies allowed.