FUNCTION md5_F(x, y, z) RETURN BITOR(BITAND(x , y) , BITAND(BITNOT(x) , z)) ENDFUNC
FUNCTION md5_G(x, y, z) RETURN BITOR(BITAND(x , z) , BITAND(y , BITNOT(z))) ENDFUNC
FUNCTION md5_H(x, y, z) RETURN BITXOR(BITXOR(x , y) , z) ENDFUNC
FUNCTION md5_I(x, y, z) RETURN BITXOR(y , BITOR(x , BITNOT(z))) ENDFUNC
PROCEDURE md5_FF(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_F(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) ENDPROC
PROCEDURE md5_GG(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_G(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) ENDPROC
PROCEDURE md5_HH(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_H(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) ENDPROC
PROCEDURE md5_II(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_I(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) ENDPROC
FUNCTION Hex(lByte) x=’’ DO WHILE lByte>0 IF lByte>=16 y=lByte ELSE y=lByte ENDIF IF y<10 .and. y>=0 x=STR(y,1) x ELSE x=CHR(65 y-10) x ENDIF lByte=(lByte-y)/16 ENDDO RETURN x ENDFUNC