Skip to content
API Documentation
BastionGuard™
HashUtil Class Reference

#include <HashUtil.hpp>

Static Public Member Functions

static std::string sha256 (const std::string &input)

Detailed Description

Definition at line 25 of file HashUtil.hpp.

Member Function Documentation

◆ sha256()

std::string HashUtil::sha256 ( const std::string & input)
static

Definition at line 27 of file HashUtil.cpp.

28{
29 unsigned char hash[SHA256_DIGEST_LENGTH];
30 SHA256(
31 reinterpret_cast<const unsigned char*>(input.c_str()),
32 input.size(),
33 hash
34 );
35
36 std::ostringstream oss;
37 for (int i = 0; i < SHA256_DIGEST_LENGTH; ++i) {
38 oss << std::hex
39 << std::setw(2)
40 << std::setfill('0')
41 << static_cast<int>(hash[i]);
42 }
43
44 return oss.str();
45}

Referenced by LeakMonitor::loop(), and LeakCheckWorker::run().


The documentation for this class was generated from the following files: