manipulating Digest state

Discussion in 'Ruby' started by leon breedt, Nov 5, 2004.

  1. leon breedt

    leon breedt Guest

    Hi,

    Perhaps this is not possible, but I was wondering if there was a way
    to save/load the state of a Digest. Not the digest value itself but
    the state that gives a particular digest value.

    Why?

    If I am retrieving some data, and update the digest as I receive
    bytes, it would be more efficient if I could store the state that
    would give me the digest of the data up to a certain point, as I can
    avoid rescanning the data when resuming an interrupted retrieval and
    just "resume" the digest update as well, especially as the file size
    increases.

    Is this at all feasible? (Leaving security/integrity concerns aside).

    Leon
    leon breedt, Nov 5, 2004
    #1
    1. Advertising

  2. On Fri, 5 Nov 2004 14:16:08 +0900, leon breedt <> wrote:
    > Hi,
    >
    > Perhaps this is not possible, but I was wondering if there was a way
    > to save/load the state of a Digest. Not the digest value itself but
    > the state that gives a particular digest value.


    Unless the Digest class is "special", you should be able to just data
    = Marshal.dump(digest) and restoire with Marshal.load(data).

    > Is this at all feasible? (Leaving security/integrity concerns aside).


    Yes. The security side is also fairly OK (primary new issues:
    Synchronized disk writes and access permissions to aborted fil;e and
    serialized Digest, and the increased corruption time window.)

    Eivind.
    --
    Hazzle free packages for Ruby?
    RPA is available from http://www.rubyarchive.org/
    Eivind Eklund, Nov 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    635
  2. Wayne Carlaw
    Replies:
    0
    Views:
    434
    Wayne Carlaw
    Mar 29, 2005
  3. Tammy Mc
    Replies:
    3
    Views:
    212
    Tammy Mc
    Oct 1, 2006
  4. myalo
    Replies:
    4
    Views:
    1,289
    A. Sinan Unur
    Nov 28, 2007
  5. Replies:
    2
    Views:
    329
    Julian Cromarty
    Jun 26, 2013
Loading...

Share This Page