March 23, 2006
Sean Kelly wrote:
> Regan Heath wrote:
> 
>> You might be interested in some existing crypto work I've done:
>>   http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/
>>
>> The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.
> 
> 
> That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion.
> 
> 
> Sean

I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being?

Should only need support for void[], right?
March 23, 2006
kris wrote:
> Sean Kelly wrote:
>> Regan Heath wrote:
>>
>>> You might be interested in some existing crypto work I've done:
>>>   http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/
>>>
>>> The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.
>>
>>
>> That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion.
> 
> I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being?

Definately.  As I mentioned in my other post, I'd like to have a crypto filter anyway :-)

> Should only need support for void[], right?

Aye.


Sean
March 24, 2006
On Thu, 23 Mar 2006 15:15:03 -0800, kris <foo@bar.com> wrote:
> Sean Kelly wrote:
>> Regan Heath wrote:
>>
>>> You might be interested in some existing crypto work I've done:
>>>   http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/
>>>
>>> The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.
>>   That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion.
>>   Sean
>
> I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being?
>
> Should only need support for void[], right?

(this is essentially a reply to everyone on this thread)

Yes, I believe so.

Kris you're welcome to place the crypto code I wrote into Mango. I believe I put a BSD stlye license on it, let me know if that is a problem.

The interface I used is essentially the same as the std.md5 one in phobos.

It's all done with structs and mixins (which essentially emulates class inheritance). The reason I used structs was to make it easy to copy/store a hash state i.e. you just assign one MD5 to another and it copies the context data. Not sure if that is a good enough reason now, perhaps classes with dup methods would be better.

Essentially there are some basic methods:

  void start();
  void update(void[] input);
  void finish(T digest);
  void sum(T digest, void[] input);

which are mixed into the real implementation.

The idea behind these methods is that you can call "sum" if you have all the data at once (sum calls the other 3, meaning you cannot mix it with calls to the other), or you can call start, then update any number of times, and finally finish. The latter 3 methods make it easy to integrate with a stream, for example.

Each real implementation defines a trasform method in the form:

  void transform(ubyte[] input);

which is called by the mixed methods to process the data, in addition the following methods:

  void padMessage(ubyte[] at);
  void padLength(ubyte[] at, ulong length);

are called to perform the padding, and:

  void extend();

was required to handle MD2 being a little different to the others.

This design pattern and interface works for: MD2, MD4, MD5, SHA0, SHA1, SHA256, SHA512, and Tiger. Does it work for blowfish as well? What does the .NET API look like?

Regan
March 24, 2006
kris wrote:
> Sean Kelly wrote:
>> Regan Heath wrote:
>>
>>> You might be interested in some existing crypto work I've done:
>>>   http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/
>>>
>>> The library "deimos" never really got off the ground, I think it may be tome to salvage what can be salvaged from deimos and put it somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is unsuitable for any reason let me know and I can re-work it.
>>
>>
>> That's a bit past the level of what I've been focusing on, but it's certainly a candidate for eventual inclusion.
>>
>>
>> Sean
> 
> I've seriously considered adding a crypto package to Mango; particularly in support of network-oriented apps (MD4, MD5, SHA1, some SSL support, and so on). Perhaps that might be a reasonable home for the time being?
> 
> Should only need support for void[], right?

As I foresee the eventual oneness of Ares + Mango, sure.
March 24, 2006
Regan Heath wrote:
> On Thu, 23 Mar 2006 15:15:03 -0800, kris <foo@bar.com> wrote:
> 
>> Sean Kelly wrote:
>>
>>> Regan Heath wrote:
>>>
>>>> You might be interested in some existing crypto work I've done:
>>>>   http://svn.dsource.org/projects/deimos/trunk/etc/crypto/hash/
>>>>
>>>> The library "deimos" never really got off the ground, I think it may  be tome to salvage what can be salvaged from deimos and put it  somewhere else, perhaps in "Ares", Shaun? If the crypto stuff is  unsuitable for any reason let me know and I can re-work it.
>>>
>>>   That's a bit past the level of what I've been focusing on, but it's  certainly a candidate for eventual inclusion.
>>>   Sean
>>
>>
>> I've seriously considered adding a crypto package to Mango; particularly  in support of network-oriented apps (MD4, MD5, SHA1, some SSL support,  and so on). Perhaps that might be a reasonable home for the time being?
>>
>> Should only need support for void[], right?
> 
> 
> (this is essentially a reply to everyone on this thread)
> 
> Yes, I believe so.
> 
> Kris you're welcome to place the crypto code I wrote into Mango. I believe  I put a BSD stlye license on it, let me know if that is a problem.
> 
> The interface I used is essentially the same as the std.md5 one in phobos.
> 
> It's all done with structs and mixins (which essentially emulates class  inheritance). The reason I used structs was to make it easy to copy/store  a hash state i.e. you just assign one MD5 to another and it copies the  context data. Not sure if that is a good enough reason now, perhaps  classes with dup methods would be better.
> 
> Essentially there are some basic methods:
> 
>   void start();
>   void update(void[] input);
>   void finish(T digest);
>   void sum(T digest, void[] input);
> 
> which are mixed into the real implementation.
> 
> The idea behind these methods is that you can call "sum" if you have all  the data at once (sum calls the other 3, meaning you cannot mix it with  calls to the other), or you can call start, then update any number of  times, and finally finish. The latter 3 methods make it easy to integrate  with a stream, for example.
> 
> Each real implementation defines a trasform method in the form:
> 
>   void transform(ubyte[] input);
> 
> which is called by the mixed methods to process the data, in addition the  following methods:
> 
>   void padMessage(ubyte[] at);
>   void padLength(ubyte[] at, ulong length);
> 
> are called to perform the padding, and:
> 
>   void extend();
> 
> was required to handle MD2 being a little different to the others.
> 
> This design pattern and interface works for: MD2, MD4, MD5, SHA0, SHA1,  SHA256, SHA512, and Tiger. Does it work for blowfish as well? What does  the .NET API look like?
> 
> Regan

That all sounds great (though I'll admit to being more than a bit leery of D mixins). I'll take a look at the license, and get back to you via the Deimos forum?

- Kris
March 28, 2006
On Thu, 23 Mar 2006 16:20:02 -0800, kris <foo@bar.com> wrote:
> That all sounds great (though I'll admit to being more than a bit leery of D mixins). I'll take a look at the license, and get back to you via the Deimos forum?

I just went ahead and converted my hashing code from the struct+mixin approach to a class+factory approach. The source included in the attached zip file hash.zip is public domain, this includes:

   base.d
   factory.d
   md2.d
   md4.d
   md5.d
   sha0.d
   sha1.d
   sha256.d
   sha512.d
   tiger.d

I would very much like to see my code appear in any library that needs/wants it. It'd be nice to get a mention somewhere too, y'know for my ego n'all.

Regan

March 28, 2006
Regan Heath wrote:
> On Thu, 23 Mar 2006 16:20:02 -0800, kris <foo@bar.com> wrote:
> 
>> That all sounds great (though I'll admit to being more than a bit leery  of D mixins). I'll take a look at the license, and get back to you via  the Deimos forum?
> 
> 
> I just went ahead and converted my hashing code from the struct+mixin  approach to a class+factory approach. The source included in the attached  zip file hash.zip is public domain, this includes:
> 
>   base.d
>   factory.d
>   md2.d
>   md4.d
>   md5.d
>   sha0.d
>   sha1.d
>   sha256.d
>   sha512.d
>   tiger.d
> 
> I would very much like to see my code appear in any library that  needs/wants it. It'd be nice to get a mention somewhere too, y'know for my  ego n'all.
> 
> Regan


Nice! It's now got a home in mango.crypto.*

- Kris
1 2
Next ›   Last »