void device_image_interface::device_compute_hash(hash_collection &hashes, const void *data, size_t length, const char *types) const { /* retrieve the partial hash func */ device_image_partialhash_func partialhash = get_partial_hash(); /* compute the hash */ if (partialhash) partialhash(hashes, (const unsigned char*)data, length, types); else hashes.compute(reinterpret_cast<const UINT8 *>(data), length, types); }
void device_image_interface::image_checkhash() { device_image_partialhash_func partialhash; /* only calculate CRC if it hasn't been calculated, and the open_mode is read only */ if (m_hash.first() == NULL && m_readonly && !m_created) { /* do not cause a linear read of 600 megs please */ /* TODO: use SHA1 in the CHD header as the hash */ if (image_type() == IO_CDROM) return; /* Skip calculating the hash when we have an image mounted through a software list */ if ( m_software_info_ptr ) return; /* retrieve the partial hash func */ partialhash = get_partial_hash(); run_hash(partialhash, m_hash, hash_collection::HASH_TYPES_ALL); } return; }
void device_image_interface::image_checkhash() { device_image_partialhash_func partialhash; // only calculate CRC if it hasn't been calculated, and the open_mode is read only UINT32 crcval; if (!m_hash.crc(crcval) && is_readonly() && !m_created) { // do not cause a linear read of 600 megs please // TODO: use SHA1 in the CHD header as the hash if (image_type() == IO_CDROM) return; // Skip calculating the hash when we have an image mounted through a software list if ( m_software_info_ptr ) return; // retrieve the partial hash func partialhash = get_partial_hash(); run_hash(partialhash, m_hash, util::hash_collection::HASH_TYPES_ALL); } return; }