Avatar of LeighWardle
Flag 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.



* FORTRAN* CryptographyAlgorithms* MD5

Avatar of undefined
Last Comment
Joe Winograd

8/22/2022 - Mon
Joe Winograd

Hi Leigh,

I haven't tested this myself, but I think that the version at Rosetta Code is worth a spin:

Regards, Joe

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
Joe Winograd

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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
David Favor

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)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Joe Winograd

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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.