Skip Menu |

This queue is for tickets about the SHA256 CPAN distribution.

Report information
The Basics
Id: 1551
Status: open
Priority: 0/
Queue: SHA256

People
Owner: Nobody in particular
Requestors: bobmathews [...] alumni.calpoly.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.01
Fixed in: (no value)



Subject: garbage appended to digest
According to the Digest::SHA256 documentation, digest() should return a 32-, 48-, or 64-byte binary string. However, the returned string is always 64 bytes long. The extra bytes appear to be garbage from an uninitialized piece of memory. This is an annoyance. I've attached a simple patch to fix it.
--- sha256.xs.orig 2002-09-22 23:20:01.000000000 -0700 +++ sha256.xs 2002-09-22 23:20:42.000000000 -0700 @@ -106,18 +106,19 @@ case 256: sha_final(&context->u.sha_info); sha_unpackdigest(d_str, &context->u.sha_info); + ST(0) = sv_2mortal(newSVpv(d_str, 32)); break; case 384: sha_final512(&context->u.sha_info512); sha_unpackdigest384(d_str, &context->u.sha_info512); + ST(0) = sv_2mortal(newSVpv(d_str, 48)); break; default: sha_final512(&context->u.sha_info512); sha_unpackdigest512(d_str, &context->u.sha_info512); + ST(0) = sv_2mortal(newSVpv(d_str, 64)); break; } - - ST(0) = sv_2mortal(newSVpv(d_str, 64)); } int
On Mon Sep 23 02:41:03 2002, BOBMATH wrote: Show quoted text
> According to the Digest::SHA256 documentation, digest() should return > a 32-, 48-, or 64-byte binary string. However, the returned string > is always 64 bytes long. The extra bytes appear to be garbage from > an uninitialized piece of memory. This is an annoyance. I've > attached a simple patch to fix it.
Would you be interested in taking over this module to fix this?