Name
unix_crypt — hash a password with the host C library crypt(3)
Synopsis
varchar unix_crypt(
|
in password varchar, |
in salt any); |
Description
unix_crypt calls the host C library's
crypt(3) to hash password
using salt. The salt's leading characters select
the hashing scheme (traditional DES, MD5-crypt $1$,
SHA-256-crypt $5$, SHA-512-crypt
$6$, etc.) per the platform's crypt implementation.
Use only for compatibility with existing Unix-style password databases; new code should use the SHA-2 family of digest functions directly. This function is available on Unix builds only.
Parameters
password
The cleartext password string to hash. A SQL
NULL yields NULL.
salt
Either a salt string as accepted by crypt(3), or
an integer whose twelve low-order bits are encoded as a two-character
traditional DES salt in the alphabet
[a-zA-Z0-9./]. A SQL NULL yields
NULL.
Return Types
A varchar containing the crypt hash string returned by the host library.
Examples
Example 24.246. Hash a password with a traditional DES salt
SQL> select unix_crypt ('secret', 'ab');
SQL> select unix_crypt ('secret', 1234);