aboutsummaryrefslogtreecommitdiffstats
path: root/util/digest/city_streaming.h
blob: f9c5209e0a8a801043a5825e122cf13ee6c52d07 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once
#include <util/digest/city.h>

/**
 *   (partially) streaming version of CityHash64 for large data.
 *   You need to know length and first/last 64 bytes.
 *   Those bytes should be passed twice: in constructor and thru process().
 *   Length must be STRICTLY larger than 64 bytes.
 *   XXX: Dont use CityHash64 if you can use something else and need streaming
 */
class TStreamingCityHash64 {
    ui64 x, y, z;
    std::pair<ui64, ui64> v, w;
    char UnalignBuf_[64];
    size_t UnalignBufSz_, Rest64_;

public:
    TStreamingCityHash64(size_t len, const char* head64, const char* tail64);
    void Process(const char* s, size_t avail);
    ui64 operator()();
};