[#56] Add separate checksum type

NeoFS uses different checksum algorithms. It looks like we need to explicitly
define what algorithm is used in each particular case.

Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
Stanislav Bogatyrev 2020-08-18 18:26:51 +03:00 committed by Stanislav Bogatyrev
parent 579a618f72
commit 526792324d
4 changed files with 29 additions and 5 deletions

View file

@ -385,6 +385,9 @@ message GetRangeHashRequest {
// Carries binary salt to XOR object payload ranges before hash calculation.
bytes salt = 3;
// Checksum algorithm type
neo.fs.v2.refs.ChecksumType type = 4;
}
// Body of get range hash object request message.
Body body = 1;
@ -402,8 +405,11 @@ message GetRangeHashRequest {
message GetRangeHashResponse {
// Response body
message Body {
// Carries list of homomorphic hashes in a binary format.
repeated bytes hash_list = 1;
// Checksum algorithm type
neo.fs.v2.refs.ChecksumType type = 1;
// List of range hashes in a binary format.
repeated bytes hash_list = 2;
}
// Body of get range hash object response message.
Body body = 1;

View file

@ -67,13 +67,13 @@ message Header {
uint64 payload_length = 5;
// Hash of payload bytes
bytes payload_hash = 6;
Checksum payload_hash = 6;
// Special object type
ObjectType object_type = 7;
// Homomorphic hash of the object payload.
bytes homomorphic_hash = 8;
Checksum homomorphic_hash = 8;
// Session token, if it was used during Object creation.
// Need it to verify integrity and authenticity out of Request scope.

View file

@ -47,3 +47,21 @@ message Signature {
// Signature
bytes sign = 2;
}
// Checksum algorithm type
enum ChecksumType {
// Unknown. Not used
CHECKSUM_TYPE_UNSPECIFIED = 0;
// Tillich-Zemor homomorphic hash funciton
TZ = 1;
// SHA-256
SHA256 = 2;
}
// Checksum message
message Checksum {
ChecksumType type = 1;
bytes sum = 2;
}

View file

@ -18,7 +18,7 @@ message StorageGroup {
// payloads of the storage group members
// The order of concatenation is the same as the order of the members in the
// Members field.
bytes validation_hash = 2;
Checksum validation_hash = 2;
// expiration_epoch carries last NeoFS epoch number of the storage group
// lifetime.