WAD @MD5 returns incorrect results for strings


Up until today I've only ever used the single parameter version of @MD5 to return the hash of a file, but I've been messing around with the string version today and getting some unexpected results. To prove that the results are screwy I used the following batch file

REM This batch file validates the output from the Take Command @MD5 function
REM with string arguments against RFC 1321, viz:
A.5 Test suite

The MD5 test suite (driver option "-x") should print the following

MD5 test suite:
MD5 ("") = d41d8cd98f00b204e9800998ecf8427e
MD5 ("a") = 0cc175b9c0f1b6a831c399e269772661
MD5 ("abc") = 900150983cd24fb0d6963f7d28e17f72
MD5 ("message digest") = f96b697d7cb7938d525a2f31aaf161d0
MD5 ("abcdefghijklmnopqrstuvwxyz") = c3fcd3d76192e4007dfb496cca67e13b
MD5 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") =
MD5 ("123456789012345678901234567890123456789012345678901234567890123456
78901234567890") = 57edf4a22be3c955ac49da2e2107b67a
ECHO %@MD5[s,] (generated by TCC)
ECHO d41d8cd98f00b204e9800998ecf8427e (expected answer)
ECHO %@MD5[s,a] (generated by TCC)
ECHO 0cc175b9c0f1b6a831c399e269772661 (expected answer)
ECHO %@MD5[s,abc] (generated by TCC)
ECHO 900150983cd24fb0d6963f7d28e17f72 (expected answer)
ECHO %@MD5[s,message digest] (generated by TCC)
ECHO f96b697d7cb7938d525a2f31aaf161d0 (expected answer)
ECHO %@MD5[s,abcdefghijklmnopqrstuvwxyz] (generated by TCC)
ECHO c3fcd3d76192e4007dfb496cca67e13b (expected answer)
ECHO %@MD5[s,ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789] (generated by TCC)
ECHO d174ab98d277d9f5a5611c2c9f419d9f (expected answer)
ECHO %@MD5[s,12345678901234567890123456789012345678901234567890123456789012345678901234567890] (generated by TCC)
ECHO 57edf4a22be3c955ac49da2e2107b67a (expected answer)

which generated the following results:

D41D8CD98F00B204E9800998ECF8427E (generated by TCC)
d41d8cd98f00b204e9800998ecf8427e (expected answer)

4144E195F46DE78A3623DA7364D04F11 (generated by TCC)
0cc175b9c0f1b6a831c399e269772661 (expected answer)

CE1473CF80C6B3FDA8E3DFC006ADC315 (generated by TCC)
900150983cd24fb0d6963f7d28e17f72 (expected answer)

6F9AB83227F65F9B86C380E2C9C33031 (generated by TCC)
f96b697d7cb7938d525a2f31aaf161d0 (expected answer)

35020D67A52D8E915330F0A77F676BBF (generated by TCC)
c3fcd3d76192e4007dfb496cca67e13b (expected answer)

86056D805455C8448F6C09404C3DB624 (generated by TCC)
d174ab98d277d9f5a5611c2c9f419d9f (expected answer)

903F43F5C1F384FC267110BF07CAEC04 (generated by TCC)
57edf4a22be3c955ac49da2e2107b67a (expected answer)

I've no idea whether or not this affects v19, as I'm not running that version here at home, but it certainly affects the 64 bit implementations of v17 (running on Windows 8.1) and v18 (running on Windows 7), specifically:

TCC 18.00.31 x64 Windows 7 [Version 6.1.7601]

TCC 17.00.77 x64 Windows 8.1 [Version 6.3.9600]

and I'd really like to see it fixed in v18 as well as v19.
Similar threads
Thread starter Title Forum Replies Date
S 32b Build 54 does not match MD5 in tcmd.aiu Support 7
D Strange crashes in @CRC32 and @MD5 Support 9
F %@regex["^-","-a"] returns 0, "^-" =~ "-a" is false (no match) Support 4
Peter Murschall %_BATTERY returns 0 and others Support 9
W pdir returns diff results between tcc and tcmd - one is an error msg Support 5
M Fixed PSHELL command returns error Support 2
H Fixed DIR /G returns wrong sizes Support 2
D COPY returns ERRORLEVEL 2 Support 5
G WAD _DOS and VER/r returns incorect value Support 2
R Function #IDOW returns only 2 characters Support 10
D @IPADDRESS[] always returns 11001 Support 8
vefatica Fixed @FILEOPEN returns 4294967295 Support 2
I Possible Bug: History /n Returns Nothing Support 3
S WAD _exit returns invalid code under some conditions Support 13
M %_ADMIN always returns 0 Support 3
B Bdebugger doesn't recognize breakpoint after batch file returns Support 2
N Delay returns immediately Support 20
B %ProgramFiles(x86)% returns different values in TCC and CMD Support 3
J BUG: MSGBOX after DETACH returns early with 0 on Win7 Support 3
Charles Dye REGDIR /T : incorrect localization of time stamps Support 4
S incorrect message at start Cancel batch job 4START.bat ? (Y/N/A) : Support 1
rps Fixed @filesize[...,a] space allocated values incorrect Support 2
M TCC incorrect dir output since Windows 1803 Support 6
Fross @Words Incorrect? Support 19
Phil Kane WAD v 17 Displays Incorrect OS Support 6
rps Documentation "Select" command switch order incorrect Support 4
R Fixed Bytes Allocated Total Incorrect in V17 b52 Support 1
M Incorrect ARGV1 when using linux-style paths Support 4
D Minor problem. Incorrect value internal var _dir_files Support 7
S WAD Incorrect _do_loop values Support 18
The Wizard WAD Possible Incorrect COMSPEC handling Support 2
Dan Glynhampton Documentation v15 help: Incorrect Links Support 0
JohnQSmith WAD Incorrect results from @FILESIZE Support 9
T @ping: response code, data size and documentation incorrect Support 2
N Incorrect display under TCMD 13 Support 1
dcantor @AGEDATE example incorrect in help Support 0
T Incorrect file associations Support 8
C TC10 LIST - print with line nbrs incorrect Support 0
D D:\Settings\Application contains an incorrect path? Support 0

Similar threads