VB icon

Better, Simpler, Flip-Flop "encryption"

Email
Submitted on: 1/2/2015 3:05:00 PM
By: Miah! (from psc cd)  
Level: Intermediate
User Rating: By 6 Users
Compatibility: C++ (general), Microsoft Visual C++
Views: 993
 
     It reads the binary of a file, and outputs it in reverse so the new "encrypted" file can't be normally read. To decrypt encode the new file and it will be reversed again, restoring it back to normal. Its pretty handy, and simple, please rate this code.
 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :Better, Simpler,Flip-Flop "encryption"
//**************************************
#include <stdio.h>
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Better, Simpler,Flip-Flop "encryption"
// Description:It reads the binary of a file, and outputs it in reverse so the new "encrypted" file can't be normally read. To decrypt encode the new file and it will be reversed again, restoring it back to normal. Its pretty handy, and simple, please rate this code.
// By: Miah! (from psc cd)
//**************************************

/*
Backwerdz version 1.00 by Miah.
It takes a file, reads it from back to front, 
and outputs it to a new backwards file that
can't be read normally.
Simple enough...
On with the code!
*/
#include <stdio.h>
main()
{
	char fileIn[30], fileOut[30];
	char byteBuff[1];
	int x=-1, Fsize;
	printf("\t\t\tMiah's Backwerdz file encoder\n");
	printf("\n\nEnter Filename to Encode/Decode: ");
		scanf("%s",fileIn);
	printf("\nEnter name to output file as: ");
		scanf("%s",fileOut);
FILE *in, *out;
	
	in = fopen(fileIn, "rb"); //Need that "b" so it can read binary too!
 
	out = fopen(fileOut, "wb"); //And write it..
fseek(in, 0, SEEK_END);
Fsize = ftell(in);//This fTells us the size of the file by going to the end
 // and reading what the number of the last byte is
	
fseek(in, -1, SEEK_END); //We seek a negative one (-1) from our position at the 
									 //end of the file so we read it backwards
do
{ 
	
fseek(in, x, SEEK_END); 
	fread(&byteBuff,1,1,in); //read and write at the same time 
	fwrite(&byteBuff,1,1,out);
x--; //Continue to countdown
Fsize--; //Decrease size count so we can 
}while(Fsize > 0); //Break the loop when it reaches zero
fclose(in); //Close It!
fclose(out);
return 0;
}


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.