Codec 1.0

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Tue Jan 11 15:59:07 EST 2005


On Tuesday 11 Jan 2005 10:35 am, Simon Marlow wrote:
> 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.

OK, with the exception of i2osp, I'll leave them in Codec.Utils

>
> > 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?

Agreed.

>
> > 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).
>

As an interim proposal, how about I put 

Data.LargeWord
Data.Digest.MD5
Data.Digest.SHA-1
Codec.Encryption.RSA
Codec.Encryption.RSA.EMEOAEP
Codec.Encryption.RSA.MGF
Codec.Encryption.RSA.NumberTheory
Codec.Encryption.DES
Codec.Encryption.AES
Codec.Encryption.Blowfish
Codec.Encryption.Modes
Codec.Encryption.Padding
Codec.Encryption.PKCS8
Codec.Encryption.X509
Codec.ASN1
Codec.ASN1.BER
Codec.ASN1.TLV
Codec.Utils

into a package called Crypto?

Dominic.



More information about the Libraries mailing list