Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 1 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 2 | /* MD5 module */ |
| 3 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 4 | /* This module provides an interface to the RSA Data Security, |
| 5 | Inc. MD5 Message-Digest Algorithm, described in RFC 1321. |
| 6 | It requires the files md5c.c and md5.h (which are slightly changed |
| 7 | from the versions in the RFC to avoid the "global.h" file.) */ |
| 8 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 9 | |
| 10 | /* MD5 objects */ |
| 11 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 12 | #include "Python.h" |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 13 | #include "md5.h" |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 14 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 15 | typedef struct { |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 16 | PyObject_HEAD |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 17 | MD5_CTX md5; /* the context holder */ |
| 18 | } md5object; |
| 19 | |
Jeremy Hylton | 938ace6 | 2002-07-17 16:30:39 +0000 | [diff] [blame] | 20 | static PyTypeObject MD5type; |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 21 | |
| 22 | #define is_md5object(v) ((v)->ob_type == &MD5type) |
| 23 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 24 | static md5object * |
Thomas Wouters | f3f33dc | 2000-07-21 06:00:07 +0000 | [diff] [blame] | 25 | newmd5object(void) |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 26 | { |
| 27 | md5object *md5p; |
| 28 | |
Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 29 | md5p = PyObject_New(md5object, &MD5type); |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 30 | if (md5p == NULL) |
| 31 | return NULL; |
| 32 | |
| 33 | MD5Init(&md5p->md5); /* actual initialisation */ |
| 34 | return md5p; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 35 | } |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 36 | |
| 37 | |
| 38 | /* MD5 methods */ |
| 39 | |
| 40 | static void |
Peter Schneider-Kamp | 286da3b | 2000-07-10 12:43:58 +0000 | [diff] [blame] | 41 | md5_dealloc(md5object *md5p) |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 42 | { |
Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 43 | PyObject_Del(md5p); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 44 | } |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 45 | |
| 46 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 47 | /* MD5 methods-as-attributes */ |
| 48 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 49 | static PyObject * |
Peter Schneider-Kamp | 286da3b | 2000-07-10 12:43:58 +0000 | [diff] [blame] | 50 | md5_update(md5object *self, PyObject *args) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 51 | { |
| 52 | unsigned char *cp; |
| 53 | int len; |
| 54 | |
Neal Norwitz | ba3a16c | 2002-03-31 15:27:00 +0000 | [diff] [blame] | 55 | if (!PyArg_ParseTuple(args, "s#:update", &cp, &len)) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 56 | return NULL; |
| 57 | |
| 58 | MD5Update(&self->md5, cp, len); |
| 59 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 60 | Py_INCREF(Py_None); |
| 61 | return Py_None; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 62 | } |
| 63 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 64 | PyDoc_STRVAR(update_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 65 | "update (arg)\n\ |
| 66 | \n\ |
| 67 | Update the md5 object with the string arg. Repeated calls are\n\ |
| 68 | equivalent to a single call with the concatenation of all the\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 69 | arguments."); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 70 | |
| 71 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 72 | static PyObject * |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 73 | md5_digest(md5object *self) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 74 | { |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 75 | MD5_CTX mdContext; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 76 | unsigned char aDigest[16]; |
| 77 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 78 | /* make a temporary copy, and perform the final */ |
| 79 | mdContext = self->md5; |
| 80 | MD5Final(aDigest, &mdContext); |
| 81 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 82 | return PyString_FromStringAndSize((char *)aDigest, 16); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 85 | PyDoc_STRVAR(digest_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 86 | "digest() -> string\n\ |
| 87 | \n\ |
| 88 | Return the digest of the strings passed to the update() method so\n\ |
Skip Montanaro | bd2de3a | 2003-07-08 21:17:25 +0000 | [diff] [blame] | 89 | far. This is a 16-byte string which may contain non-ASCII characters,\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 90 | including null bytes."); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 91 | |
| 92 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 93 | static PyObject * |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 94 | md5_hexdigest(md5object *self) |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 95 | { |
| 96 | MD5_CTX mdContext; |
| 97 | unsigned char digest[16]; |
| 98 | unsigned char hexdigest[32]; |
| 99 | int i, j; |
| 100 | |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 101 | /* make a temporary copy, and perform the final */ |
| 102 | mdContext = self->md5; |
| 103 | MD5Final(digest, &mdContext); |
| 104 | |
| 105 | /* Make hex version of the digest */ |
| 106 | for(i=j=0; i<16; i++) { |
| 107 | char c; |
| 108 | c = (digest[i] >> 4) & 0xf; |
| 109 | c = (c>9) ? c+'a'-10 : c + '0'; |
| 110 | hexdigest[j++] = c; |
| 111 | c = (digest[i] & 0xf); |
| 112 | c = (c>9) ? c+'a'-10 : c + '0'; |
| 113 | hexdigest[j++] = c; |
| 114 | } |
| 115 | return PyString_FromStringAndSize((char*)hexdigest, 32); |
| 116 | } |
| 117 | |
| 118 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 119 | PyDoc_STRVAR(hexdigest_doc, |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 120 | "hexdigest() -> string\n\ |
| 121 | \n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 122 | Like digest(), but returns the digest as a string of hexadecimal digits."); |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 123 | |
| 124 | |
| 125 | static PyObject * |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 126 | md5_copy(md5object *self) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 127 | { |
| 128 | md5object *md5p; |
| 129 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 130 | if ((md5p = newmd5object()) == NULL) |
| 131 | return NULL; |
| 132 | |
| 133 | md5p->md5 = self->md5; |
| 134 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 135 | return (PyObject *)md5p; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 136 | } |
| 137 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 138 | PyDoc_STRVAR(copy_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 139 | "copy() -> md5 object\n\ |
| 140 | \n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 141 | Return a copy (``clone'') of the md5 object."); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 142 | |
| 143 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 144 | static PyMethodDef md5_methods[] = { |
Neal Norwitz | ba3a16c | 2002-03-31 15:27:00 +0000 | [diff] [blame] | 145 | {"update", (PyCFunction)md5_update, METH_VARARGS, update_doc}, |
Neal Norwitz | 3a6f978 | 2002-03-25 20:46:46 +0000 | [diff] [blame] | 146 | {"digest", (PyCFunction)md5_digest, METH_NOARGS, digest_doc}, |
| 147 | {"hexdigest", (PyCFunction)md5_hexdigest, METH_NOARGS, hexdigest_doc}, |
| 148 | {"copy", (PyCFunction)md5_copy, METH_NOARGS, copy_doc}, |
Barry Warsaw | 3ec0fbb | 2000-08-15 05:59:44 +0000 | [diff] [blame] | 149 | {NULL, NULL} /* sentinel */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 150 | }; |
| 151 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 152 | static PyObject * |
Peter Schneider-Kamp | 286da3b | 2000-07-10 12:43:58 +0000 | [diff] [blame] | 153 | md5_getattr(md5object *self, char *name) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 154 | { |
Andrew M. Kuchling | 75fec2c | 2001-11-02 21:41:00 +0000 | [diff] [blame] | 155 | if (strcmp(name, "digest_size") == 0) { |
| 156 | return PyInt_FromLong(16); |
| 157 | } |
| 158 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 159 | return Py_FindMethod(md5_methods, (PyObject *)self, name); |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 160 | } |
| 161 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 162 | PyDoc_STRVAR(module_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 163 | "This module implements the interface to RSA's MD5 message digest\n\ |
| 164 | algorithm (see also Internet RFC 1321). Its use is quite\n\ |
| 165 | straightforward: use the new() to create an md5 object. You can now\n\ |
| 166 | feed this object with arbitrary strings using the update() method, and\n\ |
| 167 | at any point you can ask it for the digest (a strong kind of 128-bit\n\ |
Thomas Wouters | 7e47402 | 2000-07-16 12:04:32 +0000 | [diff] [blame] | 168 | checksum, a.k.a. ``fingerprint'') of the concatenation of the strings\n\ |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 169 | fed to it so far using the digest() method.\n\ |
| 170 | \n\ |
| 171 | Functions:\n\ |
| 172 | \n\ |
| 173 | new([arg]) -- return a new md5 object, initialized with arg if provided\n\ |
| 174 | md5([arg]) -- DEPRECATED, same as new, but for compatibility\n\ |
| 175 | \n\ |
| 176 | Special Objects:\n\ |
| 177 | \n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 178 | MD5Type -- type object for md5 objects"); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 179 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 180 | PyDoc_STRVAR(md5type_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 181 | "An md5 represents the object used to calculate the MD5 checksum of a\n\ |
| 182 | string of information.\n\ |
| 183 | \n\ |
| 184 | Methods:\n\ |
| 185 | \n\ |
| 186 | update() -- updates the current digest with an additional string\n\ |
| 187 | digest() -- return the current digest value\n\ |
Neal Norwitz | 98a355d | 2002-10-11 21:53:01 +0000 | [diff] [blame] | 188 | hexdigest() -- return the current digest as a string of hexadecimal digits\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 189 | copy() -- return a copy of the current md5 object"); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 190 | |
Tim Peters | 0c32279 | 2002-07-17 16:49:03 +0000 | [diff] [blame] | 191 | static PyTypeObject MD5type = { |
Fred Drake | 0d40ba4 | 2000-02-04 20:33:49 +0000 | [diff] [blame] | 192 | PyObject_HEAD_INIT(NULL) |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 193 | 0, /*ob_size*/ |
Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 194 | "md5.md5", /*tp_name*/ |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 195 | sizeof(md5object), /*tp_size*/ |
| 196 | 0, /*tp_itemsize*/ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 197 | /* methods */ |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 198 | (destructor)md5_dealloc, /*tp_dealloc*/ |
| 199 | 0, /*tp_print*/ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 200 | (getattrfunc)md5_getattr, /*tp_getattr*/ |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 201 | 0, /*tp_setattr*/ |
| 202 | 0, /*tp_compare*/ |
| 203 | 0, /*tp_repr*/ |
| 204 | 0, /*tp_as_number*/ |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 205 | 0, /*tp_as_sequence*/ |
| 206 | 0, /*tp_as_mapping*/ |
| 207 | 0, /*tp_hash*/ |
| 208 | 0, /*tp_call*/ |
| 209 | 0, /*tp_str*/ |
| 210 | 0, /*tp_getattro*/ |
| 211 | 0, /*tp_setattro*/ |
| 212 | 0, /*tp_as_buffer*/ |
| 213 | 0, /*tp_xxx4*/ |
| 214 | md5type_doc, /*tp_doc*/ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | |
| 218 | /* MD5 functions */ |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 219 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 220 | static PyObject * |
Peter Schneider-Kamp | 286da3b | 2000-07-10 12:43:58 +0000 | [diff] [blame] | 221 | MD5_new(PyObject *self, PyObject *args) |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 222 | { |
| 223 | md5object *md5p; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 224 | unsigned char *cp = NULL; |
Guido van Rossum | ef38b78 | 1995-07-26 17:33:10 +0000 | [diff] [blame] | 225 | int len = 0; |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 226 | |
Guido van Rossum | 43713e5 | 2000-02-29 13:59:29 +0000 | [diff] [blame] | 227 | if (!PyArg_ParseTuple(args, "|s#:new", &cp, &len)) |
Guido van Rossum | ef38b78 | 1995-07-26 17:33:10 +0000 | [diff] [blame] | 228 | return NULL; |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 229 | |
| 230 | if ((md5p = newmd5object()) == NULL) |
| 231 | return NULL; |
| 232 | |
| 233 | if (cp) |
| 234 | MD5Update(&md5p->md5, cp, len); |
| 235 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 236 | return (PyObject *)md5p; |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 237 | } |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 238 | |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 239 | PyDoc_STRVAR(new_doc, |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 240 | "new([arg]) -> md5 object\n\ |
| 241 | \n\ |
| 242 | Return a new md5 object. If arg is present, the method call update(arg)\n\ |
Martin v. Löwis | 14f8b4c | 2002-06-13 20:33:02 +0000 | [diff] [blame] | 243 | is made."); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 244 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 245 | |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 246 | /* List of functions exported by this module */ |
| 247 | |
Barry Warsaw | 8b43b19 | 1996-12-09 22:32:36 +0000 | [diff] [blame] | 248 | static PyMethodDef md5_functions[] = { |
Andrew M. Kuchling | e365fb8 | 2000-08-03 02:06:16 +0000 | [diff] [blame] | 249 | {"new", (PyCFunction)MD5_new, METH_VARARGS, new_doc}, |
| 250 | {"md5", (PyCFunction)MD5_new, METH_VARARGS, new_doc}, /* Backward compatibility */ |
Guido van Rossum | ef38b78 | 1995-07-26 17:33:10 +0000 | [diff] [blame] | 251 | {NULL, NULL} /* Sentinel */ |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 252 | }; |
| 253 | |
| 254 | |
| 255 | /* Initialize this module. */ |
| 256 | |
Mark Hammond | fe51c6d | 2002-08-02 02:27:13 +0000 | [diff] [blame] | 257 | PyMODINIT_FUNC |
Thomas Wouters | f3f33dc | 2000-07-21 06:00:07 +0000 | [diff] [blame] | 258 | initmd5(void) |
Guido van Rossum | 5f59d60 | 1992-12-14 16:59:51 +0000 | [diff] [blame] | 259 | { |
Fred Drake | 52a42e9 | 2001-11-02 22:05:06 +0000 | [diff] [blame] | 260 | PyObject *m, *d; |
Fred Drake | 0d40ba4 | 2000-02-04 20:33:49 +0000 | [diff] [blame] | 261 | |
| 262 | MD5type.ob_type = &PyType_Type; |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 263 | m = Py_InitModule3("md5", md5_functions, module_doc); |
| 264 | d = PyModule_GetDict(m); |
| 265 | PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type); |
Fred Drake | 52a42e9 | 2001-11-02 22:05:06 +0000 | [diff] [blame] | 266 | PyModule_AddIntConstant(m, "digest_size", 16); |
Guido van Rossum | d3a6a14 | 1998-10-14 13:46:57 +0000 | [diff] [blame] | 267 | /* No need to check the error here, the caller will do that */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 268 | } |