|
Encrypts data with the given password and a key by DESX algorithm.
Syntax
xp_desx_encrypt { variable1 [, variable2 , variable3
...] , password, key, encrypted_text OUTPUT
}
Arguments
variable1 [, variable2 , variable3 ...]
Variables which need to be encrypted
password
VARCHAR. Your hard password.
key
VARCHAR. Initializing key. Any random string you like. It must be exactly 8 chars.
clear_text
VARCHAR or VARBINARY. Variable for holding the output.
Permissions
Execute permissions default to the public role.
Return Code Values
0 - success, or Error code
if failed. encrypted_text IS NOT NULL (success) or IS NULL (failure)
Example
declare @encrypted varchar(8000)
declare @return_code int
exec xp_desx_encrypt 'clear','MyPassword','12345678',@encrypted OUTPUT
exec @return_code = xp_desx_decrypt @encrypted ,'MyPassword','12345678',@encrypted OUTPUT
if @return_code != 0
begin
raiserror ('DESX encryption failed!',16,10)
end
|
|