# -*- tcl -*-
# Commands covered:	sha one-way hash function
#
# This file contains a collection of tests for one or more of the commands
# the BLOB-X 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: sha.test,v 1.5 1997/07/22 22:00:43 aku Exp $

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


foreach {i in digest} {
    0 abc
    0164b8a914cd2a5e74c4f7ff082c4d97f1edf880

    1 abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq
    d2516ee1acfa5baf33dfc1c471e438449ef134c8
} {
    if {[info tclversion] < 8.0} {
	test sha-4.$i-7.6 {sha, immediate} {
	    exec_md sha [text2hex $in]
	} [string toupper $digest]
    } else {
	test sha-4.$i-8.x {sha, immediate} {
	    hex -m e [sha $in]
	} [string toupper $digest]
    }
}
