flat assembler
Message board for the users of flat assembler.

Index > Windows > Any MD5 code examples (as used in ssl)?

Author
Thread Post new topic Reply to topic
thomashandersen



Joined: 09 Dec 2012
Posts: 1
thomashandersen
interest to realise some code, which genereate md5 hash from byte array, but can't find any example. also, there is no header files for md5 functions. on C lang i just can include "openssl/md5.h", need the same thing for flat assembler. ty.
Post 09 Dec 2012, 14:39
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
FreshLib has md5lib.asm.
Post 09 Dec 2012, 15:57
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
JohnFound, I have to give you my hats off at what you've accomplished.

How long has it taken you to finish FreshLib?
Post 09 Dec 2012, 16:34
View user's profile Send private message Reply with quote
clamicun



Joined: 04 Dec 2013
Posts: 77
Location: Muenster NRW Germany
clamicun
On December 09/2012 thomashandersen

asked this in the fasm forum:

"
Any MD5 code examples (as used in ssl)?
interest to realise some code, which genereate md5 hash from byte array, but can't find any example. also, there is no header files for md5 functions. on C lang i just can include "openssl/md5.h", need the same thing for flat assembler. ty.
"

Answer of JohnFound
"
FreshLib has md5lib.asm.
"

Yes there it is.

But how to include this in an application ?

module "MD5 library" ;gives an error - illegal instruction

struct TContextMD5 ;same error
.__cntx rb 88
.value rb 16
ends
"
"

How to compile this ?
Post 14 Jun 2014, 15:16
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
clamicun,

When in doubt, RTFM.
Post 15 Jun 2014, 01:51
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
clamicun wrote:
How to compile this ?


1. You can, as baldr already suggested, use FreshLib for your application. It has tons of useful functions, but will include only what you are using.

2. You can with a little effort adapt the code for your own library/code. It uses only 2..3 functions for dynamic memory allocation and for string processing. (The description of these functions is in the reference manual, but you can ask if something is not clear).

Notice: The source repository is moved to a new host: Fresh IDE main repository

The mentioned library is: md5lib.asm

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 15 Jun 2014, 19:33
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
clamicun



Joined: 04 Dec 2013
Posts: 77
Location: Muenster NRW Germany
clamicun
Yes thank you baldr and JohnFound.
I read TFM
Post 22 Jun 2014, 11:57
View user's profile Send private message Reply with quote
clamicun



Joined: 04 Dec 2013
Posts: 77
Location: Muenster NRW Germany
clamicun
include '%finc%\win32\win32a.inc'
include "%lib%\freshlib.asm"

"
"
call DataMD5
"
"
-----
OK fellers,I give up working with fresh IDE. It might be the best thing in the world, but it is at least not very "userfriendly".
I spent hours to call DataMD5 and it always gives me

"undefined symbol" or "already defined symbol".

e.g.

invoke HeapAlloc, [_hHeap], HEAP_ZERO_MEMORY, [.size]
undefined symbol _hHeap.
---------------------
I am back to FASM
Post 25 Jun 2014, 16:16
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
The FreshLib base template is very simple. You don't need to include any other library include files. See the simple example:
Code:
include "%lib%/freshlib.inc"

@BinaryType console

include "%lib%/freshlib.asm"

start:
        InitializeAll

        stdcall StrDup, 'This is simple example.'

        stdcall StrMD5, eax

        stdcall FileWriteString, [STDOUT], eax
        stdcall FileReadLine, [STDIN]

        FinalizeAll
        stdcall Terminate, 0
    


Here I use StrMD5, but DataMD5 is accessible as well. Notice also, that the above example can be compiled for Linux or for Windows, depending on %TargetOS% environment variable ('Win32' or 'Linux').
Post 25 Jun 2014, 17:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.