home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!apple!apple!netcomsv!mork!jgro
- From: jgro@netcom.com (Jeremy G)
- Newsgroups: comp.dcom.modems
- Subject: Re: ASN.1 (X.409)
- Message-ID: <tkgm32k.jgro@netcom.com>
- Date: 23 Jul 92 08:30:45 GMT
- References: <1581.212.uupcb@yob.sccsi.com> <5801.2a6c2513@hayes.com>
- Organization: Not that I'm aware of :-)
- Lines: 24
-
- In article <5801.2a6c2513@hayes.com> tnixon@hayes.com writes:
- >> Does anyone here know anything about Abstract Syntax Notation 1, as
- >> defined in CCITT X.409? What I'd like to know is how to encode an
- >> integer which doesn't fit into a single byte (e.g. 12345): is it
- >> 02 02 30 39, or is it 02 02 39 30 ?
- >
- >The first encoded byte is always the high-order byte, so it would be
- >"02 02 30 39". If the high-order byte would be 00 or FF, it should
- >be omitted to insure encoding in the smallest possible number of
- >octets.
-
- This is not exactly correct. The high order octet may still be needed
- to preserve the sign. A leading 00 is omitted if and only if the MSB
- of the next octet is 0, FF is omitted if and only if the MSB of the
- next octet is 1. Trivial examples:
-
- 00 FF (255) is not the same as FF (-1), but 00 7F (127) is the same as 7F.
- FF 00 (-256) is not the same as 00, but FF 80 (-128) is the same as 80.
-
-
-
- --
- Jeremy G Commited to developing user-friendly products,
- jgro@netcom.com Because technology is supposed to make life easier
-