• Will BlowFish or TwoFish work with image data ?? I downloaded the latest SQL toolkit and Tried running TwoFish after modifying it to handle image data converted to varbinary(max). The data came back as NULL, instead of encrypted. Either I did something wrong (very likely), or there's some limitation in the DLL for length, or there's some other problem I don't understand.

    --modified fn_encrypt_twofish in the hopes it will work with bigger data

    CREATE FUNCTION [dbo].[fn_encrypt_twofish_max] (@plaintext VARBINARY(max),

    @localkeyname VARCHAR(128),

    @password VARCHAR(128),

    @keybits INT)

    RETURNS VARBINARY(max)

    AS

    BEGIN

    DECLARE @masterkey VARBINARY(64)

    DECLARE @localkey VARBINARY(80)

    SELECT @masterkey = m.[Key], @localkey = l.[Key]

    FROM dbo.Local_Key_Vault l, dbo.Master_Key_Vault m

    WHERE l.[name] = @localkeyname

    AND l.[master_key_name] = m.[name]

    DECLARE @enctext VARBINARY(max)

    EXEC dbo.xp_encrypt_twofish @plaintext, @enctext OUTPUT, @password, @masterkey, @localkey, @keybits

    RETURN @enctext

    END

    and then ran

    -- Encrypt data

    UPDATE MyTable

    SET VoiceData = cast(master.dbo.fn_encrypt_twofish_max(VoiceData ,

    'Local Key 1', NULL, 32) AS VARBINARY(max))

    Thoughts ?

    TIA