summaryrefslogtreecommitdiff
path: root/include/comphelper
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-02-24 11:45:34 +0100
committerEike Rathke <erack@redhat.com>2018-02-24 11:47:09 +0100
commit89182507aaf336d16ba1e89305bc2ea3b1e6949f (patch)
treecb3a96d942e0c2260d78372a889562817b9f08bf /include/comphelper
parent4446ac904ebaa0b2ba0fed17f2f8fd39d3a3c7fb (diff)
Hash Base64, Sequence and cleansing, tdf#104250 prep
Change-Id: I58d48b8caa780138b8431bec9db20c9d0e9abce7
Diffstat (limited to 'include/comphelper')
-rw-r--r--include/comphelper/hash.hxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/include/comphelper/hash.hxx b/include/comphelper/hash.hxx
index 07998ad02736..b3e97553060d 100644
--- a/include/comphelper/hash.hxx
+++ b/include/comphelper/hash.hxx
@@ -12,6 +12,8 @@
#include <comphelper/comphelperdllapi.h>
+#include <com/sun/star/uno/Sequence.hxx>
+
#include <memory>
#include <vector>
@@ -97,10 +99,33 @@ public:
that have a valid match in HashType. If not, an empty string is
returned. Not all algorithm names are supported.
+ @return the raw hash value as sal_Int8 sequence.
+ */
+ static css::uno::Sequence<sal_Int8> calculateHashSequence(
+ const rtl::OUString& rPassword,
+ const rtl::OUString& rSaltValue,
+ sal_uInt32 nSpinCount,
+ const rtl::OUString& rAlgorithmName);
+
+ /** Convenience function to calculate a salted hash with iterations.
+
+ @param rPassword
+ UTF-16LE encoded string without leading BOM character
+
+ @param rSaltValue
+ Base64 encoded salt that will be decoded and prepended to password
+ data.
+
+ @param rAlgorithmName
+ One of "SHA-512", "SHA-256", ... as listed in
+ https://msdn.microsoft.com/en-us/library/dd920692
+ that have a valid match in HashType. If not, an empty string is
+ returned. Not all algorithm names are supported.
+
@return the base64 encoded string of the hash value, that can be
compared against a stored base64 encoded hash value.
*/
- static rtl::OUString calculateHash(
+ static rtl::OUString calculateHashBase64(
const rtl::OUString& rPassword,
const rtl::OUString& rSaltValue,
sal_uInt32 nSpinCount,