Bitnot[w_]:=FromDigits[1-IntegerDigits[w,2,32],2]

Bitrotate[w_,n_]:=FromDigits[RotateLeft[IntegerDigits[w,2,32],n],2]

EndianSwap[x_]:=FromDigits[Reverse[IntegerDigits[x,256]],256]

Pad[x_]:=
Block[{bits=Flatten[IntegerDigits[x,2,8]]},
Block[{len=Length[bits]},
AppendTo[bits,1];
AppendTo[bits,ConstantArray[0,Mod[448-(len+1),512]]];
AppendTo[bits,Flatten[Map[Reverse[Partition[#,8]]&,Reverse[Partition[IntegerDigits[len,2,64],32]]]]];
Map[FromDigits[#,2]&,Partition[Flatten[bits],8]]
]
]

input=ToCharacterCode["The quick brown fox jumps over the lazy dog"];

input//Map[{FromCharacterCode[#],#}&,#]&//Partition[#,8,8,{1,1},{}]&//TableForm

input//Map[{FromCharacterCode[#],#}&,#]&//Map[{#[[1]],IntegerString[#[[2]],16,2]}&,#]&//Partition[#,8,8,{1,1},{}]&//TableForm

input//Map[{FromCharacterCode[#],#}&,#]&//Map[{#[[1]],IntegerString[#[[2]],2,8]}&,#]&//Partition[#,8,8,{1,1},{}]&//TableForm

test=Pad[input];

test//Partition[#,8,8,{1,1},{}]&//IntegerString[#,2,8]&//TableForm

test//Partition[#,8,8,{1,1},{}]&//IntegerString[#,16,2]&//TableForm

IV=Map[FromDigits[#,16]&,{"67452301","EFCDAB89","98BADCFE","10325476"}]

Block[{w=Map[FromDigits[#,256]&,Partition[test,4]]},w]//IntegerString[#,16,8]&//Partition[#,8,8,{1,1},{}]&//TableForm

CompressionFunction[x_,h_]:=
Block[{w=Map[FromDigits[#,256]&,Map[Reverse[#]&,Partition[x,4]]],result},
Block[{a=h[[1]],b=h[[2]],c=h[[3]],d=h[[4]],f,j,k,s,temp},
For[i=1,i≤48,i++,
If[1≤i&&i≤16,
f=BitOr[BitAnd[b,c],BitAnd[Bitnot[b],d]];
s={3,7,11,19}[[Mod[i,4,1]]];
k=0;
j=i;
];
If[17≤i&&i≤32,
f=BitOr[BitAnd[b,c],BitAnd[b,d],BitAnd[c,d]];
s={3,5,9,13}[[Mod[i,4,1]]];
k=FromDigits["5A827999",16];
j={1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16}[[i-16]];
];
If[33≤i&&i≤48,
f=BitXor[b,c,d];
s={3,9,11,15}[[Mod[i,4,1]]];
k=FromDigits["6ED9EBA1",16];
j={1,9,5,13,3,11,7,15,2,10,6,14,4,12,8,16}[[i-32]];
];
temp=Bitrotate[Mod[a+f+w[[j]]+k,(2^32)],s];
a=d;
d=c;
c=b;
b=temp;
];
result=Mod[h+{a,b,c,d},(2^32)];
];
result
]

CompressionFunction[test,IV]

BaseForm[IV,16]

BaseForm[Map[EndianSwap,CompressionFunction[test,IV]],16]

CompressionFunctionView[x_,h_,base_]:=
Block[{w=Map[FromDigits[#,256]&,Map[Reverse[#]&,Partition[x,4]]],result,state={{"i","a","b","c","d","f","j","k","s","w","temp"}}},
Block[{a=h[[1]],b=h[[2]],c=h[[3]],d=h[[4]],f=0,j=0,k=0,s=0,temp=0},
For[i=1,i≤48,i++,
If[1≤i&&i≤16,
f=BitOr[BitAnd[b,c],BitAnd[Bitnot[b],d]];
s={3,7,11,19}[[Mod[i,4,1]]];
k=0;
j=i;
];
If[17≤i&&i≤32,
f=BitOr[BitAnd[b,c],BitAnd[b,d],BitAnd[c,d]];
s={3,5,9,13}[[Mod[i,4,1]]];
k=FromDigits["5A827999",16];
j={1,5,9,13,2,6,10,14,3,7,11,15,4,8,12,16}[[i-16]];
];
If[33≤i&&i≤48,
f=BitXor[b,c,d];
s={3,9,11,15}[[Mod[i,4,1]]];
k=FromDigits["6ED9EBA1",16];
j={1,9,5,13,3,11,7,15,2,10,6,14,4,12,8,16}[[i-32]];
];
AppendTo[state,Join[{i-1},IntegerString[{a,b,c,d,f,j,k,s,w[[j]],temp},base,32/Log[2,base]]]];
temp=Bitrotate[Mod[a+f+w[[j]]+k,(2^32)],s];
a=d;
d=c;
c=b;
b=temp;
];
AppendTo[state,Join[{"final"},IntegerString[{a,b,c,d,f,j,k,s,0,temp},base,32/Log[2,base]]]];
AppendTo[state,{"i","a","b","c","d","f","j","k","s","w","temp"}];
result=Mod[h+{a,b,c,d},(2^32)];
AppendTo[state,Join[{"output"},IntegerString[result,base,32/Log[2,base]]]];
];
state
]

CompressionFunctionView[test,IV,16]//TableForm

MD4[x_]:=Block[{h=IV,chunks=Partition[Pad[x],64],i},
Do[h=CompressionFunction[chunks[[i]],h],{i,Length[chunks]}];
IntegerString[FromDigits[Map[EndianSwap,h],(2^32)],16]
]

MD4[input]

MD4[Join[input,input]]