Mercurial > foo_out_sdl
comparison foosdk/sdk/foobar2000/SDK/hasher_md5.cpp @ 1:20d02a178406 default tip
*: check in everything else
yay
| author | Paper <paper@tflc.us> |
|---|---|
| date | Mon, 05 Jan 2026 02:15:46 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:e9bb126753e7 | 1:20d02a178406 |
|---|---|
| 1 #include "foobar2000-sdk-pch.h" | |
| 2 #include "hasher_md5.h" | |
| 3 | |
| 4 GUID hasher_md5::guid_from_result(const hasher_md5_result & param) | |
| 5 { | |
| 6 static_assert(sizeof(GUID) == sizeof(hasher_md5_result), "sanity"); | |
| 7 GUID temp = * reinterpret_cast<const GUID*>(¶m); | |
| 8 byte_order::order_le_to_native_t(temp); | |
| 9 return temp; | |
| 10 } | |
| 11 | |
| 12 GUID hasher_md5_result::asGUID() const { | |
| 13 return hasher_md5::guid_from_result( *this ); | |
| 14 } | |
| 15 | |
| 16 hasher_md5_result hasher_md5::process_single(const void * p_buffer,t_size p_bytes) | |
| 17 { | |
| 18 hasher_md5_state state; | |
| 19 initialize(state); | |
| 20 process(state,p_buffer,p_bytes); | |
| 21 return get_result(state); | |
| 22 } | |
| 23 | |
| 24 GUID hasher_md5::process_single_guid(const void * p_buffer,t_size p_bytes) | |
| 25 { | |
| 26 return guid_from_result(process_single(p_buffer,p_bytes)); | |
| 27 } | |
| 28 | |
| 29 t_uint64 hasher_md5_result::xorHalve() const { | |
| 30 #if PFC_BYTE_ORDER_IS_BIG_ENDIAN | |
| 31 t_uint64 ret = 0; | |
| 32 for(int walk = 0; walk < 8; ++walk) { | |
| 33 ret |= (t_uint64)((t_uint8)m_data[walk] ^ (t_uint8)m_data[walk+8]) << (walk * 8); | |
| 34 } | |
| 35 return ret; | |
| 36 #else | |
| 37 const t_uint64 * v = reinterpret_cast<const t_uint64*>(&m_data); | |
| 38 return v[0] ^ v[1]; | |
| 39 #endif | |
| 40 } | |
| 41 | |
| 42 pfc::string8 hasher_md5_result::asString() const { | |
| 43 return pfc::format_hexdump( this->m_data, sizeof(m_data), ""); | |
| 44 } | |
| 45 | |
| 46 GUID hasher_md5_result::toGUID() const { | |
| 47 return hasher_md5::guid_from_result( *this ); | |
| 48 } |
