RSA implementation performance


#1

Hi Jules!

I’ve been trying out your RSA class. I love it for its simplicity, but I see some performance problems with it.
I’ve been timing it and compared it to other implementations I’ve got and I can see a huge difference.

The timing ratio between encryption/decryption is to be expected, but other than that, my “old code” still
performs about 100 times quicker, and that’s significant.

I get the feeling your class is build for compactness, not for speed. Could you please comment on this? perhaps
I’m actually not using your class correctly!?

Thank you!

/Michael


#2

Yes, it’s definitely written for simplicity, not speed!

I only set-out to create a simple implementation to handle small amounts of data, e.g. software unlocking keys, etc., and didn’t want to risk breaking it by trying to optimise it more heavily. I suspect that most of the slowness will come out of the fact that it uses generic BigInteger objects for its maths operations, rather than more task-specific structures and algorithms.


#3

[quote=“jules”]Yes, it’s definitely written for simplicity, not speed!

I only set-out to create a simple implementation to handle small amounts of data, e.g. software unlocking keys, etc., and didn’t want to risk breaking it by trying to optimise it more heavily. I suspect that most of the slowness will come out of the fact that it uses generic BigInteger objects for its maths operations, rather than more task-specific structures and algorithms.[/quote]
Thanks for the info. That’s what I thought. For these kinds of tasks the speed is probably not an issue at all.


#4

Maybe look here for RSA:

http://www.cryptopp.com/

Not sure about the performance but its been around for quite a while.


#5

[quote=“jules”]Yes, it’s definitely written for simplicity, not speed!

I only set-out to create a simple implementation to handle small amounts of data, e.g. software unlocking keys, etc., and didn’t want to risk breaking it by trying to optimise it more heavily.[/quote]

I use the RSA code in Juce for this, and it works great.

Sean Costello