-rw-r--r-- | src/eyetil.cc | 14 |
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 | |||
@@ -69,8 +69,22 @@ binary_t binary_t::md5() const { | |||
69 | throw std::runtime_error("failed to md5()"); | 69 | throw std::runtime_error("failed to md5()"); |
70 | return rv; | 70 | return rv; |
71 | } | 71 | } |
72 | 72 | ||
73 | void md5_digester::init() { | ||
74 | if(!MD5_Init(&ctx)) throw std::runtime_error("failed to MD5_Init()"); | ||
75 | } | ||
76 | void 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 | } | ||
79 | binary_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 | |||
73 | static void make_path_for_template(const std::string& p,mode_t m) { | 87 | static 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; |
76 | for(std::string::size_type sl=p.find('/',1); | 90 | for(std::string::size_type sl=p.find('/',1); |