Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
cet::sha1 Class Reference

#include <sha1.h>

Public Types

using uchar = unsigned char
 
using digest_t = std::array< uchar, digest_sz >
 

Public Member Functions

 sha1 ()
 
 sha1 (std::string const &mesg)
 
 sha1 (char const mesg)
 
void reset ()
 
sha1operator<< (std::string const &mesg)
 
sha1operator<< (char const mesg)
 
digest_t digest ()
 

Static Public Attributes

static std::size_t constexpr digest_sz {20}
 

Private Attributes

SHA_CTX context
 

Detailed Description

Definition at line 26 of file sha1.h.

Member Typedef Documentation

using cet::sha1::digest_t = std::array<uchar, digest_sz>

Definition at line 30 of file sha1.h.

using cet::sha1::uchar = unsigned char

Definition at line 29 of file sha1.h.

Constructor & Destructor Documentation

sha1::sha1 ( )

Definition at line 5 of file sha1.cc.

6 {
7  reset();
8 }
void reset()
Definition: sha1.cc:23
sha1::sha1 ( std::string const &  mesg)
explicit

Definition at line 10 of file sha1.cc.

11 {
12  reset();
13  operator<<(mesg);
14 }
sha1 & operator<<(std::string const &mesg)
Definition: sha1.cc:29
void reset()
Definition: sha1.cc:23
sha1::sha1 ( char const  mesg)
explicit

Definition at line 16 of file sha1.cc.

17 {
18  reset();
19  operator<<(mesg);
20 }
sha1 & operator<<(std::string const &mesg)
Definition: sha1.cc:29
void reset()
Definition: sha1.cc:23

Member Function Documentation

sha1::digest_t sha1::digest ( )

Definition at line 45 of file sha1.cc.

46 {
47  digest_t result{{}};
48  SHA1_Final(&result[0], &context);
49  return result;
50 }
static QCString result
std::array< uchar, digest_sz > digest_t
Definition: sha1.h:30
SHA_CTX context
Definition: sha1.h:43
sha1 & sha1::operator<< ( std::string const &  mesg)

Definition at line 29 of file sha1.cc.

30 {
31  auto data = reinterpret_cast<uchar const*>(&mesg[0]);
32  SHA1_Update(&context, data, mesg.size());
33  return *this;
34 }
unsigned char uchar
Definition: nybbler.cc:11
SHA_CTX context
Definition: sha1.h:43
sha1 & sha1::operator<< ( char const  mesg)

Definition at line 37 of file sha1.cc.

38 {
39  auto data = reinterpret_cast<uchar const*>(&mesg);
40  SHA1_Update(&context, data, 1u);
41  return *this;
42 }
unsigned char uchar
Definition: nybbler.cc:11
SHA_CTX context
Definition: sha1.h:43
void sha1::reset ( )

Definition at line 23 of file sha1.cc.

24 {
25  SHA1_Init(&context);
26 }
SHA_CTX context
Definition: sha1.h:43

Member Data Documentation

SHA_CTX cet::sha1::context
private

Definition at line 43 of file sha1.h.

std::size_t constexpr cet::sha1::digest_sz {20}
static

Definition at line 28 of file sha1.h.


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