The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ecube on February 21, 2009, 02:42:09 AM

Title: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 02:42:09 AM
the big number stuff looks really confusing. I wanted a RSA code in a simple static lib that I could call but I can't even find any clean c/c++ rsa implementations that aren't insanley large or overly complex. wish witeg would write something, he's the MASM encryption guru, implemented just about all other encryption algs.
Title: Re: anyone attempt writing RSA in asm?
Post by: donkey on February 21, 2009, 03:35:55 AM
By RSA are you talking about RC6 ? It's patented so you can't use it without a royalty arrangement. I wrote an implementation while it was still being considered for AES but dumped it for Rijndael, free and no license/patent problems. I did exchange a few emails with RSA about using the algorithm but they just stopped responding after I told them I didn't want to pay for it. Pretty sure it's a violation of their patent rights to even post the code now, I posted the Rijndael code in the forum somewhere, in GoAsm format ofcourse ;)
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 03:37:56 AM
no rsa, http://en.wikipedia.org/wiki/RSA the magic that makes ssl etc.. actually secure, private/public key genius.
Title: Re: anyone attempt writing RSA in asm?
Post by: donkey on February 21, 2009, 03:50:19 AM
I think Tola wrote one years ago, you would have to search for it at WinAsm.
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 04:37:57 AM
Thanks but I highly doubt that, tola was asking for rc6 code which I provided to him year or two ago and RSA is a *lot more complex than rc6.


*update
checked the forum and didn't see anything
Title: Re: anyone attempt writing RSA in asm?
Post by: donkey on February 21, 2009, 06:29:37 AM
http://www.asmcommunity.net/board/index.php?topic=21136.0
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 06:32:39 AM
yeah that's rc6 not rsa, think you're still confused about the two.
Title: Re: anyone attempt writing RSA in asm?
Post by: donkey on February 21, 2009, 06:38:34 AM
Quote from: E^cube on February 21, 2009, 06:32:39 AM
yeah that's rc6 not rsa, think you're still confused about the two.

Actually I'm not at all confused, just showing a post nearly 4 years old with Tola's implementation of RC6 in TASM. For RSA, I couldn't find any implementations in ASM though I am pretty sure WiteG has one, I will email him and asked if he's got one kicking around.
Title: Re: anyone attempt writing RSA in asm?
Post by: drizz on February 21, 2009, 08:43:21 AM
You can try my bignum (http://drizz.netsons.org/index.php?option=com_docman&task=cat_view&gid=13&dir=DESC&order=name&Itemid=26&limit=5&limitstart=5) library and see if that suits you. There is also a crypt/hash library that i've written.
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 10:10:18 AM
thanks drizz I have all those algs implemented thanks to witeg and others, I was hoping you had a RSA one, i've been looking for usable rsa code for years. I admittedly aren't smart enough to implement it myself unfortunately.
Title: Re: anyone attempt writing RSA in asm?
Post by: drizz on February 21, 2009, 10:17:08 AM
:eek

Did you even look at the asm example? (bntest1.Asm)
I made the library mainly for RSA.
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 11:34:35 AM
nice :) didn't see that, what block size is the RSA implementation?
Title: Re: anyone attempt writing RSA in asm?
Post by: drizz on February 21, 2009, 11:48:50 AM
Any block size.
invoke bnInit, Max number of bits

There is no "CalculateRSAforME" function, you must calculate it by formula.
Must i point you to your own post link http://en.wikipedia.org/wiki/RSA
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 11:53:24 AM
is this standard compliant? will  it be compadible with another stand compliant implementation of the same size? either way great work, codes beautiful, and honestly I can believe this is real yet, like I said a usable RSA implementation has been a many year quest. If it's real...wow.
Title: Re: anyone attempt writing RSA in asm?
Post by: drizz on February 21, 2009, 12:00:18 PM
Quote from: E^cube on February 21, 2009, 11:53:24 AMis this standard compliant? will  it be compadible with another stand compliant implementation of the same size?
It's math, i have never heard of math being non compliant. There is only data interpretation that might be different "big endian" / "little endian", thats why i have bnFromBytes & bnFromBytesEx, one reads the data without Bswap-ing and the other bswaps data.
Title: Re: anyone attempt writing RSA in asm?
Post by: ecube on February 21, 2009, 12:18:36 PM
I feel like its a trick...it generates even large keys extremely fast.
Title: Re: anyone attempt writing RSA in asm?
Post by: drizz on February 21, 2009, 01:30:34 PM
Actually that's the slowest part since it uses advapi32!CryptGenRandom for random data generation and CryptGenRandom is very slow because it uses sha1 as the generator function, IIRC.
Title: Re: anyone attempt writing RSA in asm?
Post by: PBrennick on February 21, 2009, 01:32:28 PM
E^Cube,
I very much understand your feelings. When you search and search for years for something and suddenly, there it is, it can be a bit overwelming. I have used Drizz's stuff, still do, and he is very dependable. If he says it is 'da bomb,' you can be sure it IS da bomb.  :U

Paul