Skip to content

Commit 9311038

Browse files
authored
fix hashing algorithm (#1373)
Signed-off-by: Oleg Avdeev <oleg.v.avdeev@gmail.com>
1 parent 94ce571 commit 9311038

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

docs/specs/online_store_format.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,15 @@ We use the following structure to store feature data in the Firestore:
7474

7575
Document id for the feature document is computed by hashing entity key using murmurhash3_128 algorithm as follows:
7676

77-
1. hash utf8-encoded entity names, sorted in alphanumeric order
78-
2. hash the entity values in the same order as corresponding entity names, by serializing them to bytes as follows:
79-
- binary values are hashed as-is
80-
- string values hashed after serializing them as utf8 string
77+
1. hash entity names, sorted in alphanumeric order, by serializing them to bytes using the Value Serialization steps below
78+
2. hash the entity values in the same order as corresponding entity names, by serializing them to bytes using the Value Serialization steps below
79+
80+
Value Serialization:
81+
* Store the type of the value (ValueType enum) as little-endian uint32.
82+
* Store the byte length of the serialized value as little-endian uint32
83+
* Store the serialized value as bytes:
84+
- binary values are serialized as is
85+
- string values serialized as utf8 string
8186
- int64 and int32 hashed as little-endian byte representation (8 and 4 bytes respectively)
8287
- bool hashed as 0 or 1 byte
8388

0 commit comments

Comments
 (0)