On Mon, Jun 07, 2010, Jason Fister wrote:

> Hello folks,
> 
> I have a service to which people can send data. My service then stores the
> data and returns the SHA checksum for the data back to the client. I also
> store the checksum I computed and the offset at which it was computed as
> part of the metadata.
> 
> I want to allow clients to send append requests to this data at a later
> time. When they send the append request, I want to be able to use the
> checksum that I had already calculated as the starting point and then use
> that to generate the new checksum for the appended object.
> 
> I know about the init, update and final functions. But I dont see a way to
> pass in the checksum value of the original object when computing the
> checksum of the new appended object.
> 
> Can someone tell me how I can achive the above?
> 

You mean you want to do:

SHA1(A)

and later do:

SHA1(A || B)

without including A again?

The hash itself does not contain enough information to continue in that
fashion. You'd need to store the actual hash context. There isn't a standard
OpenSSL function to this you'd need to delve into the internals a little and
copy the flat context somewhere and later restore.

So you'd do something like...

init
update(A)
save_context
hash_A = final

init
restore_context
update(B)
hash_AB=final

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to