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

NAME

8       ripemd128 - RIPEMD-128 Message-Digest Algorithm
9

SYNOPSIS

11       package require Tcl  8.2
12
13       package require ripemd128  ?1.0.3?
14
15       ::ripemd::ripemd128 ?-hex? [ -channel channel | -file filename | string
16       ]
17
18       ::ripemd::hmac128 ?-hex? -key key [ -channel channel | -file filename |
19       string ]
20
21       ::ripemd::RIPEMD128Init
22
23       ::ripemd::RIPEMD128Update token data
24
25       ::ripemd::RIPEMD128Final token
26
27       ::ripemd::RIPEHMAC128Init key
28
29       ::ripemd::RIPEHMAC128Update token data
30
31       ::ripemd::RIPEHMAC128Final token
32
33_________________________________________________________________
34

DESCRIPTION

36       This  package  is  an  implementation in Tcl of the RIPEMD-128 message-
37       digest algorithm (1). This algorithm takes  an  arbitrary  quantity  of
38       data  and  generates  a  128-bit  message  digest  from  the input. The
39       RIPEMD-128 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). RIPEMD-128 has been designed to be a drop-in replace‐
42       ment  for MD4 and MD5 (5). If security is the major consideration, then
43       RIPEMD-160 or SHA1 should be considered.
44
45       This package will use Trf  to  accelerate  the  digest  computation  if
46       available. In the absence of an accelerator package the pure-Tcl imple‐
47       mentation will be used.
48

COMMANDS

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

PROGRAMMING INTERFACE

74       For the programmer, hash functions can be viewed as a bucket into which
75       one pours data. When you have finished, you extract  a  value  that  is
76       uniquely  derived  from  the  data that was poured into the bucket. The
77       programming interface to the hash operates on a  token  (equivalent  to
78       the  bucket).  You  call  RIPEMD128Init to obtain a token and then call
79       RIPEMD128Update as many times as required to add data to the  hash.  To
80       release  any  resources  and  obtain  the  hash  value,  you  then call
81       RIPEMD128Final. An equivalent set of functions gives you a keyed digest
82       (HMAC).
83
84       If  you  have critcl and have built the tcllibc package then the imple‐
85       mentation of the hashing function will be performed by  compiled  code.
86       Alternatively if both the Trf and Memchan extensions are available then
87       these will be used. Finally the  package  will  revert  to  a  pure-Tcl
88       implementation.  The programming interface remains the same, however.
89
90       ::ripemd::RIPEMD128Init
91              Begins  a  new  RIPEMD-128 hash. Returns a token ID that must be
92              used for the remaining functions.
93
94       ::ripemd::RIPEMD128Update token data
95              Add  data   to   the   hash   identified   by   token.   Calling
96              RIPEMD128Update   $token   "abcd"   is   equivalent  to  calling
97              RIPEMD128Update $token "ab" followed by  RIPEMD128Update  $token
98              "cb". See EXAMPLES.
99
100       ::ripemd::RIPEMD128Final token
101              Returns  the  hash value and releases any resources held by this
102              token. Once this command completes the token  will  be  invalid.
103              The  result  is a binary string of 16 bytes representing the 128
104              bit RIPEMD-128 digest value.
105
106       ::ripemd::RIPEHMAC128Init key
107              This is equivalent to the ::ripemd::RIPEMD128Init command except
108              that it requires the key that will be included in the HMAC.
109
110       ::ripemd::RIPEHMAC128Update token data
111
112       ::ripemd::RIPEHMAC128Final token
113              These  commands  are  identical to the RIPEMD128 equivalent com‐
114              mands.
115

EXAMPLES

117       % ripemd::ripemd128 -hex "Tcl does RIPEMD-128"
118       3cab177bae65205d81e7978f63556c63
119
120
121       % ripemd::hmac128 -hex -key Sekret "Tcl does RIPEMD-128"
122       b359dc5971a05beea0be7b106b30e389
123
124
125       % set tok [ripemd::RIPEMD128Init]
126       ::ripemd::1
127       % ripemd::RIPEMD128Update $tok "Tcl "
128       % ripemd::RIPEMD128Update $tok "does "
129       % ripemd::RIPEMD128Update $tok "RIPEMD-128"
130       % ripemd::Hex [ripemd::RIPEMD128Final $tok]
131       3cab177bae65205d81e7978f63556c63
132
133

REFERENCES

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

BUGS, IDEAS, FEEDBACK

158       This document, and the package it describes, will  undoubtedly  contain
159       bugs  and other problems.  Please report such in the category ripemd of
160       the         Tcllib         SF         Trackers          [http://source
161       forge.net/tracker/?group_id=12883].   Please  also report any ideas for
162       enhancements you may have for either package and/or documentation.
163

SEE ALSO

165       md4, md5, ripemd160, sha1
166

KEYWORDS

168       RIPEMD, hashing, md4, message-digest, rfc 1320,  rfc  1321,  rfc  2104,
169       security
170
172       Copyright (c) 2004, Pat Thoyts <patthoyts@users.sourceforge.net>
173
174
175
176
177ripemd                               1.0.3                        ripemd128(n)
Impressum