1 /* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 /** 9 * Hash functions, using the CityHash algorithm. 10 * 11 * Results are guaranteed to be: 12 * 1. consistent across revisions of the library (for a given set 13 * of bytes, the checksum generated at one revision of the Skia 14 * library will match the one generated on any other revision of 15 * the Skia library) 16 * 2. consistent across platforms (for a given 17 * set of bytes, the checksum generated on one platform will 18 * match the one generated on any other platform) 19 */ 20 21 #ifndef SkCityHash_DEFINED 22 #define SkCityHash_DEFINED 23 24 #include "SkTypes.h" 25 26 class SkCityHash : SkNoncopyable { 27 public: 28 /** 29 * Compute a 32-bit checksum for a given data block. 30 * 31 * @param data Memory address of the data block to be processed. 32 * @param size Size of the data block in bytes. 33 * @return checksum result 34 */ 35 static uint32_t Compute32(const char *data, size_t size); 36 37 /** 38 * Compute a 64-bit checksum for a given data block. 39 * 40 * @param data Memory address of the data block to be processed. 41 * @param size Size of the data block in bytes. 42 * @return checksum result 43 */ 44 static uint64_t Compute64(const char *data, size_t size); 45 }; 46 47 #endif 48