Imported Upstream version 17.22.1
[platform/upstream/libzypp.git] / zypp / Digest.h
index 4b1937f..6e6075e 100644 (file)
 
 #include <string>
 #include <iosfwd>
+#include <vector>
 
-#include <zypp/Callback.h>
-#include <zypp/Pathname.h>
+#include "zypp/Callback.h"
+#include "zypp/Pathname.h"
 
 namespace zypp {
 
@@ -59,8 +60,14 @@ namespace zypp {
        static const std::string & md5();
        /** sha1 */
        static const std::string & sha1();
+       /** sha224 */
+       static const std::string & sha224();
        /** sha256 */
        static const std::string & sha256();
+       /** sha384 */
+       static const std::string & sha384();
+       /** sha512 */
+       static const std::string & sha512();
        //@}
 
       public:
@@ -92,6 +99,13 @@ namespace zypp {
         * */
        bool update(const char* bytes, size_t len);
 
+        /** \brief feed data into digest computation algorithm
+        * @param is
+        * @param bufsize
+        * @return whether an error occured
+        * */
+        bool update(std::istream& is, size_t bufsize = 4096);
+
        /** \brief get hex string representation of the digest
         *
         * this function will finalize the digest computation. calls to update
@@ -101,6 +115,28 @@ namespace zypp {
         * */
        std::string digest();
 
+        /** \brief get hex string representation of the digest vector given as parameter
+        *
+        * @return hex string representation of the digest
+        * */
+        static std::string digestVectorToString ( const std::vector<unsigned char> &vec );
+
+       /** \brief get vector of unsigned char representation of the digest
+        *
+        * this function will finalize the digest computation. calls to update
+        * after this function will start from scratch
+        *
+        * @return vector representation of the digest
+        * */
+       std::vector<unsigned char> digestVector();
+
+       /** \brief reset internal digest state
+        *
+        * this function is equivalent to calling create() with an unchanged name,
+        * but it may be implemented in a more efficient way.
+        */
+       bool reset();
+
        /** \brief compute digest of a stream. convenience function
         *
         * calls create, update and digest in one function. The data for the