求助2个oracle 的function,想要转换为mysql的function
大头爱放假 2016-02-28 09:26:30 如题
函数一:
create or replace function decrypt256(v_input raw) return varchar2
is
v_result raw(1999);
c_key char(32) := '1q2wa3es4rz5tx6ycD*UF8tif9ogjen2';
begin
v_result := DBMS_CRYPTO.DECRYPT(
v_input,
DBMS_CRYPTO.ENCRYPT_AES256+DBMS_CRYPTO.CHAIN_CBC+DBMS_CRYPTO.PAD_PKCS5,
UTL_I18N.STRING_TO_RAW(c_key, 'AL32UTF8'));
return UTL_I18N.RAW_TO_CHAR(v_result, 'AL32UTF8');
end;
函数2:
create or replace function encrypt256(v_input varchar2) return raw
is
v_result raw(1999);
c_key char(32) := '1q2wa3es4rz5tx6ycD*UF8tif9ogjen2';
begin
v_result := DBMS_CRYPTO.ENCRYPT(
UTL_I18N.STRING_TO_RAW(v_input, 'AL32UTF8'),
DBMS_CRYPTO.ENCRYPT_AES256+DBMS_CRYPTO.CHAIN_CBC+DBMS_CRYPTO.PAD_PKCS5,
UTL_I18N.STRING_TO_RAW(c_key, 'AL32UTF8'));
return v_result;
end;