SQL Server
SQL Server
Example: SecureString.HashVal method
Demonstrates theHashVal method.
Chilkat SQL Server Downloads
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @success int
SELECT @success = 0
DECLARE @str int
EXEC @hr = sp_OACreate 'Chilkat.SecureString', @str OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
EXEC sp_OASetProperty @str, 'MaintainHash', 'sha256'
EXEC sp_OAMethod @str, 'Append', @success OUT, 'Hello World'
DECLARE @encodedHash nvarchar(4000)
EXEC sp_OAMethod @str, 'HashVal', @encodedHash OUT, 'base64'
PRINT @encodedHash
EXEC @hr = sp_OADestroy @str
END
GO