# -*- tcl -*-
# Commands covered:	md2
#
# This file contains a collection of tests for one or more of the commands
# the TRF extension. Sourcing this file into Tcl runs the tests and generates
# output for errors.  No output means no errors were found.
#
# Copyright (c) 1996 Andreas Kupries (andreas_kupries@users.sourceforge.net)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: md2.test,v 1.3 1999/06/15 18:10:43 aku Exp $

if {[string compare test [info procs test]] == 1} then {source defs}

# test suite from RFC 1319
foreach {i in digest} {
    1 {}
    8350e5a3e24c153df2275c9f80692773

    2 a
    32ec01ec4a6dac72c0ab96fb34c0b5d1

    3 abc
    da853b0d3f88d99b30283a69e6ded6bb

    4 {message digest}
    ab4f496bfb2a530b219ff33031fe06b0

    5 abcdefghijklmnopqrstuvwxyz
    4e8ddff3650292ab5a4108c3aa47940b

    6 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
    da33def2a42df13975352846c30338cd

    7 12345678901234567890123456789012345678901234567890123456789012345678901234567890
    d5976f79d83d3a0dc9806c3c66f3efd8
} {
    if {[info tclversion] < 8.0} {
	test md2-4.$i-7.6 {md2, immediate} {hasSSL} {
	    exec_md md2 [text2hex $in]
	} [string toupper $digest]
    } else {
	test md2-4.$i-8.x {md2, immediate} {hasSSL} {
	    hex -m e [md2 $in]
	} [string toupper $digest]
    }
}
