Asylo
sha256_hash_util.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Asylo authors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef ASYLO_CRYPTO_SHA256_HASH_UTIL_H_
20 #define ASYLO_CRYPTO_SHA256_HASH_UTIL_H_
21 
22 #include <cstdint>
23 #include <string>
24 
25 #include "asylo/crypto/sha256_hash.pb.h"
26 #include "asylo/util/statusor.h"
27 
28 namespace asylo {
29 
30 /// Returns a `Sha256HashProto` with the hash of the given |hash_hex|, or a
31 /// non-OK Status if the provided string is an invalid hex-encoded SHA-256 hash.
33 
34 /// Validates that |hash_proto| has a hash that is exactly 32 bytes.
36 
37 /// Compares two `Sha256HashProto` messages for equality.
38 bool operator==(const Sha256HashProto &lhs, const Sha256HashProto &rhs);
39 
40 /// Compares two `Sha256HashProto` messages for inequality.
41 bool operator!=(const Sha256HashProto &lhs, const Sha256HashProto &rhs);
42 
43 } // namespace asylo
44 
45 #endif // ASYLO_CRYPTO_SHA256_HASH_UTIL_H_
ABSL_CONST_INIT const char kStatusMoveAssignmentMsg[]
bool operator==(const Sha256HashProto &lhs, const Sha256HashProto &rhs)
Compares two Sha256HashProto messages for equality.
bool operator!=(const Sha256HashProto &lhs, const Sha256HashProto &rhs)
Compares two Sha256HashProto messages for inequality.
StatusOr< Sha256HashProto > CreateSha256HashProto(absl::string_view hash_hex)
Returns a Sha256HashProto with the hash of the given |hash_hex|, or a non-OK Status if the provided s...
Status ValidateSha256HashProto(const Sha256HashProto &hash_proto)
Validates that |hash_proto| has a hash that is exactly 32 bytes.