#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    2
    Rep Power
    0

    Unhappy Urgent Help Needed.....!


    hello all,

    i encrypted a word 'dtovzm' using oracle obfuscation encrypt function and code is

    declare

    g_key RAW(32767) := Utl_Raw.Cast_To_Raw('12345678');
    g_pad_chr VARCHAR2(6) := 'myson';
    v_units NUMBER;
    v_decrypted VARCHAR2(32767);
    p_text VARCHAR2(32767);
    v_encrypted RAW(32767);
    v_text VARCHAR2(32767);

    BEGIN

    IF Length('dtovzm') Mod 4 > 0 THEN
    v_units := Trunc(Length('dtovzm')/8) + 1;
    p_text := RPAD('dtovzm', v_units * 8, g_pad_chr);
    END IF;
    Dbms_Obfuscation_Toolkit.DesEncrypt(input => Utl_Raw.Cast_To_Raw(p_text),
    key => g_key,
    encrypted_data => v_encrypted);
    Dbms_Obfuscation_Toolkit.DesDecrypt(input => v_encrypted,
    key => g_key,
    decrypted_data => v_decrypted);
    dbms_output.put_line(RTrim(Utl_Raw.Cast_To_Varchar2(v_decrypted), g_pad_chr));

    END;
    /


    but ,by decrypting the word 'dtovzm' i am getting 'dtovz' only.
    here the the padding character is 'myson'.
    the word containg last letter 'm' is not decrypting ,please help me why it is not decrypting .......


    you can post the reply to mdurgadevi@yahoo.com also.
    thank you ...
  2. #2
  3. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    There is nothing wrong in your code, just take a look at this line that you have written at the end of your code:

    dbms_output.put_line(RTrim(Utl_Raw.Cast_To_Varchar2(v_decrypted), g_pad_chr));

    RTRIM (<c1>,<c2>) function takes two arguments, where c1 and c2 are character strings. This function returns c1 without any trailing characters that appear in c2. If no c2 character are triling character in c1, then c1 is returned unchanged. c2 defaults to a single space.

    now run this query:

    select RTRIM('dtovzm','myson') from dual
    /

    now store '######' to g_key_chr and then run your code.


    what you got !!!!!!!!!!!
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    2
    Rep Power
    0

    Thank You


    i got it....thank you..

IMN logo majestic logo threadwatch logo seochat tools logo