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.5?
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
114              % ripemd::hmac160 -hex -key Sekret "Tcl does RIPEMD-160"
115              bf0c927231733686731dddb470b64a9c23f7f53b
116
117
118
119              % set tok [ripemd::RIPEMD160Init]
120              ::ripemd::1
121              % ripemd::RIPEMD160Update $tok "Tcl "
122              % ripemd::RIPEMD160Update $tok "does "
123              % ripemd::RIPEMD160Update $tok "RIPEMD-160"
124              % ripemd::Hex [ripemd::RIPEMD160Final $tok]
125              0829dea75a1a7074c702896723fe37763481a0a7
126
127

REFERENCES

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

BUGS, IDEAS, FEEDBACK

148       This document, and the package it describes, will  undoubtedly  contain
149       bugs  and other problems.  Please report such in the category ripemd of
150       the  Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please
151       also  report any ideas for enhancements you may have for either package
152       and/or documentation.
153
154       When proposing code changes, please provide unified diffs, i.e the out‐
155       put of diff -u.
156
157       Note  further  that  attachments  are  strongly  preferred over inlined
158       patches. Attachments can be made by going  to  the  Edit  form  of  the
159       ticket  immediately  after  its  creation, and then using the left-most
160       button in the secondary navigation bar.
161

SEE ALSO

163       md4, md5, ripemd128, sha1
164

KEYWORDS

166       RIPEMD, hashing, md4, message-digest, rfc 1320,  rfc  1321,  rfc  2104,
167       security
168

CATEGORY

170       Hashes, checksums, and encryption
171
173       Copyright (c) 2004, Pat Thoyts <patthoyts@users.sourceforge.net>
174
175
176
177
178tcllib                               1.0.5                        ripemd160(n)
Impressum