Encrypting Binary

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Encrypting Binary

 
0
  #1
Jun 3rd, 2009
Is it possible to open a file in binary mode and make an array out of it then to encrypt that information. I guess I should ask how you would start something like that? Thanks
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: Encrypting Binary

 
0
  #2
Jun 3rd, 2009
Well your question is not quite clear but you can always use fopen command with :
“rb” Open a binary file for reading
“wb” Create a binary file for writing
“ab” Append to a binary file
“rb+“ Open a binary file for read/write
“wb+“ Create a binary file for read/write
“ab+“ Open a binary file for read/write

as modes to manipulate it.For more info try this.
I Surf in "C"....
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 111
Reputation: clutchkiller is an unknown quantity at this point 
Solved Threads: 1
clutchkiller's Avatar
clutchkiller clutchkiller is offline Offline
Junior Poster

Re: Encrypting Binary

 
0
  #3
Jun 4th, 2009
This helps, but to clarify, instead of taking a string of charecters from a text file and throwing them into an array, is it possible to take that same concept but do it with binary? Thanks
>That confuses me =(
Get used to it. Good programmers are in a constant state of confusion.
>Looks like i have some quasi specifics to investigate! Up Up And AWAY!
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 476
Reputation: csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice csurfer is just really nice 
Solved Threads: 76
csurfer's Avatar
csurfer csurfer is offline Offline
Posting Pro in Training

Re: Encrypting Binary

 
0
  #4
Jun 4th, 2009
Well if you are using linux then you can always use the meta-characters and the od command to your requirements.Check these out <1> <2>
I Surf in "C"....
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: Encrypting Binary

 
-1
  #5
Jun 4th, 2009
Yes, of course it can be done. Same as text.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 792
Reputation: siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of siddhant3s has much to be proud of 
Solved Threads: 135
siddhant3s's Avatar
siddhant3s siddhant3s is online now Online
Master Poster

Re: Encrypting Binary

 
0
  #6
Jun 4th, 2009
>This helps, but to clarify, instead of taking a string of charecters from a text file and throwing
>them into an array, is it possible to take that same concept but do it with binary? Thanks

Yes, but don't expect that you would be able to display them. A binary file is a stream of unformatted character. That is, it is raw and does not follow ASCII standards. Hence your terminal won't be able to display it. But it sure can be dumped into a char array.
  1. fstream f("asdf.dat");
  2. char* arr=new char[ sizeof file];
  3. f.read(reinterpret_cast<char*>(arr), size of file);
Last edited by siddhant3s; Jun 4th, 2009 at 1:01 am.
Siddhant Sanyam
(Not posting much)
Migrate to Standard C++ :When to tell your C++ Code is Non-Standard.
Please Read before posting: How To Ask Questions The Smart Way
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 2,001
Reputation: ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of ArkM has much to be proud of 
Solved Threads: 343
ArkM's Avatar
ArkM ArkM is offline Offline
Postaholic

Re: Encrypting Binary

 
0
  #7
Jun 4th, 2009
  1. char* arr = new char[...];
  2. f.read(reinterpret_cast<char*>(arr), ...
Why reinterpret_cast?..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC