MD5 Encryption on UTF8 database on NVARCHAR datatype column

DECLARE
l_string NVARCHAR2(600) := '123456';
checksum NVARCHAR2(600);
BEGIN
DBMS_OUTPUT.DISABLE;
DBMS_OUTPUT.ENABLE(1000000);
DBMS_OBFUSCATION_TOOLKIT.md5 (input_string => l_string, checksum_string => checksum);
DBMS_OUTPUT.PUT_LINE(RAWTONHEX(utl_raw.cast_to_raw(checksum)));
END;
Expected value: e10adc3949ba59abbe56e057f20f883e
But it returns: FFFD00390049FFFD0059FFFDFFFD0056FFFD000FFFFD003E
Note I want to maintain nvarchar2 datatype. The value from checksum variable gets stored in column that is of type nvarchar2.
I am aware that md5 accepts and returns data in varchar2. But if someone can help me figure this out using nvarchar2 data type, that would be great.
The NLS_CHARACTERSET = AL32UTF8

Welcome to the forums. I agree with Prabodh that the APEX group may not be an idea location to ask this question. Because you are doing things with DBMS_OBFUSCATION_TOOLKIT I'd even try those types of questions in the "Database Security - General" forum which is even more specialized than the SQL/PLSQL group in this regard.
Your question is off to a great start with an easily reproducible test case. You are probably better off with DBMS_CRYPTO which is available in 10g. It's newer, bigger, better and most likely has better support for needs. I did a quick test:
SQL> l
  1  declare
  2  l_string varchar2(600) := '123456';
  3  checksum   nvarchar2(600);
  4  l_hashlower   nvarchar2(600);
  5
  6  begin
  7
  8   checksum := dbms_crypto.hash (utl_raw.cast_to_raw(l_string),2); -- 2 is md5
  9   l_hashlower := lower(rawtohex(checksum));
10
11    dbms_output.put_line('md5hash: ' || checksum);
12    dbms_output.put_line('md5hash-lower: ' || l_hashlower);
13
14* end;
SQL> /
md5hash: E10ADC3949BA59ABBE56E057F20F883E
md5hash-lower: e10adc3949ba59abbe56e057f20f883e
PL/SQL procedure successfully completed.Good luck.

Similar Messages

  • Create index for the NVARCHAR Datatype columns.

    We have facing problem with NVARCHAR datatype columns during the select with WHERE condition . The Index is not getting used even though index is available. Oracle takes FULL table Scan only .
    For Eg:
    Table created with ITEM_NO as NVARCHAR2(100). and we have create normal index on ITEM_NO
    When I capture the run time sql from the v$session and checked SQL plan it show FULL Table scan.Sql is as below
    SELECT col1, col2, col3 from table x
    WHERE ITEM_NO=N'123'
    If ithe abvove sql is changed as below .It takes the Index
    SELECT col1, col2, col3 from table x
    WHERE ITEM_NO='123'
    Can any one advise why this behaviour is happing
    Regards
    Chandrasekar

    the second statement is transformed to <convert to varchar2>(item_no)='123'.
    This means Oracle can't take the index as there is a function on the indexed column.
    This is likely version-dependent, reason why you always, really always need to specify your four digit version
    Solution: always use N'<hardcoded literal'.
    Sybrand Bakker
    Senior Oracle DBA

  • MD5 encryption problems

    Hi all,
    I'm looking for a MD5 encryption with objective-c on my iPhone.
    I'm using an NSString extensions like that:
    #import <CommonCrypto/CommonDigest.h>
    @implementation NSString (MD5)
    - (NSString*)MD5
        // Create pointer to the string as UTF8
        const char *ptr = [self UTF8String];
        // Create byte array of unsigned chars
        unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
        // Create 16 byte MD5 hash value, store in buffer
        CC_MD5(ptr, strlen(ptr), md5Buffer);
        // Convert MD5 value in the buffer to NSString of hex values
        NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
        for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
            [output appendFormat:@"%02x",md5Buffer[i]];
        return output;
    @end
    but I'm not able to understand why the script stop to run calling CC_MD5 function.
    XCode error is
    can't resolve symbol _CC_MD5 in /var/mobile/...... because dependent dylib #1 could not be loaded
    I can't found the CommonCrypto framework and so I have included libcommonCrypto.dylib.
    What's appening?
    Thanks in advantage!
    Oz

    Are you merging the passwd and shadow files?
    In the /var/yp/Makefile on the NIS server look for the line:
    MERGE_PASSWD=
    it probably needs to be set to true.
    Keep in mind, you may want to use a passwd.adjunt map to reduce the exposure of encrypted passwords.
    We are running or NIS server on RHEL 4.7 so your mileage my vary a little.
    Jeff
    PS: I posted this exact answer on another thread.

  • What are the third party tools available for Encryption in Oracle database?

    Dear All,
    Can you please help me with the below question?
    What are the third party tools available for Encryption in Oracle database? Please let me know if you know their feedback and also licensing/cost information

    Why would you spend money to purchase a third-party tool that will be, almost by definition, less secure than the tools inside the product you already own and paid for?
    http://www.morganslibrary.org/reference/pkgs/dbms_crypto.html
    But were I to have any to recommend one I would not do so without knowing information you seem to consider unimportant such as:
    1. Operating system
    2. Database edition and version
    3. What type of data needs to be secured
    4. What level of security is required

  • Indexing Word document in UTF8 database

    Hello,
    have anybody experience with database created with character set UTF8
    (Unicode) and indexing formatted documents like MS Word, Powerpoint, Adobe
    Acrobat etc.?
    When I'm indexing Word document in non UTF8 database it's OK, in UTF8
    database indexing runs without error but searching does not work (in
    'DR$<index_name>I' table are unreadable strings - tokens).
    Is there any possibility in indexing to specify filter preferences
    INSO_FILTER and CHARSET_FILTER together?
    Thanks!
    Best Regards
    Jiri Salvet
    [email protected]
    null

    I'm using Oracle 8.1.6 on Windows2000. If You have any information about problem with INSO filter on that platform, please send it me.

  • Forms 6i Against 9i UTF8 database with NLS_LENGTH_SEMANTICS = CHAR

    Hi all,
    I have a 9.2.0.4 database which was created with a character set of UTF8.
    I want to start storing multibyte characters in this database so I changed the init.ora parameter NLS_LENGTH_SEMANTICS to CHAR and restarted.
    I then installed my application into the database and all the definitions have correctly been created using CHAR length semantics.
    The client to this application is Forms 6i but I am having serious problems compiling it against the application schema.
    When I open a pll library and try to compile I get Error 201 for every %type variable declaration and also for server based packages.
    I am definitely connected and to the correct schema where the objects all exist.
    I have another application schema - identical except that it was created before I made the change to NLS_LENGTH_SEMANTICS so it uses BYTE. When I compile the same library connected to this schema there are no problems.
    Also, if I try to connect to the CHAR schema using Forms (i.e. 8.0.6) SQL*Plus it crashes with a Windows Application Error. If I connect with a 9.2.0.1 SQL*Plus its fine.
    My question is should it be possible to compile a 6i Form against a UTF8 database with CHAR NLS length semantics at all? Have I done something wrong or am I barking up the wrong tree? Has anyone else tried this?
    Many thanks in advance,
    Kevin.

    Hi,
    Thanks for the responses but I don't think you're quite right. Forms 6i should indeed work with Unicode as a database character set as long as it is UTF8 rather than AL32UTF8. This can be seen in various Metalink documents and also in the Release 6i Guidelines for Building Applications here (section 4.1.5):
    http://download-west.oracle.com/otn_hosted_doc/forms/forms/A73073_01.pdf
    The problems started when I changed NLS_LENGTH_SEMANTICS to CHAR. Its understandable if Forms 6i does not recognise this setting as it pre-dates it but I wanted to confirm this.
    We want to migrate our existing application to work with multibyte characters. Unfortunately there are table columns, PL/SQL variables etc. that are too small when defined as a length in bytes.
    I am looking for the least impact method to rectify this. On the server I can use NLS_LENGTH_SEMANTICS but if I can't get Forms to work with it then I may need to rethink.
    I realise that using Forms 9i or 10g would support the parameter but it is not possible to upgrade at the moment.
    Has anyone any other suggestions or methods for migrating an application to using multibyte characters?
    Thanks again,
    Kevin.

  • Cannot run a UNICODE kernel against a non-UTF8 database

    Hi,
    I am trying to install SAP ECC 6.0 SR2 . am using  windows 2003 server oracle 10g db.
    please help me how to resolve this...
    sapparam: sapargv( argc, argv) has not been called.
    sapparam(1c): No Profile used.
    sapparam: SAPSYSTEMNAME neither in Profile nor in Commandline
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe: START OF LOG: 20100717144107
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe: sccsid @(#) $Id: //bas/700_REL/src/R3ld/R3load/R3ldmain.c#13 $ SAP
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe: version R7.00/V1.4 [UNICODE]
    Compiled Jul 17 2007 01:28:45
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe -testconnect
    DbSl Trace: ORA-1403 when accessing table SAPUSER
    DbSl Trace: Cannot run a UNICODE kernel against a non-UTF8 database (charset = AL32UTF8)
    (DB) ERROR: db_connect rc = 256
    DbSl Trace: Default conn.: already connected to DEV
    (DB) ERROR: DbSlErrorMsg rc = 29
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe: job finished with 1 error(s)
    D:\usr\sap\DEV\SYS\exe\uc\NTI386\R3load.exe: END OF LOG: 20100717144108

    Reinstallae the server .problem solved thanks to 3everyone

  • SUPKeyVault - Encryption of Local Database.

    Hi,
    Has anyone tried to encrypt the local database using the SUP APIs ?
    The documentation says we need to unlock the KeyVault when an application is launched for the first time and
    set the encryption key to the SUPConnectionProfile of the database.
    When we do a   SUPKeyVault * keyVault = [SUPKeyVault getSUPKeyVault:@"1000"]; , the keyVault is unlocked no matter what parameter we pass it to the getSUPKeyVault method. The documentation also says to get the key from the keyVault and set it to the connection profile by using  [cp setEncryptionKey:dbKey], where dbKey is the key obtained from the keyVault. Can anyone throw light on this as there is no much clarity in the documentation.

    Just to add few more info,
    When I set the encryption key using cp = [SUPDB getConnectionProfile] and then
    [cp setEncryptionKey:@"test"];
    and try to start the Message Client, I get this error in the console.
    "There is an exception file is encrypted or is not a database
    SUPTest MBODebugLogger: SUPPersistenceException SUPPersistenceException from find: -- sup_sqlite_db_StatementWrapperImpl: There is an exception null value for sqlite3_stmt

  • Compile Form against UTF8 Database

    Hello,
    Is it necessary to compile a Form against UTF8 Database to run it against UTF8 Database?
    I'm on Forms 10.1.2.0.2 and Database 10.2.0.3.
    Database Parameters are:
    NLS_CHARSET=UTF8
    NLS_LENGTH_SEMANTICS=CHAR
    Can I compile a Form against WE8MSWIN1252 Database (NLS_LENGTH_SEMANTICS Parameter of the DB is also set to CHAR and when compiling the form the environment variable is also set to CHAR), and run the form against UTF8 Database (including the needed .env file in the formsweb.cfg), or do I have to set NLS_LANG and recompile the form against UTF8 database?
    thx and regards,
    Christian

    Well I thought that I have to ask support...But I hoped someone had some experiences with that.
    But here are some troubles I had with UTF8, maybe it helps someone, if not it's a nice type-in training ;-):
    We had some very strange behaviours regarding forms with UTF8 databases, so the first believe was, that I have to generate against UTF8 database.
    Well - the bad thing was the NLS_LENGTH_SEMANTICS parameter, which we set to CHAR for UTF8, and also for WE8, for the reason that a VARCHAR2(255) can really contain 255 chars, and not maybe 255/3 chars...
    As the strange "Signature of Package has been changed" error which occured in UTF8 also occured in WE8, I did some researches.
    The problem occured, when I had a record type (no %rowtype, no %type) declared in a database package spec, instanciated in forms, and given as a parameter to another stored procedure.
    scenario:
    forms compiled with NLS_LENGTH_SEMANTICS=CHAR, the package created and compiled with NLS_LENGTH_SEMANTICS=CHAR; => correct behaviour.
    now in sqlplus:
    alter session set NLS_LENGTH_SEMANTICS=BYTE;
    alter package <recordpackage> compile;
    and run the form again => ora-4062.
    but as said: after some time this behaviour also happened in WE8.... Charset, and at the moment I didn't have any other troubles...hm...I'll have to do some checks.
    but thanks for your response
    regards

  • Column width in jDeveloper on UTF8 database

    I'm using jDeveloper (10.1.3) on a 10g database (10.1.0.2) with a UTF8 characterset.
    All character columns show 3 times the actual width in jDeveloper.
    Is there a way to tell jDeveloper to deal with this situation?
    P.S. NLS_LENGTH_SEMANTICS = CHAR, which is not the default.

    Hi Westerla,
    Character semantics has not been supported in JDeveloper 10.1.3, yet.
    In UTF8 database, 1 char = 3 byte. This is the reason you have 3 times length text field.
    Possible workaround is to update size of inputText.

  • How to compare the date value with the date datatype column?

    Hi,
    I am executed a query to get output for the particular date in two different database.
    I got output in one db environment, but in the another environment i didnt get the output.
    APP_DECISION_DATE column contains date datatype
    ex:
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE = TO_DATE('23-JAN-07',
    'DD-MON-YY'); 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060106 SYSTEM
    DATABASE - II
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE=
    TO_DATE('31-JAN-2007','DD-MON-RRRR') and application_id=2007010028552;
    no rows selected
    in the same db i got the output while i used the TO_DATE(APP_DECISION_DATE)
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where TO_DATE(APP_DECISION_DATE)=
    TO_DATE('31-JAN-2007','DD-MON-YYYY') and application_id=2007010028552; 2
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    is it necessary to use TO_DATE function while i am using the data datatype column in the WHERE CLAUSE?
    Thanks in advance.
    siva

    Sorry & thanks sathish,
    Now i got the result.
    SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE BETWEEN TO_DATE ('31.01.2007 00:00:00', 'DD.MM.YYYY HH24:MI:SS') AND TO_DATE ('31.01.2007 23:59:59', 'DD.MM.YYYY HH24:MI:SS')
    2 and application_id=2007010028552;
    DECISIONED_STAGE_ID DECISIONED_STAG
    2006060113 SYSTEM
    ================================
    But one doubt,
    When i created the column with the date datatype how it gets the time value,
    And in one environment db i got the result but in another environment i dont get,
    Shall i want to change any session status of date?

  • Update LONG datatype columns

    Can anyone point me to a description on how I can update a column of datatype LONG.
    I will be using a stored procedure/cursor and need to be able to append a string variable to the end of a LONG datatype column that will have other text.
    Thanks in advance,
    Miller

    The use of LONG has several limitations. Please refer to the SQL Reference for details.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/toc.htm
    From the documentation:
    You can reference LONG columns in SQL statements in these places:
    n SELECT lists
    n SET clauses of UPDATE statements
    n VALUES clauses of INSERT statements
    The use of LONG values is subject to some restrictions:
    n A table cannot contain more than one LONG column.
    n You cannot create an object type with a LONG attribute.
    n LONG columns cannot appear in integrity constraints (except for NULL and NOT
    NULL constraints).
    n LONG columns cannot be indexed.
    n A stored function cannot return a LONG value.
    n Within a single SQL statement, all LONG columns, updated tables, and locked
    tables must be located on the same database.
    LONG columns cannot appear in certain parts of SQL statements:
    n WHERE clauses, GROUP BY clauses, ORDER BY clauses, or CONNECT BY clauses or
    with the DISTINCT operator in SELECT statements
    n The UNIQUE operator of a SELECT statement
    n The column list of a CREATE CLUSTER statement
    n The CLUSTER clause of a CREATE MATERIALIZED VIEW statement
    n SQL functions (such as SUBSTR or INSTR)
    n Expressions or conditions
    n SELECT lists of queries containing GROUP BY clauses
    n SELECT lists of subqueries or queries combined by the UNION, INTERSECT, or
    MINUS set operators
    Note: Oracle Corporation strongly recommends that you convert
    LONG columns to LOB columns. LOB columns are subject to far
    fewer restrictions than LONG columns. See "TO_LOB" on page 4-111
    for more information.

  • Oracle Personal Edition, data corruption in Long datatype column

    Oracle Personal Edition, data corruption in Long datatype column
    DATA Corruption in Oracle 8i Personal edition
    I am using a Long data type column to store a big text. In oracle Enterprise edition the data stored correctly. But in the Oracle Personal Edition, the Long data type column data corrupted. Some letters in the text are replaced by special character chr(0).
    The following data has been taken from a column (Which is of data type LONG).
    1. In the first one column name Template_ID stored correctly but in the second one T is missing. Some special characters has stored in that place. (Difference is in 6th Line)
    CREATED_DATE####09-21-2001 16:02:00$$LANGUAGE_ID####99$$LOWER_LIMIT####$$MEASURE
    ID####810200082001000004$$MODIFIEDDATE####09-21-2001 16:02:00$$SERVICE_RECEIVED####I$$SERVICE_RECORD####PO:F$$STEP_CODE####8$$STEP_RESULT####Failed$$STEP_ROW_
    ID####2$$TEMPLATE_ID####M116XX$$TEXT####$$UNIQUE_ID####810200082001$$UPPER_LIMIT
    CREATED_DATE####09-21-2001 16:02:00$$LANGUAGE_ID####99$$LOWER_LIMIT####$$MEASURE
    ID####810200082001000004$$MODIFIEDDATE####09-21-2001 16:02:00$$SERVICE_RECEIVED####I$$SERVICE_RECORD####PO:F$$STEP_CODE####8$$STEP_RESULT####Failed$$STEP_ROW_
    ID####2$$TEMPLA E_ID####M116XX$$TEXT####$$UNIQUE_ID####810200082001$$UPPER_LIMIT
    2. In the first one column name Template_ID stored correctly but in the second one E is missing. Some special characters has stored in that place. (Difference is in 6th Line)
    CREATED_DATE####09-21-2001 16:01:19$$LANGUAGE_ID####99$$LOWER_LIMIT####$$MEASURE
    ID####810200082001000002$$MODIFIEDDATE####09-21-2001 16:01:19$$SERVICE_RECEIVED####U$$SERVICE_RECORD####P:F$$STEP_CODE####7$$STEP_RESULT####Failed$$STEP_ROW_I
    D####2$$TEMPLATE_ID####78580A$$TEXT####$$UNIQUE_ID####810200082001$$UPPER_LIMIT#
    CREATED_DATE####09-21-2001 16:01:19$$LANGUAGE_ID####99$$LOWER_LIMIT####$$MEASURE
    ID####810200082001000002$$MODIFIEDDATE####09-21-2001 16:01:19$$SERVICE_RECEIVED####U$$SERVICE_RECORD####P:F$$STEP_CODE####7$$STEP_RESULT####Failed$$STEP_ROW_I
    D####2$$TEMPLAT ID####78580A$$TEXT####$$UNIQUEID####810200082001$$UPPER_LIMIT#

    See if this helps you any:
    Re: Google Maps

  • How to extract files stored in 9ifs to 9i Database Table's BLOB Column

    Dear All,
    I am new for 9ifs. Now my client need to retrieve the files which is stored in 9i Database Table's BLOB Column. Actually the files are stored in 9ifs. Therefore we now want to write a Java program to retrieve the files from 9ifs to 9i Database Table's BLOB Column for my client.
    The Java program will be loaded as Java Procedure to 9i Database. Then the Java Procedure can be triggerred by DML of 9i Database.
    The Questions are:
    1. Can I use CM SDK (9ifs) to retrieve files form 9ifs to 9i Database?
    2. If the files are already stored in 9ifs, Can I use PL/SQL to copy the files from 9ifs to 9i Database?
    3. As the Java Procedure will run frequently, Any problem on 9i Database Java Pool?
    4. Any other advices to implement the above stituation depends on the Client must use the database link to retrieve our 9i Database data?
    Thanks a lot!

    To Get MySql recordset in dreamweaver.
    1. Dreamweaver
    2. File>new>html>create>
    3. File>save>untitle-1.php (make sure to use a php externsion)
    4.Database Panel(Window>Database)
    5.Click Application Tab
    6.Click Plus sign.
    7.click Recordset(query)
    8.Name it anything
    9.Define your connection
    10.Go down to database items
    11. Click Tables
    12. Click the appropriate table
    13. click test
    14.click ok
    To pull image from MySqlDataBase
    1Place cursor on page where you want the image.
    2 insert>Image
    3Select Image Source box appears.
    4Click select file form: Data Source(vs File System)
    5 Your recordset will display
    6 Select the record.
    7 Click ok

  • To increase the oracle VARCHAR datatype column length

    Hi,
    I need to increase the VARCHAR datatype column length from VARCHAR2(16) TO VARCHAR2(100) on Production environment.
    Kindly let us know the impact on Production and also required for downtime to proceed the activity.
    Please find the details as below,
    DB Version: Oracle 11g R2 (11.2.0.3)
    OS : AIX 6.1
    If you need further information, kindly let me know.
    Thanks & Regards,
    Raj

    Hi,
    Better to move your question in General Category.
    Thanks

Maybe you are looking for

  • Opening a new view in a new window on click of a table row entry.

    Hi Guys, How to open a new View of a same application in a new window (just like a pop up) on a click of a Table Row entry? I am using NWDS 7.0 version. So please suggest acccorrdingly.

  • Accessing the host component in a PDF navigator

    Hi all, I'm trying to access the host (i.e reader or acrobat) in a PDF navigator (Portfolio) created in flash builder. I have seen numerous examples that override the host set method by doing the following: public function set host(host:INavigatorHos

  • Does quicktime support flash video or flv format

    Does quicktime support flash video or flv format

  • Some of the items in your iTunes library were not copied to your ipod

    It's a gen.5 ipod with video and works fine with almost everything. Sometimes I get the above message. I've recently tried a brand new set of CDs to rip to the ipod, and I get this again. I've de/re-authorised the mac, but no joy. Ideas?

  • Passwords Lost

    Hello, We have taken over administering a db and we do not have the repository owner or sysman for OMS, user name or password. The database is up and running but we need to move it to a new server. Any suggestions. Any help will be greatly appreciate