Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » MASM Implementation
MASM Implementation [message #7543] Fri, 05 January 2007 12:19 Go to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
I wish to calculate an md5 hash with a MASM module written myself.
How i can use the MASM function ("$ GetMD5 [file(s)]") in u++?

thanks a lot Very Happy

[Updated on: Fri, 05 January 2007 14:03]

Report message to a moderator

Re: MASM Implementation [message #7547 is a reply to message #7543] Fri, 05 January 2007 17:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Gatling_Gun wrote on Fri, 05 January 2007 06:19

I wish to calculate an md5 hash with a MASM module written myself.
How i can use the MASM function ("$ GetMD5 [file(s)]") in u++?

thanks a lot Very Happy


Maybe you shoul check first whether your version is faster than one provided with U++ (in Web package) Wink

U++ does not directly support assembler. But you coould add it as library, as standalone object file or as .asm in package and use custom build step to compile.

Mirek

[Updated on: Fri, 05 January 2007 17:05]

Report message to a moderator

Re: MASM Implementation [message #7548 is a reply to message #7543] Fri, 05 January 2007 18:24 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
Hey thx! Very Happy
I would have to use my asm code for not increment my app size adding a pack... howewer can you explain me where is md5 function in Web pack and how to use it? Surprised
thankyou very much Very Happy !

[Updated on: Fri, 05 January 2007 18:24]

Report message to a moderator

Re: MASM Implementation [message #7549 is a reply to message #7548] Fri, 05 January 2007 18:46 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
Ok Ok maybe I solve it...
I find MD5Digest() function and works correctly but I've two question:

- char hello[6] = "hello";
String Test = MD5Digest(hello,0);

return a strange string without number or char only symbols... I understand that I've to encode it, maybe ascii but how?


- How I can retrieve MD5 hash from a file?


THX A LOT! Very Happy
Re: MASM Implementation [message #7550 is a reply to message #7549] Sat, 06 January 2007 01:59 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
You can use BinHexEncode() for encoding.
Re: MASM Implementation [message #7552 is a reply to message #7549] Sat, 06 January 2007 10:20 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Gatling_Gun wrote on Fri, 05 January 2007 12:46


- How I can retrieve MD5 hash from a file?



AFAIK MD5Digest(LoadFile(myfilepath), 0);

Mirek

[Updated on: Sat, 06 January 2007 10:20]

Report message to a moderator

Re: MASM Implementation [message #7553 is a reply to message #7552] Sat, 06 January 2007 11:22 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
THX GUYS IT'S WORK PERFECTLY!!! Very Happy

hehe Laughing another two things...

I need to show an open file dialog or something similar to retrieve file position

How I can assign a textbox's text to a variable (string)?

Really thx to all and sorry for my U++ gaps Embarassed .

cheers

[Updated on: Sat, 06 January 2007 11:23]

Report message to a moderator

Re: MASM Implementation [message #7554 is a reply to message #7553] Sat, 06 January 2007 11:45 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 693
Registered: December 2005
Location: Budapest, Hungary
Contributor
String s = your_control.GetValue().ToString();
Re: MASM Implementation [message #7555 is a reply to message #7554] Sat, 06 January 2007 11:57 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
Is the same use in an EDITSTRING control "GetText().ToString()"?
Thx!
Re: MASM Implementation [message #7557 is a reply to message #7555] Sat, 06 January 2007 12:28 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
what is the the second parameter in MD5Digest(char,int)?
I see that if I change it from 0 to 16 my hash code change...
Re: MASM Implementation [message #7561 is a reply to message #7557] Sat, 06 January 2007 14:20 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
I use this function:

void MD5::DoBrowse()
{
FileSel fsel;
fsel.AllFilesType();
static String recent_dir;
if(fsel.ExecuteSelectDir())
File_Path <<= recent_dir = ~fsel;
}

where File_Path is a TextBox...

My problem is that return only the directory and not the exe why?
Can you fix it for me?

thx Surprised
Re: MASM Implementation [message #7562 is a reply to message #7561] Sat, 06 January 2007 14:22 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Gatling_Gun wrote on Sat, 06 January 2007 08:20


if(fsel.ExecuteSelectDir())
File_Path <<= recent_dir = ~fsel;
}

where File_Path is a TextBox...

My problem is that return only the directory and not the exe why?
Can you fix it for me?

thx Surprised


ExecuteSelectDir is for selecting directory. Use ExecuteOpen to select file.

Mirek
Re: MASM Implementation [message #7563 is a reply to message #7555] Sat, 06 January 2007 14:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Gatling_Gun wrote on Sat, 06 January 2007 05:57

Is the same use in an EDITSTRING control "GetText().ToString()"?
Thx!


Usually, the best method is to use operator~, which is equivalent to calling GetData.

String s = ~myeditfield.

Of course, type stored in widget has to match (int x = ~myeditstring; is runtime error).

Mirek
Re: MASM Implementation [message #7564 is a reply to message #7563] Sat, 06 January 2007 14:28 Go to previous messageGo to next message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
Thx, I solve all... but
can you explain me what is the second parameter in MD5Digest()?

thx for your patience!
Re: MASM Implementation [message #7565 is a reply to message #7564] Sat, 06 January 2007 14:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Gatling_Gun wrote on Sat, 06 January 2007 08:28

Thx, I solve all... but
can you explain me what is the second parameter in MD5Digest()?

thx for your patience!


String        MD5Digest(const char *text, int length);
inline String MD5Digest(String s)                 { return MD5Digest(s.Begin(), s.GetLength()); }


If still unclear:

There are two versions - first one is for raw binary data, second one is for String. If used with binary data, you have to supply how much data is there. String has this information inside.

OK, now the somewhat confusing part is that String can be constructed from (zero terminated) const char * and converts to (zero terminated) const char *....

Anyway, the simple thing to do is to avoid second parameter.

Mirek
Re: MASM Implementation [message #7569 is a reply to message #7565] Sat, 06 January 2007 18:15 Go to previous message
Gatling_Gun is currently offline  Gatling_Gun
Messages: 13
Registered: January 2007
Promising Member
Tanks I solve it simple avoiding that parameter...

Thanks to all guys! Surprised
Previous Topic: Multiline text display
Next Topic: Chip 8 Emulator
Goto Forum:
  


Current Time: Thu Mar 28 22:41:50 CET 2024

Total time taken to generate the page: 0.01954 seconds