duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

md5_digest.h (565B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 #include "types.h"
      6 
      7 #include <array>
      8 #include <span>
      9 
     10 class MD5Digest
     11 {
     12 public:
     13   static constexpr u32 DIGEST_SIZE = 16;
     14 
     15   MD5Digest();
     16 
     17   void Update(const void* pData, u32 cbData);
     18   void Update(std::span<const u8> data);
     19   void Final(std::span<u8, DIGEST_SIZE> digest);
     20   void Reset();
     21 
     22   static std::array<u8, DIGEST_SIZE> HashData(std::span<const u8> data);
     23 
     24 private:
     25   u32 buf[4];
     26   u32 bits[2];
     27   u8 in[64];
     28 };