diff --git a/tdutils/td/utils/crypto.cpp b/tdutils/td/utils/crypto.cpp index 3e54e673..90e1bbce 100644 --- a/tdutils/td/utils/crypto.cpp +++ b/tdutils/td/utils/crypto.cpp @@ -340,6 +340,12 @@ void sha256(Slice data, MutableSlice output) { CHECK(result == output.ubegin()); } +void sha512(Slice data, MutableSlice output) { + CHECK(output.size() >= 64); + auto result = SHA512(data.ubegin(), data.size(), output.ubegin()); + CHECK(result == output.ubegin()); +} + struct Sha256StateImpl { SHA256_CTX ctx; }; diff --git a/tdutils/td/utils/crypto.h b/tdutils/td/utils/crypto.h index 23ac694b..71fc3a86 100644 --- a/tdutils/td/utils/crypto.h +++ b/tdutils/td/utils/crypto.h @@ -48,6 +48,8 @@ void sha1(Slice data, unsigned char output[20]); void sha256(Slice data, MutableSlice output); +void sha512(Slice data, MutableSlice output); + struct Sha256StateImpl; struct Sha256State {