473,498 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: file signature


"Bill Cunningham" <no****@nspam.invalidwrites:
I can't use stdc to write a file signature for a file format can I?
Wouldn't I have to get into the sys calls and maybe even kernel internals to
do this with lynx. I am going to write a parser soon. But I want to parser
to have a unique signature in it's header somewhere. 0x7f is I believe the
signature for linux. I will write a 128 unique number generator in C with
linux to get the number so it will not conflict with other file types like
adobe's .pdf and so on. Can anyone suggest any source code to create a file
signature and what else I might need to do?

Bill
By stdc do you mean "standard c" Bill?

I think you should ask in c.l.c : they are always willing to help people
with their parsers and 128 unique number generators there!

Enjoy!

9/10

Crosspost & Followup-To: comp.lang.c

(ps not bad - almost as good as the one where you were telling the lads
in linux development how you were about to write a device driver!)
Sep 25 '08 #1
8 3482
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
"Bill Cunningham" <nos...@nspam.invalidwrites:
* * I can't use stdc to write a file signature for a file format can I?
what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.

Windows: use the file extension
old Mac OS: stick something in the resource fork of the file
(yes you would need "kernel" calls for that!)
unix: uses something called "magic" which is essentially
stuff at the front of the file
Wouldn't I have to get into the sys calls and maybe even kernel internals to
do this with lynx.
lynx?
wiki: "The LynxOS RTOS is a Unix-like real-time operating system from
LynuxWorks (formerly "Lynx Real-Time Systems"). Sometimes known as the
Lynx Operating System, LynxOS features full POSIX conformance and,
more recently,
Linux compatibility. LynxOS is mostly used in real-time embedded
systems, in applications for avionics, aerospace, the military,
industrial process
control and telecommunications."

I bet you didn't mean that
I am going to write a parser soon.
<giggle>
But I want to parser
to have a unique signature in it's header somewhere. 0x7f is I believe the
signature for linux.
no
I will write a 128 unique number generator in C with
linux to get the number so it will not conflict with other file types like
adobe's .pdf and so on. Can anyone suggest any source code to create a file
signature and what else I might need to do?
the simplest think to do on Unix-like system is to put
some fairly simple text on the first line and hide it
in a comment. Suppose I was posting something that used ;
as a comment I could tag my file like this

;!/bin/nil

The perl programming langauge often tags its programs with

#!/opt/perl5/perl

the ! sequence tells the shell (the Operating System in effect)
where to find the correct reader for that file type. Ask on a Unix ng
for details.
--
Nick Keighley
Sep 25 '08 #2
Nick Keighley <ni******************@hotmail.comwrites:
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
>"Bill Cunningham" <nos...@nspam.invalidwrites:
Â* Â* I can't use stdc to write a file signature for a file format can I?

what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.
You did notice that I somewhat mischievously cross posted this from the
linux application development group didn't you?
>
I am going to write a parser soon.

<giggle>
And that's why ....
Sep 25 '08 #3
Nick Keighley said:
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
>"Bill Cunningham" <nos...@nspam.invalidwrites:
I can't use stdc to write a file signature for a file format can I?

what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.

Windows: use the file extension
No, don't do that.

I once had to write a program that could tell the difference between PDF
files and PDF files, because Adobe's johnny-come-lately "Portable Document
Format" extension clashed horribly with a venerable and ancient vendor's
"Program Description File" extension. The customer organisation then
issued my program as the "official" PDF association, and my program
performed the relevant action for dealing with the PDF (either starting
the relevant application or aborting if the file format were not
recognised), depending on whether it was a PDF, a PDF, or of course a PDF.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 25 '08 #4

"Nick Keighley" <ni******************@hotmail.comwrote in message
news:e5**********************************@y21g2000 hsf.googlegroups.com...
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
"Bill Cunningham" <nos...@nspam.invalidwrites:
I can't use stdc to write a file signature for a file format can I?
what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.

I believe I want to insert a magic number in an ELF header. Did I post
this here? I remember comp.prog and col groups I posted it. This is here by
mistake.

Bill
Sep 25 '08 #5
"Bill Cunningham" <no****@nspam.invalidwrites:
"Nick Keighley" <ni******************@hotmail.comwrote in message
news:e5**********************************@y21g2000 hsf.googlegroups.com...
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
"Bill Cunningham" <nos...@nspam.invalidwrites:
I can't use stdc to write a file signature for a file format can I?
what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.

I believe I want to insert a magic number in an ELF header. Did I post
this here? I remember comp.prog and col groups I posted it. This is here by
mistake.
You posted in comp.os.linux.development.system. This is here because
Richard Nolastname deliberately cross-posted and redirected followups
to comp.lang.c.

But as long as it's here, judging by the way you've struggled with the
most elementary C programs, I suspect what you're attempting is beyond
your abilities.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 25 '08 #6

"Keith Thompson" <ks***@mib.orgwrote in message
news:ln************@nuthaus.mib.org...
But as long as it's here, judging by the way you've struggled with the
most elementary C programs, I suspect what you're attempting is beyond
your abilities.
Your quite probably right. I know you are without some kind of tutorial.
elf.h used data types called uint_t for unsigned ints. I hope it is
understood what I am wanting to attempt.

Bill
Sep 26 '08 #7
On 25 Sep, 16:53, Richard Heathfield <r...@see.sig.invalidwrote:
Nick Keighleysaid:
On 25 Sep, 01:56, Richard<rgr...@gmail.comwrote:
"Bill Cunningham" <nos...@nspam.invalidwrites:
I can't use stdc to write a file signature for a file format can I?
what's a file signature? Do you want a way of deducing the file type
by reading some sort of meta-data? comp.programming is probably
the place to go. This sort of file signature stuff is highly OS
dependent.
Windows: use the file extension

No, don't do that.
I rather meant- that was often what happened. I'm not particularly
fond of it.

--
Nick Keighley
Sep 26 '08 #8
"Bill Cunningham" <no****@nspam.invalidwrites:
"Keith Thompson" <ks***@mib.orgwrote in message
news:ln************@nuthaus.mib.org...
>But as long as it's here, judging by the way you've struggled with the
most elementary C programs, I suspect what you're attempting is beyond
your abilities.

Your quite probably right. I know you are without some kind of tutorial.
elf.h used data types called uint_t for unsigned ints.
No, elf.h (at least on my system) doesn't use anything called uint_t.
It does use uint16_t, uint32_t, and uint64_t, all of which are
declared in the standard header <stdint.h>.
I hope it is
understood what I am wanting to attempt.
I have no idea what you're attempting.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Sep 26 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2078
by: Gilles Lenfant | last post by:
Hi, I'm totally newbie in the signature stuffs. I got a text file stuff.txt and a (said PKCS7) signature file sign.txt that looks like this... "3080020101310b300906052b0e03021a050030800..."...
2
1901
by: anabell | last post by:
Hi, I'm trying to localize to Chinese language. In the pot file header, there appears: "POT-Creation-Date: Thu Oct 16 17:07:14 2003\n" "PO-Revision-Date: 2003-10-16 HO:MI+ZONE\n"...
2
4056
by: Enrique | last post by:
hello all! i´m working with big size files, to maintain them, it would be better to compress the files. to recover a little part of the big file, how can i extract that little parte instead of...
3
2064
by: Ajay | last post by:
hi! How do i create and stream a file? On a webpage i have a link to a file. Next to it i would like link, which, when pressed, runs a script that calculates the signature of the file, pickles...
3
1439
by: wschaub | last post by:
We need to inject information (i.e. server details from where a signed file was downloaded) into a signed file, without breaking the signature or integrity of a signed file. Apparently there are...
3
1481
by: tomislav.vujnovac | last post by:
I need to generate xml file with data from ms sql server. That xml is used in some third party java program. That program need xml file that is saved as "windows-1250" but in first line is: "<?xml...
1
3197
by: lenniekuah | last post by:
I have written a VB6 program extracting Customers Name and address from a table to incorporate it into a letter and output it to MS WORDS. At the bottom of the letter I tried to insert a digitised...
3
3658
by: Andy Baker | last post by:
I have a utility that captures a signature on a handheld device and stores it as as string containing a series of points. I want to recreate this signature as a bmp file using VB.NET code. To do...
7
11763
by: ianenis.tiryaki | last post by:
well i got this assignment which i dont even have a clue what i am supposed to do. it is about reading me data from the file and load them into a parallel array here is the question: Step (1) ...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.