Link to home
Start Free TrialLog in
Avatar of LeighWardle
LeighWardleFlag for Australia

asked on

Fortran code for MD5 hash of a string

Hi Experts,


I am looking for a Fortran implementation that will give me the MD5 hash of a string.


I have found one example, but it does not always give the correct answers.



Regards,

Leigh



Avatar of Joe Winograd
Joe Winograd
Flag of United States of America image

Hi Leigh,

I haven't tested this myself, but I think that the version at Rosetta Code is worth a spin:
https://rosettacode.org/wiki/MD5

Regards, Joe
Avatar of LeighWardle

ASKER

Hi Joe,

I have compiled the code from https://rosettacode.org/wiki/MD5 

It appears to process a bunch of files defined via command-line arguments.

I have tried running it with one file, but it throws an unhandled exception.

Right now my head is too woolly to explore how to adapt it to a single string.

Regards, Leigh
Hi Leigh,
My head is probably woolier than yours at 3:15am here. :) Even after a good night's sleep, I doubt that I can help, as it has been years since I did any serious coding in Fortran. Cheers, Joe
Simple solution is to take the Windows Fortran code, then port it to your Fortran compiler.
I have am 99% of the way through adapting the Rosetta Code to just handle a single string.

But I am stuck on a type conversion issue.

Not sure if it's ethical to mention my post on another forum, but here goes:

How to convert one character to a variable that is type integer(BYTE)
ASKER CERTIFIED SOLUTION
Avatar of LeighWardle
LeighWardle
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I managed to adapt the Rosetta Code to just handle a single string.
Great news! I'm glad that my suggestion of Rosetta Code worked as a starting point for you. Regards, Joe