summaryrefslogtreecommitdiff
path: root/src/authAlgoFactory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/authAlgoFactory.cpp')
-rw-r--r--src/authAlgoFactory.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/authAlgoFactory.cpp b/src/authAlgoFactory.cpp
index 8fa16fc..c284f34 100644
--- a/src/authAlgoFactory.cpp
+++ b/src/authAlgoFactory.cpp
@@ -38,13 +38,25 @@
AuthAlgo* AuthAlgoFactory::create(std::string const& type, kd_dir_t dir)
{
- if( type == "null" )
+ if(type == "null")
return new NullAuthAlgo();
#ifndef NO_CRYPT
- else if( type == "sha1" )
+ else if(type == "sha1")
return new Sha1AuthAlgo(dir);
#endif
else
throw std::invalid_argument("auth algo not available");
}
+u_int32_t AuthAlgoFactory::getDigestLength(std::string const& type)
+{
+ if(type == "null")
+ return NullAuthAlgo::DIGEST_LENGTH;
+#ifndef NO_CRYPT
+ else if(type == "sha1")
+ return Sha1AuthAlgo::DIGEST_LENGTH;
+#endif
+ else
+ throw std::invalid_argument("auth algo not available");
+}
+