diff --git a/tdutils/td/utils/crypto.cpp b/tdutils/td/utils/crypto.cpp index 083f28f6..f7898bc9 100644 --- a/tdutils/td/utils/crypto.cpp +++ b/tdutils/td/utils/crypto.cpp @@ -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; }; diff --git a/tdutils/td/utils/crypto.h b/tdutils/td/utils/crypto.h index b9d2d33d..5723c8e4 100644 --- a/tdutils/td/utils/crypto.h +++ b/tdutils/td/utils/crypto.h @@ -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 {