aboutsummaryrefslogtreecommitdiff
path: root/bpkg/checksum
blob: 3ef35cca1fe4416d5a89bfe9a42547a36e50bb63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// file      : bpkg/checksum -*- C++ -*-
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#ifndef BPKG_CHECKSUM
#define BPKG_CHECKSUM

#include <bpkg/types>
#include <bpkg/utility>

#include <bpkg/common-options>

namespace bpkg
{
  // Calculate SHA256 sum of the specified memory buffer in binary mode. Issue
  // diagnostics and throw failed if anything goes wrong.
  //
  string
  sha256 (const common_options&, const char* buf, size_t n);

  // The same but for a stream (if ifstream, open in binary mode).
  //
  string
  sha256 (const common_options&, istream&);

  // The same but for a file.
  //
  string
  sha256 (const common_options&, const path& file);
}

#endif // BPKG_CHECKSUM