home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / dcom / modems / 11008 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  1.4 KB

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