summaryrefslogtreecommitdiff
path: root/includes/BSHA1.h
blob: 55710b28ca5bcc980c861ec556a2ed51e1bc738e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <Exceptions.h>
#include <tomcrypt.h>

namespace Balau {

class SHA1 {
  public:
      SHA1() { reset(); }
    void reset() { sha1_init(&m_state); }
    void update(const uint8_t* data, const size_t len) { sha1_process(&m_state, data, len); }
    void final(uint8_t * digest) { sha1_done(&m_state, digest); }

    enum { DIGEST_SIZE = 20 };

  private:
    hash_state m_state;
};

};