瀏覽代碼

LibCrypto: Add method to copy Crypto::Hash::Manager

Michiel Visser 1 年之前
父節點
當前提交
0db6e0449e
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Userland/Libraries/LibCrypto/Hash/HashManager.h

+ 9 - 0
Userland/Libraries/LibCrypto/Hash/HashManager.h

@@ -215,6 +215,15 @@ public:
         return m_kind == kind;
     }
 
+    inline Manager copy() const
+    {
+        Manager result;
+        result.m_algorithm = m_algorithm;
+        result.m_kind = m_kind;
+        result.m_pre_init_buffer = m_pre_init_buffer;
+        return result;
+    }
+
 private:
     using AlgorithmVariant = Variant<Empty, BLAKE2b, MD5, SHA1, SHA256, SHA384, SHA512>;
     AlgorithmVariant m_algorithm {};