oracle 提供了wrap工具加密代码
语法如下:wrap iname=input_file oname=output_file
SELECT ascii('D') FROM dual;
SELECT ascii(' ') FROM dual;
-- create as a text file c: emp\unwrapped.sql
CREATE OR REPLACE FUNCTION unwrapped (namein VARCHAR2)
RETURN NUMBER IS
c PLS_INTEGER := 0;
j PLS_INTEGER;
l PLS_INTEGER;
BEGIN
l := LENGTH(namein);
FOR i IN 1.. l LOOP
c := c + ASCII(SUBSTR(namein, i, 1));
END LOOP;
RETURN c;
END unwrapped;
/
-- create as a text file c: emp\wrapped.sql
CREATE OR REPLACE FUNCTION wrapped (namein VARCHAR2)
RETURN NUMBER IS
c PLS_INTEGER := 0;
j PLS_INTEGER;
l PLS_INTEGER;
BEGIN
l := LENGTH(namein);
FOR i IN 1.. l LOOP
c := c + ASCII(SUBSTR(namein, i, 1));
END LOOP;
RETURN c;
END wrapped;
/
wrap iname=c: emp\wrapped.sql oname=c: emp\output.sql
SQL> @c: emp\unwrapped.sql
SQL> @c: emp\output.sql
set pagesize 0
SELECT text
FROM user_source
WHERE name = 'UNWRAPPED'
ORDER BY line;
SELECT text
FROM user_source
WHERE name = 'WRAPPED'
ORDER BY line;
如果需要修改wrapped后的代码,但是源码已经丢了,可以从网上找相应的工具解码
下面是我找到的一个:http://dl.dbank.com/c01lw8ztnn