File: otpmd5.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 (55 lines) | stat: -rw-r--r-- 1,364 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- tcl -*-
# Commands covered:	otp_md5
#
# 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: otpmd5.test,v 1.1 1999/05/30 11:45:49 aku Exp $

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


# test suite from RFC 1321 (1..7)


foreach {i in digest} {
    0 {hello world}
    CD7D19006F442313

    1 {}
    3D9D854163F8F07A

    2 a
    3D02EC5BA98690C9

    3 abc
    46976FE5143330C2

    4 {message digest}
    AB31464CD646F25D

    5 abcdefghijklmnopqrstuvwxyz
    BE079ABBABF5053B

    6 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
    7415B7B44D36446A

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