// finalize and compute the final digest public sha1_t finish() { sha1_t result = new sha1_t(); sha1_global.sha1_final(ref m_context); sha1_global.sha1_digest(m_context, result.op()); return(result); }
} //const uint8_t *data // internal helpers //------------------------------------------------- // copyfrom - copy everything from another // collection //------------------------------------------------- void copyfrom(hash_collection src) { // copy flags directly m_flags = src.m_flags; // copy hashes m_has_crc32 = src.m_has_crc32; m_crc32 = src.m_crc32; m_has_sha1 = src.m_has_sha1; m_sha1 = src.m_sha1; // don't copy creators m_creator = null; }
//------------------------------------------------- // end - stop hashing //------------------------------------------------- void end() { //assert(m_creator != NULL); // finish up the CRC32 if (m_creator.m_doing_crc32) { m_has_crc32 = true; m_crc32 = m_creator.m_crc32_creator.finish(); } // finish up the SHA1 if (m_creator.m_doing_sha1) { m_has_sha1 = true; m_sha1 = m_creator.m_sha1_creator.finish(); } // nuke the creator //delete m_creator; m_creator = null; }
// SHA1-specific helpers //bool sha1(sha1_t &result) const { result = m_sha1; return m_has_sha1; } public void add_sha1(sha1_t sha1) { m_has_sha1 = true; m_sha1 = sha1; }