RE: how to calculate DigestValue

Hi Thomas,

A sha1 hash is 160 bits of binary data, or 20 bytes.  base64 takes 6-bit chunks of data and makes them into 8 bit chunks.  There's a little magic done at the end of the data, but 28 bytes is the correct size.

My guess is that you are converting 20 unicode characters with base64, not 20 bytes.

John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.


-----Original Message-----
From: Thomas Braun [mailto:ThoBr@t-online.de]
Sent: Tuesday, January 13, 2004 4:58 PM
To: w3c-ietf-xmldsig@w3.org
Subject: how to calculate DigestValue



Hello,

I'm trying to familiarize myself with xml-signatures.
When I try to reproduce the DigestValue of some examples I found, I never get a satisfying result. 
If I have understood the procedure of getting the digestvalue well, the things to do are:
- generate sha1-hash of the referenced object
- transform hash to base64 

All DigestValue-examples I've seen yet, have a base64 code-length of 28 chars.
But when I transform a sha1-hash into base64, the result has always a length of 56 chars. 

So I guess I'm lapsing something fundamental...

Thanks a lot,

Thomas

Received on Tuesday, 13 January 2004 20:37:29 UTC