1ripemd160(n)            RIPEMD Message-Digest Algorithm           ripemd160(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       ripemd160 - RIPEMD-160 Message-Digest Algorithm
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require ripemd160  ?1.0.3?
14
15       ::ripemd::ripemd160 ?-hex? [ -channel channel | -file filename | string
16       ]
17
18       ::ripemd::hmac160 ?-hex? -key key [ -channel channel | -file filename |
19       string ]
20
21       ::ripemd::RIPEMD160Init
22
23       ::ripemd::RIPEMD160Update token data
24
25       ::ripemd::RIPEMD160Final token
26
27       ::ripemd::RIPEHMAC160Init key
28
29       ::ripemd::RIPEHMAC160Update token data
30
31       ::ripemd::RIPEHMAC160Final token
32
33_________________________________________________________________
34

DESCRIPTION

36       This  package  is  an  implementation in Tcl of the RIPEMD-160 message-
37       digest algorithm (1). This algorithm takes  an  arbitrary  quantity  of
38       data  and  generates  a  160-bit  message  digest  from  the input. The
39       RIPEMD-160 algorithm is based upon the MD4 algorithm  (2,  4)  but  has
40       been  cryptographically  strengthened against weaknesses that have been
41       found in MD4 (4).
42
43       This package will use cryptkit or Trf to accelerate the digest computa‐
44       tion  if  either package is available. In the absence of an accelerator
45       package the pure-Tcl implementation will be used.
46

COMMANDS

48       ::ripemd::ripemd160 ?-hex? [ -channel channel | -file filename | string
49       ]
50              Calculate  the  RIPEMD-160  digest  of the data given in string.
51              This is returned as a binary string by default. Giving the  -hex
52              option will return a hexadecimal encoded version of the digest.
53
54              The  data to be hashed can be specified either as a string argu‐
55              ment to the ripemd160 command, or as a filename or a  pre-opened
56              channel.  If  the  -filename  argument is given then the file is
57              opened, the data read and hashed and the file is closed. If  the
58              -channel  argument  is  given then data is read from the channel
59              until the end of file. The channel is not closed.
60
61              Only one of -file, -channel or string should be given.
62
63       ::ripemd::hmac160 ?-hex? -key key [ -channel channel | -file filename |
64       string ]
65              Calculate  an  Hashed Message Authentication digest (HMAC) using
66              the RIPEMD-160 digest algorithm. HMACs are described in RFC 2104
67              (5)  and  provide  a  RIPEMD-160 digest that includes a key. All
68              options other than -key are as for the ::ripemd::ripemd160  com‐
69              mand.
70

PROGRAMMING INTERFACE

72       For the programmer, hash functions can be viewed as a bucket into which
73       one pours data. When you have finished, you extract  a  value  that  is
74       uniquely  derived  from  the  data that was poured into the bucket. The
75       programming interface to the hash operates on a  token  (equivalent  to
76       the  bucket).  You  call  RIPEMD160Init to obtain a token and then call
77       RIPEMD160Update as many times as required to add data to the  hash.  To
78       release  any  resources  and  obtain  the  hash  value,  you  then call
79       RIPEMD160Final. An equivalent set of functions gives you a keyed digest
80       (HMAC).
81
82       ::ripemd::RIPEMD160Init
83              Begins  a  new  RIPEMD-160 hash. Returns a token ID that must be
84              used for the remaining functions.
85
86       ::ripemd::RIPEMD160Update token data
87              Add  data   to   the   hash   identified   by   token.   Calling
88              RIPEMD160Update   $token   "abcd"   is   equivalent  to  calling
89              RIPEMD160Update $token "ab" followed by  RIPEMD160Update  $token
90              "cb". See EXAMPLES.
91
92       ::ripemd::RIPEMD160Final token
93              Returns  the  hash value and releases any resources held by this
94              token. Once this command completes the token  will  be  invalid.
95              The  result  is a binary string of 16 bytes representing the 160
96              bit RIPEMD-160 digest value.
97
98       ::ripemd::RIPEHMAC160Init key
99              This is equivalent to the ::ripemd::RIPEMD160Init command except
100              that it requires the key that will be included in the HMAC.
101
102       ::ripemd::RIPEHMAC160Update token data
103
104       ::ripemd::RIPEHMAC160Final token
105              These  commands  are  identical to the RIPEMD160 equivalent com‐
106              mands.
107

EXAMPLES

109       % ripemd::ripemd160 -hex "Tcl does RIPEMD-160"
110       0829dea75a1a7074c702896723fe37763481a0a7
111
112
113       % ripemd::hmac160 -hex -key Sekret "Tcl does RIPEMD-160"
114       bf0c927231733686731dddb470b64a9c23f7f53b
115
116
117       % set tok [ripemd::RIPEMD160Init]
118       ::ripemd::1
119       % ripemd::RIPEMD160Update $tok "Tcl "
120       % ripemd::RIPEMD160Update $tok "does "
121       % ripemd::RIPEMD160Update $tok "RIPEMD-160"
122       % ripemd::Hex [ripemd::RIPEMD160Final $tok]
123       0829dea75a1a7074c702896723fe37763481a0a7
124
125

REFERENCES

127       [1]    H.  Dobbertin,  A.  Bosselaers,  B.  Preneel,   "RIPEMD-160,   a
128              strengthened    version    of   RIPEMD"   http://www.esat.kuleu
129              ven.ac.be/~cosicart/pdf/AB-9601/AB-9601.pdf
130
131       [2]    Rivest, R., "The MD4 Message Digest Algorithm", RFC  1320,  MIT,
132              April 1992. (http://www.rfc-editor.org/rfc/rfc1320.txt)
133
134       [3]    Rivest, R., "The MD4 message digest algorithm", in A.J.  Menezes
135              and S.A. Vanstone, editors, Advances in Cryptology - CRYPTO  '90
136              Proceedings, pages 303-311, Springer-Verlag, 1991.
137
138       [4]    Dobbertin, H., "Cryptanalysis of MD4", Journal of Cryptology vol
139              11 (4), pp. 253-271 (1998)
140
141       [5]    Krawczyk, H., Bellare, M. and Canetti, R.  "HMAC:  Keyed-Hashing
142              for   Message   Authentication",   RFC   2104,   February  1997.
143              (http://www.rfc-editor.org/rfc/rfc2104.txt)
144

SEE ALSO

146       md4, md5, ripemd128, sha1
147

KEYWORDS

149       RIPEMD, hashing, md4, message-digest, rfc 1320,  rfc  1321,  rfc  2104,
150       security
151
153       Copyright (c) 2004, Pat Thoyts <patthoyts@users.sourceforge.net>
154
155
156
157
158ripemd                               1.0.3                        ripemd160(n)
Impressum