class AWS::Glacier::ArchiveCollection

def compute_checksums data

but that requires reading the data a 2nd time. :(
The sigv4 module will compute the hash of the payload for us,

(via sigv4).
the simple hash is required for generating the signature
The tree hash is required by the streaming operations,

* a tree hash of the entire payload
* a hash of the entire payload
Computes two checksums in a single pass of the data:
def compute_checksums data
  digest = OpenSSL::Digest::Digest.new('sha256')
  tree_digest = OpenSSL::Digest::Digest.new('sha256')
  tree_parts = []
  until data.eof?
    chunk = data.read(1024 * 1024) # read 1MB
    tree_parts << tree_digest.update(chunk).digest
    tree_digest.reset
    digest.update(chunk)
  end
  data.rewind
  [digest.to_s, compute_tree_hash(tree_parts)]
end