File: sha1.test

package info (click to toggle)
tcltrf 2.1.4-dfsg3-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,628 kB
  • sloc: ansic: 73,134; sh: 3,155; tcl: 1,343; makefile: 176; exp: 22
file content (35 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- tcl -*-
# Commands covered:	sha1 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: sha1.test,v 1.2 1999/06/15 18:10:44 aku Exp $

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


foreach {i in digest} {
    0 abc
    A9993E364706816ABA3E25717850C26C9CD0D89D

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