예제 #1
0
            }                                                                                                                                //void compute(const uint8_t *data, uint32_t length, const char *types = nullptr) { begin(types); buffer(data, length); end(); }

            // 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;
            }
예제 #2
0
            //-------------------------------------------------
            //  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;
            }