##// END OF EJS Templates
sha1dc: declare all variables at begininng of block...
Gregory Szorc -
r44541:c3f741bb default
parent child Browse files
Show More
@@ -84,13 +84,14 b' static PyObject *pysha1ctx_digest(pysha1'
84
84
85 static PyObject *pysha1ctx_hexdigest(pysha1ctx *self)
85 static PyObject *pysha1ctx_hexdigest(pysha1ctx *self)
86 {
86 {
87 static const char hexdigit[] = "0123456789abcdef";
87 unsigned char hash[20];
88 unsigned char hash[20];
89 char hexhash[40];
90 int i;
88 if (!finalize(self->ctx, hash)) {
91 if (!finalize(self->ctx, hash)) {
89 return NULL;
92 return NULL;
90 }
93 }
91 char hexhash[40];
94 for (i = 0; i < 20; ++i) {
92 static const char hexdigit[] = "0123456789abcdef";
93 for (int i = 0; i < 20; ++i) {
94 hexhash[i * 2] = hexdigit[hash[i] >> 4];
95 hexhash[i * 2] = hexdigit[hash[i] >> 4];
95 hexhash[i * 2 + 1] = hexdigit[hash[i] & 15];
96 hexhash[i * 2 + 1] = hexdigit[hash[i] & 15];
96 }
97 }
General Comments 0
You need to be logged in to leave comments. Login now