- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I need a Fortran code that will give me the MD5 hash of a string.
The nearest thing to a solution is 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.
I have stripped out the file processing, but I am stuck with this type conversion issue.
Here is a fragment of the code:
integer(BYTE) :: buffer(BUFLEN)
character*(*) chrStringToBeHashed
Integer intlenStringToBeHashed
Integer j
intlenStringToBeHashed = LEN(chrStringToBeHashed)
do j = 1, intlenStringToBeHashed
! here I am trying to convert one character to buffer(j), which is type integer(BYTE)
buffer(j) = chrStringToBeHashed(j:j)
end do
The issue is how do I convert one character to a variable that is type integer(BYTE)?
I have attached my Project.
Regards,
Leigh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"how do I convert one character to a variable that is type integer(BYTE)?"
The intrinsic function ICHAR will do that. Please look up the description of that function in the Fortran documentation.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"how do I convert one character to a variable that is type integer(BYTE)?"
The intrinsic function ICHAR will do that. Please look up the description of that function in the Fortran documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your help, mecej4.
ICHAR works!
Regards,
Leigh
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page