Encryption / File Shredding

This is a discussion on Encryption / File Shredding within the C++ Programming forums, part of the General Programming Boards category; Hi all. I am *fairly* new to c++ and have been wanting to make my own encryption program. But i ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    4

    Encryption / File Shredding

    Hi all.

    I am *fairly* new to c++ and have been wanting to make my own encryption program. But i am not sure where to start except for maybe using a For or While statement with random numbers and random ASCII characters using (char). I want the encyption to be undoable therefor, shredding. This could also be done by deleting the contents and putting random data to the file and deleting it, which i would also like to know. Please, if u have any ideas or help, email me or reply to this. THank you.

  2. #2
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    you want to make a files contents un useable for good?
    well you can use a random number sort, and change the value of the current char to the current char's value + the randrom number generated... then go onto the next char.

    Its damn easy.. and its almost 100% full proof that the contents that you are changing will be un readable and or just doesnt make sense ever again...

    but im curious, why do you want to make unusable data??
    im thinking you want to make a virus, if so please dont, its just stupid... if you are may i remind you that the guy who created the Mellisa virus is behind bars for 10 years...
    Last edited by Liam Battle; 05-04-2002 at 10:36 PM.
    LB0: * Life once school is done
    LB1: N <- WakeUp;
    LB2: N <- C++_Code;
    LB3: N >= Tired : N <- Sleep;
    LB4: JMP*-3;

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    317
    I totally agree. A destructive virus can be made by any hack. Anyway, for encryption on general, the gov. can practically undo anything, including physical damage. So good luck on your ventures and remember that hacking was originally started to get data, not to destroy it forever.

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    4
    lol. no, im not a virus-writer. I just want it so my family / anyone who gets ahold of the data when i delete it cant read it if i dont want them to. And i was hoping for some code samples. i know that random number gen goes like rand() but no idea how to use other stuff to go with it. lol. like i said, im a little rusty but bare with me. email me. thanx

  5. #5
    Registered User
    Join Date
    May 2002
    Posts
    317
    lol. Perfectly understandable. I'm getting drunk tonight so if noone posts the code by tomorrow I'll help then.

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    just replace the file info with repeating message
    Code:
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    all work and no play make jack a dull boy
    . or better yet, replace it with similar material that looks like you're planning to assassinate castro

  7. #7
    Registered User
    Join Date
    May 2002
    Posts
    4
    Yeah, um, sorry about this but i wasnt exactly very specific. What i meant to say was that instead of just replacing the contents of the file with messed up stuff, i wanna shred the file at the hexadecimal/physical level. Thanx and sorry about that.

  8. #8
    Registered User
    Join Date
    Apr 2002
    Posts
    139
    I think the way it is done is it reads in how big the file is and then randomly puts in that many bytes. You do that a number of cycles. Then you have the program delete it. (yes it can still be recovered but it will be trashed) If i remember right there is alot of programs already that do what you want. Remember even if you don't have the files that can't be undeleted (seen) they can still be recovered. unless you defrag the hard drive then it is unrecoverable (unless your file was at the end of the fat)

    cheers

  9. #9
    Registered User
    Join Date
    May 2002
    Posts
    317
    So, what exactly does your family do that your worried about shredding the file on the physical level to prevent them from seeing the data. I mean are they all pofessional programmers or mathematicians or some kinda of combination?

    Edit: I mean the most common way to remove something (I'm sure I'm stating the obvious though) is to delete it and then delete it again from the recycling bin. That would take it out reach of an average user who is just snooping.
    Last edited by Traveller; 05-05-2002 at 02:23 PM.

  10. #10
    Registered User
    Join Date
    May 2002
    Posts
    4
    Well, it's not JUST my family, and i want to redistribute it too. And it doesnt matter WHY i just want to do it. And just deleting it through windows is stupid. too easy to recover.

  11. #11
    Registered User
    Join Date
    May 2002
    Posts
    317
    Hey, I'm not trying to be rude or anything. Just I don't think that anyone wants to help if its going to be used for a malicious intent. You originally stated it was so if your family or anyone got ahold of your data they couldn't read it. Now whenyou remove the object from the recycling bin it removes the file name from the FAT thus freeing up the data. So if you do it and then defrag and allow windows to do its dynamic memory thing the filespace will get corrupted and unrecoverable to the normal user.

    Now lostminds has the right idea of doing it by writing to the file randomly using seekp member of the fstream class to randomly change where the put marker in the stream is. Then just delete the file, as previously stated by lostminds.

    Edit: Actually it removes the first letter of the file in the FAT, however it is essentially the same thing.
    Last edited by Traveller; 05-05-2002 at 03:02 PM.

  12. #12
    Registered User
    Join Date
    May 2002
    Posts
    317
    Oh yeah, one more thing. The random feature really isn't random no matter what you do with it. On some mulidimensional plane it actually is quite predictable. Trust me on this, their are ways out their to undo it, and the government owns the majority, if not all, of them.

  13. #13
    Unregistered
    Guest
    Originally posted by Traveller
    Oh yeah, one more thing. The random feature really isn't random no matter what you do with it. On some mulidimensional plane it actually is quite predictable. Trust me on this, their are ways out their to undo it, and the government owns the majority, if not all, of them.
    thats why you use radioactive decay or photon counts as your random seed

  14. #14
    Registered User
    Join Date
    May 2002
    Posts
    317
    Impressive. However everything uses an algorithm........., but alas I don't feel like going too far off topic. Good point however.

  15. #15
    Registered User biosx's Avatar
    Join Date
    Aug 2001
    Posts
    230
    Originally posted by Liam Battle
    you want to make a files contents un useable for good?
    well you can use a random number sort, and change the value of the current char to the current char's value + the randrom number generated... then go onto the next char.

    Its damn easy.. and its almost 100% full proof that the contents that you are changing will be un readable and or just doesnt make sense ever again...
    Whatever man... You do that I will crack it within 20 minutes without a computer.

    Seriously, you guys should learn about encryption and cryptography before you try to start programming an encryption program.

    I think a good first starter would be an implementation of the Vigenere cipher. Another great exercise would be to program the German ADFGVX or Enigma ciphers.

    All of you go to the library and pick up "The Code Book" by Simon Singh before you think about programming an encryption program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  4. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21