Easy to use SHA256 and SHA512 functions.
GitOrigin-RevId: f1d959e2ab69e7e176e705d16f05546a7ef33399
This commit is contained in:
parent
73aa76dc5f
commit
f92e25fcd9
@ -359,6 +359,18 @@ void sha512(Slice data, MutableSlice output) {
|
||||
CHECK(result == output.ubegin());
|
||||
}
|
||||
|
||||
string sha256(Slice data) {
|
||||
string result(32, '\0');
|
||||
sha256(data, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
string sha512(Slice data) {
|
||||
string result(64, '\0');
|
||||
sha512(data, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
struct Sha256StateImpl {
|
||||
SHA256_CTX ctx;
|
||||
};
|
||||
|
@ -64,6 +64,10 @@ void sha256(Slice data, MutableSlice output);
|
||||
|
||||
void sha512(Slice data, MutableSlice output);
|
||||
|
||||
string sha256(Slice data) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
string sha512(Slice data) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
struct Sha256StateImpl;
|
||||
|
||||
struct Sha256State {
|
||||
|
Reference in New Issue
Block a user