如下代码,本例中,计算字符串“www.fcode.cn”的MD5值为 “807ED3F7ACD8AA755EE710BB641FA1B2”
Module MD5_Mod
Implicit None
Private umdrehen , leftrotate
contains
Subroutine md5( cStr , h0 , h1 , h2 , h3 )
implicit none
Character(Len=*) , Intent( IN ) :: cStr
Integer , Intent( OUT) :: h0,h1,h2,h3
character( Len=(int(len(cStr)/64)+1)*64 ) :: newString
character( Len=8 ) :: wtmp
integer(kind=4) j,n1,n2,n3,n4,pos
integer(kind=4) r(64),k(64),a,b,c,d,f,g,temp,w(16),i,intLen
integer(kind=8) hoch32
real(kind=8) sinus,absolut,real8i
r = (/7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, &
20 , 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23,&
4 , 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21/)<