Does anyone have an MASM implementation of Twofish?

Started by Shell, September 18, 2007, 05:28:03 AM

Previous topic - Next topic

Shell

Hello all,

I'm trying to create an all-purpose encryption/decryption tool (console mode for now but GUI version may be implemented in the future). So far I've been able to glean code (in MASM32 flavour) for DES/3DES, RC4/RC6, TEA (also looking for xTEA), AES(Rijndael), and BLOWFISH. The only one I'm missing is TWOFISH so if anyone has an MASM implementation of it kindly please point me in the right direction. Bear in mind though that I'm a n00b when it comes to Win32 ASM  :green2

Question - What is Tiger? I've read the term a couple of times when browsing boards regarding Cryptographic algo's but haven't put much thought into it yet - any info on it?

Thanks to all who respond - any input is appreciated  :U

Shell

[edit]
ADDENDUM: I also have various hashing algo's (i.e. SHA-256, MD4/MD5, CRC32 etc.). Does anyone know of any other hashing algo's I should be aware of?
[/edit]

Rockoon

Hashing algorithms..

..there are plenty more than that.

Those are actualy some of the less efficient ones.

My favorite hashing technique is Zobrist, because it can be used to produce a hash of an arbitrary bit width (or an arbitrary number of hash functions) and it has the very nice property that incremental changes to the hash key require only incremental changes to the hash value rather that a full rebuild.

It has some memory overhead tho and that implies bandwidth considerations..
When C++ compilers can be coerced to emit rcl and rcr, I *might* consider using one.

Shell

 :lol Of course there are other hashing algos  :wink Thanks for pointing out Zobrist - I googled it and found a page with all the hash algos I could ask for (for my purposes) except they're all written in C - sigh.

And guess what? I found twofish in MASM - Anybody know who Drizz is  :green2 Thank you.

Eddy

Shell,
Just out of curiosity.. Why would you want to implement so many different encryption algorithms in your application ?
Most users do not know the difference between an RC4, 3DES or AES or whatever .. So why give them the burden of choosing ..?  :bg
If you would select just one industry proven algo like AES, wouldn't that suffice .? (just thinking out loud) ..

Rockoon,
What do you mean by 'hash key' ? A hash algo does not require the use of a key. Or do you mean the hash input data by this ?

Kind regards
Eddy
www.devotechs.com -- HIME : Huge Integer Math and Encryption library--

Rockoon

Quote from: Eddy on September 20, 2007, 07:06:16 AM
Rockoon,
What do you mean by 'hash key' ? A hash algo does not require the use of a key. Or do you mean the hash input data by this ?

Kind regards

General hashing is most often used in associative arrays (aka hash tables, maps, dictionaries, ...), where the input is often called the 'key' .. and this is precisely where a really speedy hash function is often desired.

http://en.wikipedia.org/wiki/Associative_array
When C++ compilers can be coerced to emit rcl and rcr, I *might* consider using one.

Eddy

Quote from: Rockoon on September 20, 2007, 07:50:02 AM
General hashing is most often used in associative arrays
Ah, I see .. When I hear someone talking about hash algorithms, I automatically think of encryption or message authentication applications . In this context, a 'key' has a different meaning than in your context .. :bg
In your context, the 'key' is the hash input data.
Thanks for explaining .

Kind regards
Eddy
www.devotechs.com -- HIME : Huge Integer Math and Encryption library--

Shell

Quote from: Eddy on September 20, 2007, 07:06:16 AM
Shell,
Just out of curiosity.. Why would you want to implement so many different encryption algorithms in your application ?
Most users do not know the difference between an RC4, 3DES or AES or whatever .. So why give them the burden of choosing ..?  :bg
If you would select just one industry proven algo like AES, wouldn't that suffice .? (just thinking out loud) ..

Rockoon,
What do you mean by 'hash key' ? A hash algo does not require the use of a key. Or do you mean the hash input data by this ?

Kind regards

I guess I should've explained why I needed lots of algos  :red

Its because I'm fairly new to win32 ASM that I've decided to  uhm "TEACH" myself by taking on a project that is very interesting to me. Right now I'm kinda fascinated with the mathematical nature of cipher/hash algos (yeah I was one of those fractal spelunkers back in 16-bit DOS and maximum 256 colors on the VGA :cheekygreen: ) Taking as many of those cipher/hashing algos I can find, I intend to create an app (console only for now) and perform some relevant (and some not so) tests on them and saving the results in a file for later perusal. This way I can get a better grip of Win32ASM as opposed to 16-bit ASM and learn file I/O under Win32 (I swear I've never done it before  ::) ).

The reason why I chose a console app is because I wanted to get my hands dirty with some coding experience under this unfamiliar (to me) environment without having to deal with the nitty-gritty stuff involved in GUI apps.

When I'm done with this app, I'll have the added benefit of having all these algos to play around with all over again when it comes time to move on to GUI apps  :wink


@Rockoon,

Thanks again for pointing out Zobrist - I just found out that not only is it fast, the likelihood of collisions is also very low - nice

drizz

Quote from: Shell on September 20, 2007, 05:37:46 AMAnd guess what? I found twofish in MASM - Anybody know who Drizz is  :green2 Thank you.
who is that guy?  :P
anyway that version is incorrect use this

[attachment deleted by admin]
The truth cannot be learned ... it can only be recognized.

Shell

Aplogies for the delayed reponse  :red Too many RL things getting in the way  :toothy

Thanks for the updated version Drizz  :U I was wondering why the other gave me a different result from the C implementation I found elsewhere  :dazzled:

I should have a working testbed (as per my requirements above) ready this weekend.

PS. I found another MASM implementation by WiteG - another member of this board (or so I've been told). So that relieves me from having to port the C version into ASM for a more direct comparison, size/speed-wise  :green

Note: Just to reiterate my point above, I could just as easily compare two implementations of Boyer Moore algo as opposed to encryption algos but what I'm really after is the chance to create something useful (to me) while relearning ASM. It just so happens I'm currently obsessed by encryption. My final goal as my first attempt at a Win32 project is an personal archiver. I've already got the encryption requirement filled thanks to WiteG and Drizz. Now I just have to learn about compression  :cheekygreen: