summaryrefslogtreecommitdiffabout
path: root/src/eyetil.cc
Unidiff
Diffstat (limited to 'src/eyetil.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--src/eyetil.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eyetil.cc b/src/eyetil.cc
index 7669cb6..57ae607 100644
--- a/src/eyetil.cc
+++ b/src/eyetil.cc
@@ -70,6 +70,20 @@ binary_t binary_t::md5() const {
70 return rv; 70 return rv;
71} 71}
72 72
73void md5_digester::init() {
74 if(!MD5_Init(&ctx)) throw std::runtime_error("failed to MD5_Init()");
75}
76void md5_digester::update(const void *d,size_t l) {
77 if(!MD5_Update(&ctx,d,l)) throw std::runtime_error("failed to MD5_Update()");
78}
79binary_t md5_digester::final() {
80 binary_t rv(MD5_DIGEST_LENGTH);
81 if(!MD5_Final((unsigned char*)&(rv.front()), &ctx))
82 throw std::runtime_error("failed to MD5_Final()");
83 return rv;
84}
85
86
73static void make_path_for_template(const std::string& p,mode_t m) { 87static void make_path_for_template(const std::string& p,mode_t m) {
74 struct stat st; 88 struct stat st;
75 std::string pp; 89 std::string pp;