oracle Hashing:
SELECT sys.dbms_crypto.hash( utl_raw.cast_to_raw('hundkatzemaus'), 3 /*sys.dbms_crypto.hash_sh1*/)
from dual;
Oracle Verschlüsselung und Entschlüsselungsfunktion:
Create OR REPLACE FUNCTION crypt (
text IN VARCHAR2,
cryptmode IN VARCHAR2 DEFAULT 'E',
key IN VARCHAR2 DEFAULT 'MuniQSoft_Key'
) RETURN VARCHAR2 IS
p_typ PLS_INTEGER := 4360; --ENCRYPT_AES256+chain_cbc+ pad_pkcs5;
p_key VARCHAR2(512);
BEGIN
p_key := sys.UTL_I18N.STRING_TO_RAW(lpad(key,32,'-+'));
IF substr ( upper ( cryptmode ), 1, 1 )='E' THEN -- Verschlüsselung
RETURN (sys.dbms_crypto.encrypt(
src => sys.UTL_I18N.STRING_TO_RAW(text,'AL32UTF8'),
typ => p_typ, key => p_key));
ELSE -- Entschlüsselung
RETURN sys.UTL_I18N.RAW_TO_CHAR(
sys.dbms_crypto.decrypt(
src => text, typ => p_typ, key => p_key));
END IF;
END;
/