1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//use sha2::{Sha256, Digest};
use rand;
/// Hashing should work on utf8 and binary data.
/// It should not be possibly to submit many different colliding values easily, or performance may suffer.
/// This is achieved by using a secret salt and relying on a fast non-cryptographic hashing function.
/// If the hashing fucntion is changed, all databases need to re-intern all their strings, so don't change it.
// TODO @mverleg: Benchmark this! Not sure there's a choice but this shouldn't be the bottleneck.