Codec 1.0

Simon Marlow simonmar at microsoft.com
Tue Jan 11 05:35:41 EST 2005


On 10 January 2005 21:26, Dominic Steinitz wrote:

> Thanks for this. I'd forgotten about the document describing the
> hierarchy. The Codec.Utils exports:
> 
> type Octet = Word8
> msb :: Int
> fromTwosComp :: Integral a => [Octet] -> a
> toOctets :: Integral a => a -> a -> [Octet]
> fromOctets :: Num a => a -> [Octet] -> a
> i2osp :: Integral a => Int -> a -> [Octet]
> 
> Thinking about it, i2osp should go in Codec.Encryption.RSA as it's
> specific to RSA.
> 
> I'm not clear about the rest. How about Codec.Integral for toOctets,
> fromOctets and fromTwosComp? I could probably live without Octet
> (although quite a few standards are defined using the term octet) but
> I find myself needing msb (most significant bit) in quite a few
> places. Where would that go?

If these really are general codec utilities, applicable to multiple
codecs, then Codec.Utils is fine.  There's no point trying too hard to
categorise things.

> Whilst on the subject, why is BER in Network? BER is one of many
> encodings for ASN.1 and use of BER is not limited to networks; it is
> used heavily in cryptography, for example, in PKCS#8 and X.509. I'd
> suggest Codec.ASN1.BER, Codec.ASN1.TLV for the functions that take
> octets and turn them into Tags, Lengths and Values and
> Codec.ASN1.ASN1 for real ASN.1 types and functions. 

Ok, I'll add these.  But Codec.ASN1.ASN1 looks a bit strange - why not
just use Codec.ASN1?

> Furthermore, if I follow the hierarchy for the existing cryptography
> library then I would end up with Data.Digest for MD5 and SHA-1. What
> would the package name for these be? Digest? What should the package
> name be for DES, AES, Blowfish and RSA be? Still crypto or Encryption?

You can choose any package names you like, as long as they're unique.
Package names have no relationship to module names.  When Hackage is up
and running, you'll easily be able to find a new unique package name
(for now, just pick one).

Cheers,
	Simon


More information about the Libraries mailing list