[Ironruby-core] digest.so implemented

Wayne Kelly w.kelly at qut.edu.au
Thu Feb 28 18:51:30 EST 2008


> -----Original Message-----
> From: ironruby-core-bounces at rubyforge.org
> [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of
> Sanghyeon Seo
> Sent: Thursday, 28 February 2008 5:51 PM
> To: ironruby-core at rubyforge.org
> Subject: Re: [Ironruby-core] digest.so implemented
>
> This implementation appends all strings hashed to the buffer.
> Which means, if you hash 100 MB file, each megabyte
> incrementally, 100 MB MutableString is allocated. This is
> unnecessary, and can be avoided by using TransformBlock.

Hi Seo,

Thanks for raising this. I was aware of the performance issue and my original implementation did use the TransformBlock method, but I switched to an explicit buffer approach in order to support cloning of digest objects. I didn't think/realize it was possible to clone .NET Crypto objects.

I see you use the MemberwiseClone method. Firstly, I thought this was a protected member, how are you able to directly call it on your context objects? Secondly, is the shallow copy that MemberwiseClone performs going to give us the correct cloning semantics?

P.S. I notice your module is implemented in Python - I hadn't even contemplated the idea of implementing these libraries in Ruby - I guess because I'm a C# developer. Do people think we should rewrite these extension libraries in Ruby?

Cheers, Wayne.


More information about the Ironruby-core mailing list