Skip to content

Commit 7f3eb91

Browse files
committed
Removed deprecated hash() interface
1 parent 40d0f1c commit 7f3eb91

File tree

4 files changed

+3
-49
lines changed

4 files changed

+3
-49
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
- Started using [semantic versioning][semver] together with
1414
[keep a changelog][keepachangelog].
1515

16+
### Deprecated
17+
- Removed the old deprecated `hash()` interface.
18+
1619
## [0.3] - 2013-01-23
1720

1821
### Added

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,7 @@ You need to specify the encoding of these strings before hashing.
3131

3232
Strings that are marked as binary do not need encoding.
3333

34-
Deprecated usage
35-
----------------
36-
37-
For backward compatibility the old interface remains available. From Python 3
38-
onwards, the old interface is dropped.
39-
40-
import whirlpool
41-
42-
hashed_string = whirlpool.hash("My String")
43-
44-
4534
Testing
4635
-------
4736

4837
This module is tested using Python 2.7 and Python 3.3.
49-

main.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -377,38 +377,10 @@ Return a new whirlpool object. If arg is present, the method call update(arg)\n\
377377
is made.");
378378

379379

380-
#if PY_MAJOR_VERSION < 3
381-
/* Function is deprecated and only available in Python 2.7 */
382-
static PyObject *
383-
whirlpool_hash(PyObject *self, PyObject *args) {
384-
struct NESSIEstruct w;
385-
unsigned char digest[DIGESTBYTES];
386-
Py_ssize_t data_size;
387-
unsigned char *data;
388-
389-
if(!PyArg_ParseTuple(args, "s#", &data, &data_size))
390-
return NULL;
391-
392-
NESSIEinit(&w);
393-
NESSIEadd(data, data_size*8, &w);
394-
NESSIEfinalize(&w, digest);
395-
396-
return Py_BuildValue("s#", digest, DIGESTBYTES);
397-
}
398-
399-
PyDoc_STRVAR(hash_doc,
400-
"Returns a hash of argument using the whirlpool algorithm.\n\
401-
This function is deprecated. Please use new() and hexdigest().");
402-
#endif
403-
404-
405380
/* List of functions exported by this module */
406381

407382
static struct PyMethodDef whirlpool_functions[] = {
408383
{"new", (PyCFunction)whirlpool_new, METH_VARARGS, new_doc},
409-
#if PY_MAJOR_VERSION < 3
410-
{"hash", (PyCFunction)whirlpool_hash, METH_VARARGS, hash_doc},
411-
#endif
412384
{NULL, NULL} /* sentinel */
413385
};
414386

tests.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ def digest2hex(data):
3434

3535
class TestWhirlpool(unittest.TestCase):
3636

37-
@unittest.skipIf(sys.hexversion >= 0x03000000, "function deprecated")
38-
def test_hash_empty(self):
39-
self.assertEqual(digest2hex(whirlpool.hash(data['empty'])), results['empty'])
40-
41-
@unittest.skipIf(sys.hexversion >= 0x03000000, "function deprecated")
42-
def test_hash_fox(self):
43-
self.assertEqual(digest2hex(whirlpool.hash(data['tqbfjotld'])), results['tqbfjotld'])
44-
self.assertEqual(digest2hex(whirlpool.hash(data['tqbfjotle'])), results['tqbfjotle'])
45-
4637
def test_new_empty(self):
4738
wp = whirlpool.new()
4839
self.assertEqual(digest2hex(wp.digest()), results['empty'])

0 commit comments

Comments
 (0)