Botan 3.5.0
Crypto and TLS for C&
md5.h
Go to the documentation of this file.
1/*
2* MD5
3* (C) 1999-2008 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#ifndef BOTAN_MD5_H_
9#define BOTAN_MD5_H_
10
11#include <botan/internal/mdx_hash.h>
12
13namespace Botan {
14
15/**
16* MD5
17*/
18class MD5 final : public HashFunction {
19 public:
21
24 static constexpr size_t block_bytes = 64;
25 static constexpr size_t output_bytes = 16;
26 static constexpr size_t ctr_bytes = 8;
27
28 static void compress_n(digest_type& digest, std::span<const uint8_t> input, size_t blocks);
29 static void init(digest_type& digest);
30
31 public:
32 std::string name() const override { return "MD5"; }
33
34 size_t output_length() const override { return output_bytes; }
35
36 size_t hash_block_size() const override { return block_bytes; }
37
38 std::unique_ptr<HashFunction> new_object() const override;
39
40 std::unique_ptr<HashFunction> copy_state() const override;
41
42 void clear() override { m_md.clear(); }
43
44 private:
45 void add_data(std::span<const uint8_t> input) override;
46
47 void final_result(std::span<uint8_t> output) override;
48
49 private:
51};
52
53} // namespace Botan
54
55#endif
secure_vector< uint32_t > digest_type
Definition md5.h:20
size_t hash_block_size() const override
Definition md5.h:36
static constexpr MD_Endian byte_endianness
Definition md5.h:22
size_t output_length() const override
Definition md5.h:34
static constexpr MD_Endian bit_endianness
Definition md5.h:23
static constexpr size_t block_bytes
Definition md5.h:24
static constexpr size_t output_bytes
Definition md5.h:25
static constexpr size_t ctr_bytes
Definition md5.h:26
void clear() override
Definition md5.h:42
std::string name() const override
Definition md5.h:32
static void compress_n(digest_type &digest, std::span< const uint8_t > input, size_t blocks)
Definition md5.cpp:62
std::unique_ptr< HashFunction > copy_state() const override
Definition md5.cpp:154
std::unique_ptr< HashFunction > new_object() const override
Definition md5.cpp:150
int(* init)(CTX *)
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61
MD_Endian
Definition mdx_hash.h:20