Home > Archive > PERL Beginners > October 2006 > Parsing of HEX bytes using PErl
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Parsing of HEX bytes using PErl
|
|
| Dharshana Eswaran 2006-10-30, 7:03 pm |
| Hi all,
I am a student working on a project using Perl.
My work is...
I have few hex bytes as inputs for my program. Its a series of hex bytes.
for eg: 01 0a ab 2a 1c etc...
Here each byte stands for some representation. I also have a data file in
which all the representations are stored. For eg:
01 => "abcd"
02 => "ertg"
1c => "srfrf"
etc...
I have to parse the input hex bytes using this data file and the output
should show the parsed input series.
The problem i face in linear search id, there are few hex bytes in which the
digits are same but the representations are different. For eg: 01 stands for
"abcd" and also in some other place it stands for "cdfv" also.
My program follows ASN.1 format. I mean The bytes come in a fashion like
TYPE and then LENGTH and then VALUE..
So i have to parse in teh above mentioned manner.
I am unable to come up with an algorithm for the same as i am very new to
Perl programming.
Also, the data files are very huge and input also is very huge file in which
there are several hex bytes.
So plz can anyone help me in this?
| |
| lionet1@gmail.com 2006-10-30, 7:03 pm |
| > My program follows ASN.1 format. I mean The bytes come in a fashion like
> TYPE and then LENGTH and then VALUE..
>
> So i have to parse in teh above mentioned manner.
>
> I am unable to come up with an algorithm for the same as i am very new to
> Perl programming.
>
> Also, the data files are very huge and input also is very huge file in which
> there are several hex bytes.
>
> So plz can anyone help me in this?
Why won't you use a specialized ASN.1 compiler which would
produce a set of codecs to encode and decode arbitrary ASN.1
data?
--
vlm
| |
| John W. Krahn 2006-10-30, 7:03 pm |
| Dharshana Eswaran wrote:
> Hi all,
Hello,
> I am a student working on a project using Perl.
>
> My work is...
>
> I have few hex bytes as inputs for my program. Its a series of hex bytes.
> for eg: 01 0a ab 2a 1c etc...
Do you mean bytes, or hexidecimal strings?
> Here each byte stands for some representation. I also have a data file in
> which all the representations are stored. For eg:
> 01 => "abcd"
> 02 => "ertg"
> 1c => "srfrf"
> etc...
>
> I have to parse the input hex bytes using this data file and the output
> should show the parsed input series.
>
> The problem i face in linear search id, there are few hex bytes in which
> the digits are same but the representations are different. For eg: 01
> stands for "abcd" and also in some other place it stands for "cdfv" also.
How do you determine when 01 changes from "abcd" to "cdfv"?
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
|
|
|
|
|