|
Creates UNIX compatible DES hash. Equivalent to UNIX crypt(1) and perl
crypt() function. Only first 8 chars from the source string are used. This is
a more historical than practical
hash.
Syntax
xp_crypt salt, clear_text, hash OUTPUT
Arguments
salt
VARCHAR.2 character salt used for hashing
clear_text
VARCHAR. Value which is to be hashed
hash
VARCHAR or VARBINARY. Variable to hold the result.
Permissions
Execute permissions default to the public role.
Return Code Values
0 - success, or Error code
if failed. hash IS NOT NULL (success) or IS NULL (failure) asymmetric
Example
declare @encrypted_password varchar(16)
declare
@salt varchar(2)
declare @clear_password varchar(16)
select
@salt='ab'
select @clear_password='seeme?'
exec
xp_crypt @salt,@clear_password,@encrypted_password OUTPUT
select @encrypted_password |
The output should be:
----------------
abbprBi2naCss
(1 row(s) affected)
|