22#include <com/sun/star/lang/DisposedException.hpp>
23#include <rtl/digest.h>
34 xResult->m_pDigest = rtl_digest_createSHA1();
35 if ( !xResult->m_pDigest )
36 throw uno::RuntimeException(
"Can not create cipher!" );
54 throw lang::DisposedException();
56 if ( rtl_Digest_E_None != rtl_digest_updateSHA1(
m_pDigest,
aData.getConstArray(),
aData.getLength() ) )
61 throw uno::RuntimeException();
69 throw lang::DisposedException();
71 uno::Sequence< sal_Int8 > aResult( RTL_DIGEST_LENGTH_SHA1 );
72 if ( rtl_Digest_E_None != rtl_digest_getSHA1(
m_pDigest,
reinterpret_cast< sal_uInt8*
>( aResult.getArray() ), aResult.getLength() ) )
77 throw uno::RuntimeException();
101 std::scoped_lock aGuard(
m_Mutex);
103 throw lang::DisposedException();
105 m_Hash.
update(
reinterpret_cast<unsigned char const*
>(rData.getConstArray()), rData.getLength());
110 std::scoped_lock aGuard(
m_Mutex);
112 throw lang::DisposedException();
116 return uno::Sequence<sal_Int8>(
reinterpret_cast<sal_Int8 const*
>(sha1.data()), sha1.size());
virtual ~CorrectSHA1DigestContext() override
static css::uno::Reference< css::xml::crypto::XDigestContext > Create()
virtual void SAL_CALL updateDigest(const css::uno::Sequence<::sal_Int8 > &rData) override
CorrectSHA1DigestContext()
::comphelper::Hash m_Hash
virtual css::uno::Sequence<::sal_Int8 > SAL_CALL finalizeDigestAndDispose() override
virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL finalizeDigestAndDispose() override
static css::uno::Reference< css::xml::crypto::XDigestContext > Create()
StarOfficeSHA1DigestContext()
virtual ~StarOfficeSHA1DigestContext() override
virtual void SAL_CALL updateDigest(const css::uno::Sequence< ::sal_Int8 > &aData) override
std::vector< unsigned char > finalize()
void update(const unsigned char *pInput, size_t length)
constexpr OUStringLiteral aData