* eword-encode.el (make-ew-rword, ew-rword-text, ew-rword-charset)
[elisp/flim.git] / tests / test-hmac-md5.el
1 (require 'lunit)
2 (require 'hmac-md5)
3
4 (luna-define-class test-hmac-md5 (lunit-test-case))
5
6 (luna-define-method test-hmac-md5-1 ((case test-hmac-md5))
7   (lunit-assert
8    (string=
9     (encode-hex-string (hmac-md5 "Hi There" (make-string 16 ?\x0b)))
10     "9294727a3638bb1c13f48ef8158bfc9d")))
11
12 (luna-define-method test-hmac-md5-2 ((case test-hmac-md5))
13   (lunit-assert
14    (string=
15     (encode-hex-string (hmac-md5 "what do ya want for nothing?" "Jefe"))
16     "750c783e6ab0b503eaa86e310a5db738")))
17
18 (luna-define-method test-hmac-md5-3 ((case test-hmac-md5))
19   (lunit-assert
20    (string=
21     (encode-hex-string (hmac-md5 (make-string 50 ?\xdd) (make-string 16 ?\xaa)))
22     "56be34521d144c88dbb8c733f0e8b3f6")))
23
24 (luna-define-method test-hmac-md5-4 ((case test-hmac-md5))
25   (lunit-assert
26    (string=
27     (encode-hex-string
28      (hmac-md5
29       (make-string 50 ?\xcd)
30       (decode-hex-string "0102030405060708090a0b0c0d0e0f10111213141516171819")))
31     "697eaf0aca3a3aea3a75164746ffaa79")))
32
33 (luna-define-method test-hmac-md5-5 ((case test-hmac-md5))
34   (lunit-assert
35    (string=
36     (encode-hex-string
37      (hmac-md5 "Test With Truncation" (make-string 16 ?\x0c)))
38     "56461ef2342edc00f9bab995690efd4c")))
39
40 (luna-define-method test-hmac-md5-6 ((case test-hmac-md5))
41   (lunit-assert
42    (string=
43      (encode-hex-string
44       (hmac-md5-96 "Test With Truncation" (make-string 16 ?\x0c)))
45      "56461ef2342edc00f9bab995")))
46
47 (luna-define-method test-hmac-md5-7 ((case test-hmac-md5))
48   (lunit-assert
49    (string=
50     (encode-hex-string
51      (hmac-md5
52       "Test Using Larger Than Block-Size Key - Hash Key First"
53       (make-string 80 ?\xaa)))
54     "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd")))
55
56 (luna-define-method test-hmac-md5-8 ((case test-hmac-md5))
57   (lunit-assert
58    (string=
59     (encode-hex-string
60      (hmac-md5
61       "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data"
62       (make-string 80 ?\xaa)))
63     "6f630fad67cda0ee1fb1f562db3aa53e")))