Jul 24, 2008

Encrypting A File

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > C/C++ Programming

free web hosting

Encrypting A File

jibnet
Well we all know that encrypting in C is not difficult task since we have access to low level programming.. Now to encrypt a simple text file we can have the following procedure
Just read a single character from a file and then change its value with a valid algorithm and then write it to some other file which wil become the encrypted version of the file.
An Example:
a file has in it the following text "Love". Now all we need to do is get the ascii code for it and then add 7 to it and then write it to the other file. this way the file will get encrypted.
I have a code which encrypts text files into very complicated codes..
If you need the source code then please reply

Reply

vipervoid
Can i see the codes pls? biggrin.gif

Reply

osknockout
Wait... this is encryption? I clicked on the first topic I saw without reading, read the description and thought "Oh, yet another ascii shift."
Seriously, how can that even be called "encryption" anymore? At least have some xor's in there.
Someone can brute-force-check an alphanumeric sequence like that with a dictionary file in a few minutes.
Just by looking at the output of that you can tell it'd follow Zipf's Law. (see here)
Then it'd be a matter of finding out what (sub)language the author's writing this in and then the final ascii-substitute-until-we-find-dictionary-matches algorithm.

Anyway, following that logic...
"Well, we all know that writing an operating system in C is not a very hard task because we can do low-level programming.
Just make a kernel to handle interrupts and with a valid algorithm make sense out of them.
Example: To create a simple kernel we can make a source file that has a main() function with a self-referencing goto.
Or an infinite while loop. Or we can just have it display "hello world!\n" or any other random thing we can think of.
I have a kernel which can do things with interrupts and make lots of different results out of them.
It's at www.kernel.org."

... needless to say, this post's making a strawman that doesn't really mean anything out of a very complex subject.
I know it's a year old, but come on, why is this type of stuff still floating around?

 

 

 


Reply

.hack//GU
if you think some ascii number shifting is too low-leveled encryption, why don't you use some bitwise operation?
like this example:
1001001 >> 2 = 0010010
but remember to store the '01' from the end because if not it will be lost forever.

I haven't made any program with this logic yet, but I guess with more advanced logic it worths some try.

Reply

osknockout
QUOTE
if you think some ascii number shifting is too low-leveled encryption, why don't you use some bitwise operation?
like this example:
1001001 >> 2 = 0010010

Pretty simple. Because bit-shifting like that and storing the extra stuff would require more computation. It's better
off to do a cyclic shift than what you're suggesting.

What I'm saying here is that any one operand instruction is too simple. You can break the stuff into legible messages
faster than it'd take you to write the original message. Of course choosing one possibility out of n combinations would still
be a slight problem (hence why you'd use a dictionary attack in many cases) but still quite fast.

Now I'm not saying that linear bit-shifts and numerical shifts are bad. They're pretty nice actually, when they're used properly.
Simple one operation encoders that can be programmed by total newbies don't count as serious stuff.
I don't like to say that - nor am I trying to be condescending towards newbs, but it's what I've seen.

If I were to try to make an encryption program, I'd probably use cyclic shifts (personal preference), xors, and a lookup table with
prime numbers to start. There, code that properly and I'd start worrying about the security of the program when someone gets
a Cray supercomputer to work on this thing and the Riemann Hypothesis has been proven. Methodwise, we know that nothing
is unbreakable, but it's how long it'd take to break that matters. Since that bit shift would probably have O(n) complexity in encoding
and is reversible without serious caveats (check out the last steps in the encoding of Salsa20 if you care to see examples),
I'd say it'd have O(n) time to decode as well. That's low-level cryptography to me.

Reply

zamaliphe
QUOTE(jibnet @ Jun 5 2006, 09:13 AM) *
Well we all know that encrypting in C is not difficult task since we have access to low level programming.. Now to encrypt a simple text file we can have the following procedure
Just read a single character from a file and then change its value with a valid algorithm and then write it to some other file which wil become the encrypted version of the file.
An Example:
a file has in it the following text "Love". Now all we need to do is get the ascii code for it and then add 7 to it and then write it to the other file. this way the file will get encrypted.
I have a code which encrypts text files into very complicated codes..
If you need the source code then please reply

you know what if all encrypting are SO easy to to crack like this
then hackers dreams became true
what you offers here is not a good encrypting
but it is good training too
if you rely like to do good encrypting
you need to find a library that can do all the work for you
since i didn't tray it i have no recommendation
only hop you find what you are looking for
good luck

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : encrypting, file

  1. File Format Encyclopedia Release 1.00
    (2)
  2. Simple C File Handling In Action
    Small code snipet which covers most of basic file handling and navigat (3)
    Yesterday I suddenly got a lot of work. The same work we try to push off, yes you are right all
    formalities to get the code review incorporated and update all source code files with code review
    headers. Imagine if you need to open 300 files one by one and append code review headers at the
    end. Since most files are reviewed in groups of 20 to 30 files. We require one header to be placed
    in say 20 to 30 files. To simplify I went back to my class assignment days and wrote this small c
    utility to open all files passed on command line and open attach code review headers an....
  3. Local File Time To File Time()
    (0)
    I'm working on sending some certain data to a server. Part of the process in gathering this data
    is done by using GetLocalTime() to get the current local time, this local time must then be
    converted to a FILETIME structure. I'm trying to get this done properly in Python, however my
    problem is that I do not know what my data will look like when the local time is converted to file
    time. I don't have the necessary compiler on my PC to test the code (for reasons I'm not
    going to waste time explaining, my main PC is temporarily unuseable and I'm using a mu....
  4. Storing Bit Values In A File
    (1)
    Hello All, I am developing a utility for zipping and unzipping a file using the Huffman Algorithm.
    The code is implemented using 'C' language. I have finished coding for generating the
    appropriate bit code values for each of the symbols present in file and my next objective is to
    store the bit code values in a seperate file. As you all are aware, the smallest data type that is
    supported by C is the character which is 1 byte. Please can anybody suggest me on how to store the
    bit values generated as codes in a file? Thanks. ....
  5. Reactions To A Busy File
    (2)
    I just wanted to know if let's say you have a file called tempfile.dat and it is being used by
    dozens of parts of a script to transfer data, what happens if both scripts run at the same time and
    use the tempfile? will it throw a text file is busy error or will it patiently wait until a script
    is done using it before it uses it? Because if i send information to the tempfile, then close it,
    then reopen it again to transfer back the information, I don't want the other script to start
    using it in the middle of that sequence or the results will be catastrophic. Any ....
  6. Weird Characters Appending To File
    (2)
    Anytime I open a file and close it without changes, weird characters show up. Here is the code:
    PHP Code: inFile = fopen("serefs.dat","rb"); outFile = fopen("tempfile.dat","wb"); while
    (!feof(inFile)) { char line ; char timeline ; fgets(line,512,inFile);
    strncpy(timeline, line, 10); timeline = '\0'; int filetime;
    filetime = atoi(timeline); if(filetime > (realtime - 86400)) {
    fputs(line,outFile); } } fclose(inFile); fclose(outFile); //Put tempfile in buffe....
  7. Running An Extenal File
    how to (3)
    hi guyz i fairly new to c++ i started readnig a big book but it gonna take me a while to reach the
    last page and i need to do a menu quite fast so could any one of You help me with this
    /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> : i need to know
    whith action will run an external file using the the app assigned to it in the windows shell (sort
    of like the "run" command in used in dos) or a brief source code with a button fireing some file to
    use as a tutorial /rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:"....

    1. Looking for encrypting, file

Searching Video's for encrypting, file
advertisement



Encrypting A File



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE