LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-28-2006, 09:32 AM   #1
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Rep: Reputation: 35
How to add some bytes to a binary file?


Suppose I have an xxx film %) I don't want anyone to watch it.
First, I rename it to, e.g., "abcdefg".
This almost solves the problem under Windows.
But Linux reads first bytes of a file to determine file type. So I need to add some bytes to the beginning of file (certain amount of bytes, say 4) to make it unreadable for players.
How to do this?

Thanks.
 
Old 02-28-2006, 10:15 AM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by kornerr
Suppose I have an xxx film %) I don't want anyone to watch it.
First, I rename it to, e.g., "abcdefg".
This almost solves the problem under Windows.
But Linux reads first bytes of a file to determine file type. So I need to add some bytes to the beginning of file (certain amount of bytes, say 4) to make it unreadable for players.
How to do this?

Thanks.
Why not just encrypt the file/directory using gpg then no one can get to it except the holder of gpg passphrase.
 
Old 02-28-2006, 10:31 AM   #3
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
No, I don't want encryption, it takes some time, while adding bytes should be a job of a second.
Any other ideas?

Thanks.
 
Old 02-28-2006, 10:33 AM   #4
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
dd will do what you want.
 
Old 02-28-2006, 10:45 AM   #5
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by kornerr
No, I don't want encryption, it takes some time, while adding bytes should be a job of a second.
Any other ideas?

Thanks.
Fair enough but any bytes you add can be removed by anyone who knows what they are doing, if it is that important that you do not want anyone to be able to view encryption is the only option.
 
Old 02-28-2006, 10:58 AM   #6
kornerr
Member
 
Registered: Dec 2004
Location: Russia, Siberia, Kemerovo
Distribution: Slackware
Posts: 893

Original Poster
Rep: Reputation: 35
Quote:
dd will do what you want.
Any example of how to add 4 bytes to the beginnig of a file and how to remove 4 bytes from the beginning of a file?

Thanks.

PS:
Quote:
can be removed by anyone who knows
it's only an against-fool protection

Last edited by kornerr; 02-28-2006 at 10:59 AM.
 
Old 02-28-2006, 11:23 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Code:
cat dummy pr0n.avi > Bill.xls
?

I guess I know your second question

hint:man dd
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot execute binary file on a selfx file brucifer Linux - Software 4 03-21-2006 04:44 AM
Automatically tell text file from binary file? Hosiah Linux - Software 3 05-31-2005 05:22 AM
convert text file to binary excel file ust Linux - General 2 11-23-2004 02:33 AM
mounting a binary file thats not on any file system!?!!? aXoneX Linux - General 7 10-26-2004 02:21 AM
Add precompiled binary to a rpm file doris Linux - Software 1 08-06-2004 07:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration