diff options
author | Eike Rathke <erack@redhat.com> | 2018-02-26 22:02:50 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-02-26 22:03:42 +0100 |
commit | 94fa259e769b44f2c2ea7f1667b28f2c07489668 (patch) | |
tree | 1451c9c27a09dab3bb1738491a0f4cc7ee12fbba /comphelper | |
parent | 3c0189c7f04b9b457ed5621fef68fcb1843df891 (diff) |
Introduce DocPasswordHelper::GetOoxHashAsVector() with salt value vector
In preparation to use this in AgileEngine.
Change-Id: I45fb6ba24b759a72af0c7afa22eae75f1ae728ce
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/docpasswordhelper.cxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 8a35c33ca92d..3f470520fbf5 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -259,9 +259,9 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence( } -css::uno::Sequence<sal_Int8> DocPasswordHelper::GetOoxHashAsSequence( +std::vector<unsigned char> DocPasswordHelper::GetOoxHashAsVector( const rtl::OUString& rPassword, - const rtl::OUString& rSaltValue, + const std::vector<unsigned char>& rSaltValue, sal_uInt32 nSpinCount, comphelper::Hash::IterCount eIterCount, const rtl::OUString& rAlgorithmName) @@ -276,8 +276,19 @@ css::uno::Sequence<sal_Int8> DocPasswordHelper::GetOoxHashAsSequence( else if (rAlgorithmName == "MD5") eType = comphelper::HashType::MD5; else - return css::uno::Sequence<sal_Int8>(); + return std::vector<unsigned char>(); + + return comphelper::Hash::calculateHash( rPassword, rSaltValue, nSpinCount, eIterCount, eType); +} + +css::uno::Sequence<sal_Int8> DocPasswordHelper::GetOoxHashAsSequence( + const rtl::OUString& rPassword, + const rtl::OUString& rSaltValue, + sal_uInt32 nSpinCount, + comphelper::Hash::IterCount eIterCount, + const rtl::OUString& rAlgorithmName) +{ std::vector<unsigned char> aSaltVec; if (!rSaltValue.isEmpty()) { @@ -286,8 +297,7 @@ css::uno::Sequence<sal_Int8> DocPasswordHelper::GetOoxHashAsSequence( aSaltVec = comphelper::sequenceToContainer<std::vector<unsigned char>>( aSaltSeq); } - std::vector<unsigned char> hash( comphelper::Hash::calculateHash( rPassword, aSaltVec, nSpinCount, - eIterCount, eType)); + std::vector<unsigned char> hash( GetOoxHashAsVector( rPassword, aSaltVec, nSpinCount, eIterCount, rAlgorithmName)); return comphelper::containerToSequence<sal_Int8>( hash); } |