Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

sha3.c: Additional cleanup and remove a warning.

  • Loading branch information...
commit 0ccd936ba05fa823ddfbb4b6c9fcf08794069609 1 parent cc690de
@bjornedstrom authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 sha3.c
View
13 sha3.c
@@ -26,6 +26,9 @@
#include "KeccakReferenceAndOptimized/Sources/KeccakNISTInterface.h"
+#define MAX_DIGEST_SIZE 64
+
+
typedef struct {
PyObject_HEAD
int hashbitlen;
@@ -62,11 +65,9 @@ PyDoc_STRVAR(SHA3_copy__doc__, "Return a copy of the hash object.");
static PyObject *
SHA3_copy(SHAobject *self, PyObject *unused)
{
- SHAobject *newobj;
-
- if (Py_TYPE(self) == &SHA3type) {
- if ( (newobj = newSHA3object())==NULL)
- return NULL;
+ SHAobject *newobj = NULL;
+ if ((newobj = newSHA3object()) == NULL) {
+ return NULL;
}
SHAcopy(self, newobj);
return (PyObject *)newobj;
@@ -79,7 +80,7 @@ PyDoc_STRVAR(SHA3_digest__doc__,
static PyObject *
SHA3_digest(SHAobject *self, PyObject *unused)
{
- unsigned char digest[512];
+ unsigned char digest[MAX_DIGEST_SIZE];
SHAobject temp;
SHAcopy(self, &temp);
Please sign in to comment.
Something went wrong with that request. Please try again.