MD5 implementation gives different hash values from java1.2 to java 1.3

Hi,
I have MD5 implementation using Java api. When i run the program using Java 1.2, I get one version of hash value. When i run the same program using Java 1.3/1.4 I get a different version of hash value.
the hash value generated by java1.2 authecticates correctly with server but the one generated by 1.3/1.4 gives me authetication failure with the server.
I serious doubt some encoding issue with md5 implementation from java 1.2 to java 1.3/1.4. I would like to know what is the root cause for getting a different hash with java 1.3/1.4
Thanks
sunil

Here is the code, I am converting the string to bytes and then passing it to md.
public static String getMD(String strInput) {
/*---- Local Variable Declares ----*/
String rStr = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(strInput.getBytes("UTF-8"));
byte[] challengeResponse = md.digest();
System.out.println("Len of BYTE ary in JAVA:" + challengeResponse.length);
rStr = new String(challengeResponse);
} catch(Exception e) {
System.out.println("\n\nException while calling getMD\n\n");
e.printStackTrace();
} /* end of try catch block */
return rStr;
When I run the code using java 1.2, I got the following is octal dump output
"0000000 037677 135543 076565 063432 136210 040616 004766 177265"
When I run the code using java 1.3/1.4, I go the following octal dump outpu
"0000000 037477 037543 076565 063432 037477 040477 004477 037477"

Similar Messages

  • MD5 hash value from a file

    Hello Oracle Community,
    version 11.1
    well a lof of questions from me today. Is it possible to generate a MD5 value from a file with PL/SQL and if so how can I do it ?
    Ilja

    Hi Ilja,
    I never work with files from Oracle, but maybe you could try combining these:
    UTL_FILE.GET_RAW (
       fid  IN  utl_file.file_type,
       r    OUT NOCOPY RAW,
       len  IN  PLS_INTEGER DEFAULT NULL);
    DBMS_OBFUSCATION_TOOLKIT.MD5(
       input         IN  RAW)
      RETURN raw_checksum;Regards
    Peter

  • How to pass value from jsp to java bean

    I have huge problem . How to pass value from jsp value to java bean.Please replay me soon

    Use the <jsp:setProperty> tag. There are several ways to use it. The one you probably want is:
    <jsp:setProperty name="bean_name"  property="property_name"  value="the_value_you_want_to_set"/>

  • Problem in passing values from AS to Java

    Hi,
    I am using Remote Object(Flex 3) for passing the data
    between java and flex. I am using the BlazeDS as the bridge. I have
    to pass an array collection containing value objects to the java
    method. I have created the value object in both the client side(AS)
    and server side (java) and registered my AS value object using
    [RemoteClass(alias="class name")]. Now the problem is the
    array collection is goinhg to the back end but when i try to get
    the values in the value objects using the corresponding getters, i
    am getting null values. Can some one suggest me the solution.
    Following is my AS value object
    package ascript
    [RemoteClass(alias="com.category.dao.CatgVO")]
    public class CatgVO
    private var catg_id:String;
    private var parent_catg_id:String;
    private var catg_name:String;
    private var catg_desc:String;
    private var created_by:String;
    private var created_date:String;
    private var catg_status:String;
    private var blooper:String;
    private var catg_modifieddate:String;
    private var catg_modifieduserid:String;
    * @return the catg_id
    public function getCatg_id():String {
    return catg_id;
    * @param catg_id the catg_id to set
    public function setCatg_id(catg_id:String):void {
    this.catg_id = catg_id;
    * @return the parent_catg_id
    public function getParent_catg_id():String {
    return parent_catg_id;
    * @param parent_catg_id the parent_catg_id to set
    public function setParent_catg_id(parent_catg_id:String):void
    this.parent_catg_id = parent_catg_id;
    * @return the catg_name
    public function getCatg_name():String {
    return catg_name;
    * @param catg_name the catg_name to set
    public function setCatg_name(catg_name:String):void {
    this.catg_name = catg_name;
    * @return the catg_desc
    public function getCatg_desc():String {
    return catg_desc;
    * @param catg_desc the catg_desc to set
    public function setCatg_desc(catg_desc:String):void {
    this.catg_desc = catg_desc;
    * @return the created_by
    public function getCreated_by():String {
    return created_by;
    * @param created_by the created_by to set
    public function setCreated_by(created_by:String):void {
    this.created_by = created_by;
    * @return the created_date
    public function getCreated_date():String {
    return created_date;
    * @param created_date the created_date to set
    public function setCreated_date(created_date:String):void {
    this.created_date = created_date;
    * @return the catg_status
    public function getCatg_status():String {
    return catg_status;
    * @param catg_status the catg_status to set
    public function setCatg_status(catg_status:String):void {
    this.catg_status = catg_status;
    * @return the blooper
    public function getBlooper():String {
    return blooper;
    * @param blooper the blooper to set
    public function setBlooper(blooper:String):void {
    this.blooper = blooper;
    * @return the catg_modifieddate
    public function getCatg_modifieddate():String {
    return catg_modifieddate;
    * @param catg_modifieddate the catg_modifieddate to set
    public function
    setCatg_modifieddate(catg_modifieddate:String):void {
    this.catg_modifieddate = catg_modifieddate;
    * @return the catg_modifieduserid
    public function getCatg_modifieduserid():String{
    return catg_modifieduserid;
    * @param catg_modifieduserid the catg_modifieduserid to set
    public function
    setCatg_modifieduserid(catg_modifieduserid:String):void {
    this.catg_modifieduserid = catg_modifieduserid;
    Regards
    Kranthi

    Hi there. That's a perfectly reasonable question.
    Take a look at the section of the Flex documentation with the title "Explicitly mapping ActionScript and Java objects" in the Data Access section of the doc.
    http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_4.html
    Your BananaVO ActionScript class needs a RemoteClass metadata tag that will tell the AMF deserialization code on the server what Java class to map the object to.
    Hope that helps.
    -Alex

  • Dynamic implementation download for return values from EJB

    I try the following exemplary scenario regarding dynamic implementation download. Let's say there is a statless EJB deployed (e.g. OrderHandler) with a method getSomeOrder() returning Order object; where Order is actually an interface extending java.io.Serializable. For Order there is implementation class OrderImpl. Within the getSomeOrder() the EJB creates a new OrderImpl, populates it and returns as interface. The client looks up OrderHandler and calls getSomeOrder() method. Then, on Order a dummy: String getName() method is called.
    Now, the problem is various behavior with implementation dynamic download. I receive different behavior from 2 clients (1st being launched from within LAN with the server, 2nd from outside server's LAN). When I put OrderImpl in clients' classpaths, obviously they both work the same. When I leave only Order interface (!!the very goal of the test - dynamic impl. download!!), only the 1st client still works. I measured times in milis, and it looks that the OrderImpl is really downloaded, as the first getSomeOrder() call lasts around 10 times as long as further calls.
    The 2nd client hangs a while on the getSomeOrder() call and then throws UnmarshallException, stating that it has failed to unmarshal the returned object, which basically means no implementation got downloaded.
    Can anyone help?

    You can try putting the Impl classes on a webserver.
    while starting the server set the property
    -Djava.rmi.server.codebase=http://mywebserver:8080
    While running the client if the impl classes are not available in the classpath, it would download it from the webserver

  • Different users values from v$object_usage

    Hi Gurus,
    I have X_BANK user who is application user who owns all the tables of database.
    We started index monitoring for all the indexes of X_BANK user.
    But when we loggin to database / as sysdba, we are not able to see results of X_BANK and when we login to database with X_BANK then we see objects usage in v$object_usage.
    Why we cann't see different users v$object_usage with /as sysdba
    Please advice me and help me
    Thanks & Regards

    oramnts wrote:
    Hi Gurus,
    I have X_BANK user who is application user who owns all the tables of database.
    We started index monitoring for all the indexes of X_BANK user.
    But when we loggin to database / as sysdba, we are not able to see results of X_BANK and when we login to database with X_BANK then we see objects usage in v$object_usage.
    Why we cann't see different users v$object_usage with /as sysdba
    The object is a per user kind of object. Its not a centralized kind of view. Here is the same kind of thing in my test db,
    REM- I am using here Sys user and would query the view. Also I shall create couple of tables and indexes in another schema and would see what the view shows in that schema.
    Session-1(Sys)
    SQL> select * from V$object_usage;
    no rows selected
    SQL> /
    no rows selected
    SQL> sbow use
    SP2-0042: unknown command "sbow use" - rest of line ignored.
    SQL> sho user
    USER is "SYS"
    SQL> exit
    Session--2
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table test_ou(a number);
    Table created.
    SQL> create index testidx on test_ou(a);
    Index created.
    SQL> select * from V$object_usage;
    no rows selected
    SQL> alter index testidx monitoring usage;
    Index altered.
    SQL> select * from V$object_usage;
    INDEX_NAME                     TABLE_NAME                     MON USE
    START_MONITORING    END_MONITORING
    TESTIDX                        TEST_OU                        YES NO
    09/18/2009 21:56:56
    SQL> create table test2(a number);
    Table created.
    SQL> create index testidx2 on test2(a);
    Index created.
    SQL> alter index testidx2 monitoring usage;
    Index altered.
    SQL> select * from V$object_usage;
    INDEX_NAME                     TABLE_NAME                     MON USE
    START_MONITORING    END_MONITORING
    TESTIDX                        TEST_OU                        YES NO
    09/18/2009 21:56:56
    TESTIDX2                       TEST2                          YES NO
    09/18/2009 21:57:26
    SQL>Works exactly as it should be.
    HTH
    Aman....

  • Wrong values from calculated field (Java API)

    Hi All,
    Help me please solve the problem.
    We have a table with calculated text field in MDM repositor. For some records the value of this field in MDM Data Manager differs from the value returned when we read record by MDM Java API.
    Parameters of system:
    MDM ver.: 7.1 SP10
    DBMS: Oracle
    OS: Linux
    The issue solved. I've found error in program code :-)
    I apologize for the worry.

    Assuming you want every field, the equivalent of "SELECT *" in SQL, you can use the RepositorySchema object to get a TableSchema, and with that get all FieldIds for the table.
    If your RepositorySchema variable is rs it would be something along the lines of:
    TableSchema mainTableSchema = rs.getTableSchema(mainTableId);
    ResultDefinition rd = new ResultDefinition(mainTableId);
    rd.setSelectFields(mainTableSchema.getFieldIds());
    Hope this helps,
    Greg

  • Get Field Values from Table using Java api

    I am using the example java code "RetrieveLimitedRecords" that can be found at :
    https://help.sap.com/javadocs/MDM71/current/API/index.html
    The code give the expected result and retrieves the record count for the main table
    Now I want to get the values of the fields for one record
    I added the lines:
    Record[] records = recordResultSet.getRecords() ;
    FieldId[] fields = records[0].getFields();
    System.out.println ("Field Length = "+fields.length);
    and the output is::
    Field Length = 0
    How can I get the fields of the record and read their values?
    Thanks
    Nicolas

    Assuming you want every field, the equivalent of "SELECT *" in SQL, you can use the RepositorySchema object to get a TableSchema, and with that get all FieldIds for the table.
    If your RepositorySchema variable is rs it would be something along the lines of:
    TableSchema mainTableSchema = rs.getTableSchema(mainTableId);
    ResultDefinition rd = new ResultDefinition(mainTableId);
    rd.setSelectFields(mainTableSchema.getFieldIds());
    Hope this helps,
    Greg

  • Passing value from jsp to java

    Hi
    Thanks for reading my query.I am having a jsp page which gets the input from the user from a confirm box(javascript). This input i need to process in my java class.how can i do that
    Regards
    Venki

    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/

  • Extracting multiple variables of different fixed length from a string ( Java )

    Dear all,
    I am expecting an input string of
    NationalBroadCastTony12245tv0930113024213tv0820230022214tv0915140024213rd10002300
    I need to display it in the following format:
    Telecastor: NationalBroadCast
    Presenter:Tony
    ch_code
    pg_code
    source
    start_time
    end_time
    1
    2245
    tv
    0930
    1130
    2
    4213
    tv
    0820
    2300
    2
    2214
    tv
    0915
    1400
    2
    4213
    rd
    1000
    2300
    I know the starting and ending position of Telecastor, and Presenter in the input string. I also know the position of the start element of the table(starting of the loop). I also know the length of a single row( allows me to contruct the loop). I reckon regex is probably not the best way since there is no pattern matching. I am looking at some sort of a config driven logic.
    Are there any java string function that I can use together with some form of config driven configuration that anyone can suggest?
    I am looking along the line of some configuration like eg
    telecastor 17
    Presentor  4
    pg_code 4 ( anything after character 21 is the loop)
    source 2
    start_time 4
    end_time 4
    For example another input I can expect is
    ElementaryScienceAccessment223-Feb-131500-1730RegentHallE32344390E21235487A23443564G23443246
    I need to display as
    Exam:ElementaryScience
    Nature: Accessment2
    Date:23-Feb-13
    Time:1500-1730
    Venue:RegentHall
    Student ID
    Score
    E323443
    90
    E212354
    87
    A234435
    64
    G234432
    46
    Exam:17
    Nature:11
    Date:9
    Time:9
    Venue:10
    Student ID:7 (anything after 56 is a loop)
    Score:2
    Unfortunately the input stream is not in XML format. What sort of string function/config driven logic can I use to allow me to define a 1 config fits all mechanism?

    Are there any java string function that I can use together with some form of config driven configuration that anyone can suggest?
    Well there is the obvious one: the 'substr' method of the String class.
    http://docs.oracle.com/javase/6/docs/api/java/lang/String.html
    Your 'config' would be the list of start/end or start/length values for each of the components.
    The usual parsing issue is knowing how to determine when one element ends and the next one starts. For this fragment of yours:
    12245tv
    How do you know if the first component, 'ch_code', is '1', '2', or '122'?

  • DBMS_CRYPTO MD5 hash value does not match 3rd party MD5 free tool

    Hello,
    I am using Oracle Version: 11.2.4.
    I have a problem where the MD5 value from DBMS_CRYPTO does not match the hash value from 3rd party MD5 free tool (MD5 Checksum Calculator 0.0.5.58 or WinMD5Free v1.20) and also the MD5 hash value calculated by an ingestion tool where I am transferring files to. The MD5 hash value that the ingestion tool calculates is the same as the 3rd party MD5 free tools I have. This occurs only on some of the XML files that I generate using XSQL(xmlserialize, xmlagg, xmlelement, etc.) and DBMS_XSLPROCESSOR on a Linux OS. The XML files are transferred from the Unix OS to my Windows 7 OS via filezilla.
    I found a thread on this forum that also had a similar issue so I copy/paste the java functions. They are listed below(both are the same expect for the character set):
    create or replace java source named "MD5_UTF_8" as
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.sql.Clob;
    import java.sql.Blob;
    public class MD5_UTF_8 {
    private static final byte [] hexDigit = {
    '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
    /** Converts a byte array to a hex string
    * Returns an empty string if the byte array is null
    public static final String toHexString(byte [] bytes) {
    if (bytes == null) return new String("");
    StringBuffer buf = new StringBuffer(bytes.length * 2);
    for (int i = 0; i < bytes.length; i++) {
    buf.append((char) hexDigit[((bytes >>> 4) & 0x0F)]);
    buf.append((char) hexDigit[(bytes & 0x0F)]);
    return buf.toString();
    // Convert Hex String to Byte Array
    public static final byte[] byteArrayFromHexString(String str) {
    byte[] bytes = new byte[str.length() / 2];
    for (int i = 0; i < bytes.length; i++)
    bytes = (byte) Integer.parseInt(str.substring(2 * i, 2 * i + 2), 16);
    return bytes;
    public static String getMD5HashFromClob(Clob inhalt) throws Exception{
    MessageDigest algorithm;
    StringBuffer hexString;
    String s = null;
    String salida = null;
    int i;
    byte[] digest;
    String tepFordigest = inhalt.getSubString(1L, (int)inhalt.length());
    try {
    algorithm = MessageDigest.getInstance("MD5_UTF_8");
    algorithm.reset();
    algorithm.update(tepFordigest.getBytes("UTF-8"));
    digest = algorithm.digest();
    s = toHexString(digest);
    } catch (java.security.NoSuchAlgorithmException nsae) {
    s = "No es posible cifrar MD5";
    return s;
    sho err
    alter java source "MD5_UTF_8" compile
    sho err
    CREATE OR REPLACE FUNCTION get_md5_UTF_8_CLOB(inhalt CLOB) RETURN VARCHAR2 DETERMINISTIC
    AS LANGUAGE JAVA
    name 'MD5_UTF_8.getMD5HashFromClob(java.sql.Clob) return java.lang.String';
    create or replace java source named "MD5" as
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.sql.Clob;
    import java.sql.Blob;
    public class MD5 {
    private static final byte [] hexDigit = {
    '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
    /** Converts a byte array to a hex string
    * Returns an empty string if the byte array is null
    public static final String toHexString(byte [] bytes) {
    if (bytes == null) return new String("");
    StringBuffer buf = new StringBuffer(bytes.length * 2);
    for (int i = 0; i < bytes.length; i++) {
    buf.append((char) hexDigit[((bytes >>> 4) & 0x0F)]);
    buf.append((char) hexDigit[(bytes & 0x0F)]);
    return buf.toString();
    // Convert Hex String to Byte Array
    public static final byte[] byteArrayFromHexString(String str) {
    byte[] bytes = new byte[str.length() / 2];
    for (int i = 0; i < bytes.length; i++)
    bytes = (byte) Integer.parseInt(str.substring(2 * i, 2 * i + 2), 16);
    return bytes;
    public static String getMD5HashFromClob(Clob inhalt) throws Exception{
    MessageDigest algorithm;
    StringBuffer hexString;
    String s = null;
    String salida = null;
    int i;
    byte[] digest;
    String tepFordigest = inhalt.getSubString(1L, (int)inhalt.length());
    try {
    algorithm = MessageDigest.getInstance("MD5");
    algorithm.reset();
    algorithm.update(tepFordigest.getBytes());
    digest = algorithm.digest();
    s = toHexString(digest);
    } catch (java.security.NoSuchAlgorithmException nsae) {
    s = "No es posible cifrar MD5";
    return s;
    sho err
    alter java source "MD5" compile
    sho err
    CREATE OR REPLACE FUNCTION get_md5_CLOB(inhalt CLOB) RETURN VARCHAR2 DETERMINISTIC
    AS LANGUAGE JAVA
    name 'MD5.getMD5HashFromClob(java.sql.Clob) return java.lang.String';
    I created the above java functions and added the calls to them in my package to see what hash values they would produce but I am getting "ORA-29532: Java call terminated by uncaught Java exception: java.nio.BufferOverflowException " the XML is about 60mb.
    package code sniippets:
    declare
    l_hash raw(2000);
    l_checksum_md5 varchar2(2000);
    l_checksum_md5_utf_8 varchar2(2000);
    Begin
    t_checksum := lower(RAWTOHEX(dbms_crypto.hash(src=>l_clob,typ=>dbms_crypto.hash_md5)));
    l_hash := get_md5_CLOB (l_clob);
    l_checksum_md5 := lower(rawtohex(l_hash));
    l_hash := get_md5_UTF_8_CLOB (l_clob);
    l_checksum_md5_UTF_8 := lower(rawtohex(l_hash));Please help,
    Thank You in advance
    Don
    Edited by: 972551 on Nov 21, 2012 12:18 PM
    Edited by: sabre150 on Nov 21, 2012 11:06 PM
    Moderator action : added [code ] tags to format properly. In future please add them yourself.

    >
    I have a problem where the MD5 value from DBMS_CRYPTO does not match the hash value from 3rd party MD5 free tool (MD5 Checksum Calculator 0.0.5.58 or WinMD5Free v1.20) and also the MD5 hash value calculated by an ingestion tool where I am transferring files to. The MD5 hash value that the ingestion tool calculates is the same as the 3rd party MD5 free tools I have.
    I found a thread on this forum that also had a similar issue so I copy/paste the java functions.
    >
    And in that thread (Re: MD5 HASH computed from DBMS_CRYPTO does not match .NET MD5 I provided the reason why DBMS_CRYPTO may not match hashes produced by other methodologies.
    I have no idea why you copied and posted all of that Java code the other poster and I provided since code has NOTHING to do with the problem you say you are having. Thte other poster's question was how to write Java code that would produce the same result as DBMS_CRYPTO.
    You said your problem was understanding why DBMS_CRYPTO 'does not match the hash value from 3rd party MD5 free tool ...'. and I answered that in the other forum.
    >
    The Crypto package always converts everything to AL32UTF8 before hashing so if the .NET character set is different the hash will likely be different.
    See DBMS_CRYPTO in the PL/SQL Packages and Types doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_crypto.htm
    If you look at the spec header for the DBMS_CRYPTO package it shows this note:
    -- Prior to encryption, hashing or keyed hashing, CLOB datatype is
    -- converted to AL32UTF8. This allows cryptographic data to be
    -- transferred and understood between databases with different
    -- character sets, across character set changes and between
    -- separate processes (for example, Java programs).
    -- If your 3rd party MD5 free tool (MD5 Checksum Calculator 0.0.5.58 or WinMD5Free v1.20) do not use the AL32UTF8 character set then the hashes will likely be different. You can't modify DBMS_CRYPTO so if the hashes need to match you need to use 3rd party tools that either use the correct character set or can be configured to use the correct character set.
    The problem in the other thread was how to WRITE Java code that uses the correct character set and I showed that OP how to do that.
    So unless you are writing your own Java code all of that code you copied and pasted is useless for your use case.

  • Serialization ruins my hash value...

    Hello all,
    i am in the stage of switching from asymmetric to symmetric cryptography after the successful receival of a symmetric key..
    in the client now i take a string from the user and i create a hash value using the SHA1 algorithm using the following :
    public static byte[] hashIt(String str){
              MessageDigest md = null;
              byte[] result=null;
              try {
                   md = MessageDigest.getInstance("SHA1");
                   result = md.digest(str.getBytes("UTF-8"));     
              }catch(NoSuchAlgorithmException e) {
                   System.out.println("No Such Algorithm Exception "+e);     
              }catch(UnsupportedEncodingException e) {
                   System.out.println("Unsupported Encoding Exception "+e);     
              System.out.println("I HASHED IT TO : "+result);
              return result;
         }i then save the message and its hashed value into an object called myPacketMessage and i use symmetric encryption to encrypt the object to a sealedObject and then serialize it to a udp packet that is being sent. Unfortunately on the receiver i obtain a different hash value than the one stored (i am not saying that i create the hash of the message and it is different from the one stored, i am saying that the hash value that i just get from the packet is different from the one that client put in it)...
    In fact, i did some testing serializing and deserializing the object on the client and again the hashed value stored is different from the one retrieved. i then tried not even encrypt the object to a sealed object but just to serialize it with the following code and again it fails...
    //text is a string retrieved from the user
    pcktText.setHash(sp.hashIt(text));
    pcktText.setMsg(text);
    System.out.println("I set hash : "+pcktText.getHash());
    sentPacket = sp.serializeObject(pcktText, serverIP, serverPort);
    MyPacketMessage textToBeRot13=new MyPacketMessage();
              textToBeRot13=(MyPacketMessage)sp.deserializeObject(sentPacket);
    System.out.println("After the serialize/deserialize the hash is : "+textToBeRot13.getHash());
              and the values are :
    I set hash : [B@c55e36
    After the serialize/deserialize the hash is : [B@1621e42
    the function that does the serialization is the following (and i suspect that the problem is in here, but i dont know where (because it works in other cases that i store signatures in the packet!!!)
    public static DatagramPacket serializeObject(MyPacketInterface myPacket, InetAddress IP, int PORT){
              byte[] sendBuf=new byte[2048];           
              DatagramPacket tempPacket=new DatagramPacket(sendBuf,sendBuf.length, IP, PORT);
              try{
                   ByteArrayOutputStream byteStream = new ByteArrayOutputStream(2048);
                   ObjectOutputStream os = new ObjectOutputStream(new BufferedOutputStream(byteStream));
                   os.flush();
                   os.writeObject(myPacket);
                   os.flush();
                   os.close();
                   sendBuf = byteStream.toByteArray();
                   tempPacket.setData(sendBuf);
              } catch (IOException e) {
                   System.out.println("IOException "+e);
              return tempPacket;
         }and the deserialize the following :
    public static MyPacketInterface deserializeObject(DatagramPacket packet){
              MyPacketInterface myPacket=null;
              byte[] recvBuf = packet.getData();
              try {
                   ByteArrayInputStream byteStream = new ByteArrayInputStream(recvBuf);
                   ObjectInputStream is = new ObjectInputStream(new BufferedInputStream(byteStream));
                   myPacket = (MyPacketInterface)is.readObject();
                   is.close();
              } catch (ClassNotFoundException e){
                   System.out.println("ClassNotFoundException :"+e);
              } catch(IOException e){
                   System.out.println("IOException " +e);
              return myPacket;
         }any help would be greatly appreciated!!!

    hm, could you please elaborate on that because i am not getting it...
    i am not using the MD5 hash algorithm.. i am using the SHA1 to make a hash and store it on a byte[] variable .. You said that i should print out the bytes right? i think this is what i am doing in the system.out.print statements with the getHash() functions that looks like the following
    public class MyPacketMessage extends MyPacket implements Serializable {
         private byte[] hash;
         private String msg;
         public MyPacketMessage(){
              super();
              this.hash=null;
              this.msg=new String();
         public byte[] getHash(){
              return this.hash;
    (....)

  • Vtp password hash value

    the vtp password is send as a md5 hash value in the vtp advertisements.
    but the hash value is computed using only the password or it is computed using some otheer field also if yeh then which fields

    Hi,
    from "Troubleshooting VLAN Trunk Protocol" :
    "The general purpose of an MD5 value is to verify the integrity of a received packet and to detect any changes to the packet or corruption of the packet during transit. When a switch detects a new revision number that is different from the currently stored value, the switch sends a request message to the VTP server and requests the VTP subsets. A subset advertisement contains a list of VLAN information. The switch calculates the MD5 value for the subset advertisements and compares the value to the MD5 value of the VTP summary advertisement. If the two values are different, the switch increases the No of config digest errors counter."
    By the way: I made a couple of tests and it seems that the only relevant field in the summary advertisement, which is not used for the MD5 computation, is the timestamp. I attached a wireshark-capture with summary advertisements from two different switches. I made the same changes on both switches at different times before I connected them (I even configured the same updater IPs on both because different IDs resulted in different hash values. This is interesting because the updater ID is used only in the summary advertisements). You can see that the MD5 values are the same in both messages although the timestamps are different. Any changes of vlan information also resulted in different hash values, as expected.
    Hope that helps
    Rolf
    P.S.: You can find the packet formats in "Understanding VLAN Trunk Protocol"

  • DBMS_CRYPTO.HASH produces a different hash result when I use it in sqlldr?

    Hello,
    If I execute the following in sqlplus:
    SELECT LOWER(SYS.DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(CONCAT('Salt','000000000')),3)) FROM DUAL;
    It produces one hash value. However, if I use similar logic in a sqlldr control file:
    OPTIONS (SKIP=7)
    LOAD DATA
    INFILE 'C:\data.csv'
    TRUNCATE INTO TABLE information
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    HOSTNAME          CONSTANT 'Company',
    HOSTSERVICENAME     CONSTANT 'LOB',
    ACCOUNTNAME,
    LASTNAME,
    EXTERNAL_ACCOUNT_ID     "LOWER(SYS.DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(CONCAT('Salt',:accountname)),3))"
    Where ACCOUNTNAME in the file data.csv is also '000000000'. What am I doing wrong?
    Thanks so much,
    Jay

    user3362629 wrote:
    If anyone is interested, the problem was with the column datatype of the table. sqlldr was attempting to load data into a column of type NVARCHAR2. When I changed the column type to VARCHAR2, the hash values from both sqlldr and sqlplus were the same. I'm not sure if this is an Oracle bug or if this expected behavior. This was using Oracle Enterprise Edition 11g.Jay,
    that's very interesting. One possible explanation that I could think of: Your SQL*Plus attempt:
    If I execute the following in sqlplus:
    SELECT LOWER(SYS.DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(CONCAT('Salt','000000000')),3)) FROM DUAL;used a VARCHAR2 literal, but the SQL*Loader code probably used a NVARCHAR2 as input to the function. From a RAW data perspective, these two, although representing the same string, could be quite different.
    You could try to do the same in SQL*Plus, by using a NVARCHAR2 input to the function. If you want to achieve that using a literal the problem is, that it's not that simple to use a NVARCHAR2 literal. You would need to use an NVARCHAR2 literal (N'000000000') and in addition probably turn on the so called "NCHAR String Literal Replacement", which means that you need to set an environment variable (ORA_NCHAR_LITERAL_REPLACE = TRUE).
    For more information regarding these issues, look here:
    Text literals: http://download.oracle.com/docs/cd/B28359_01/server.111/b28298/ch7progrunicode.htm#CACHHIFE
    NCHAR String Literal Replacement: http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements003.htm#SQLRF00218
    It's probably far simpler to use a NVARCHAR2 stored somewhere in the database, or use e.g. a concatenation of the NCHR() function to generate a NVARCHAR2 on the fly than dealing with these literal conversion issues mentioned above.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Forcing / reuse plan hash value ...

    friends....
    db: 11gr2
    os: linux
    for quite sometime I am trying to tune this query but somehow can't get runtime less than 35 seconds...
    I tried to get recent plan details from sql id but saw database was using "Cardinality feedback used for this statement" and was showing me many different plan with different hash value ....
    some of the plans are really good and finishes in 5 seconds and some took 55 seconds.
    my question is
    1. how can I force oracle to use/run query as per historic hash value with minimal runtime? is it possible?
    2. can we see what hint or changes done in query by oracle for that particular hash value?
    I can see explain plan but fail to use id/operation details in actual query?
    my current explain plan slows at below operation id:
    0. SELECT STATEMENT============12  rows======00:00:35
    1. SORT ORDER BY===============12 rows======00:00:35
    2. ---NESTED LOOPS OUTER==========12  rows=====00:00:35
    3. -----NESTED LOOPS==============12  rows=====00:00:35
    4. --------NESTED LOOPS ============ 12K rows ====00:00:01
    5. ----------SORT UNIQUE=============4  rows=====00:00:01
    ...but hash value with good plan using "Hash Join Right Semi" for step-3 and "access table by index" for step 4...

    using "Cardinality feedback used for this statement" and was showing me many different plan with different hash value ....
    some of the plans are really good and finishes in 5 seconds and some took 55 seconds.A not unusual experience with cardinality feedback.
    If you don't like the feature - and my experiences have been very mixed - turn it off.
    Either via system wide parameter optimizeruse_feedback or on a statement basis using the parameter via opt_param hint or alter session.
    1. how can I force oracle to use/run query as per historic hash value with minimal runtime? is it possible?a. SQL Plan Baselines
    b. SQL Profile via COE_XFR_SQL_PROFILE.sql, see Oracle Support doc id 215187.1.
    c. Hint the plan you want using the outline hints from plans above - see DBMS_XPLAN.DISPLAY_AWR and the format parameter '+OUTLINE'
    2. can we see what hint or changes done in query by oracle for that particular hash value?See DBMS_XPLAN.DISPLAY_CURSOR / DISPLAY_AWR and the format parameter '+OUTLINE'
    my current explain plan slows at below operation id:
    but hash value with good plan using "Hash Join Right Semi" for step-3 and "access table by index" for step 4... You've got the template tuning threads which detail the information required to comment on this.

Maybe you are looking for

  • Pages not syncing with iCloud

    I am trying to figure out, why pages is not syncing with iCloud. I have Documents checked in the System Preferences of iCloud on my Mac Book Pro, I have Documents checked on my iPhone and I have the Pages app. Can someone shine some light on this iss

  • Connect multiple displays to MBA(thunderboldt)

    Anyone knows how to connect to Dell monitors, one with only VGA and another one with both VGA and DVI? I have a MBA mid 2011 and want to make the two external screens just mentioned my displays. I have both adapter for VGA and DVI to my thunderboldt/

  • Who is DonGilli and how did he get in my "Source List"?

    This is really wierd! I just opened iTunes from my Applications folder and I saw a file that is titled "DonGilli's Music" and it has a little padlock on it. I clicked on it and it asked for my password, but it won't accept my password! DonGilli's Mus

  • Best external drive setup?

    I guess I can't be called 'new' to Macs, I've had the mini since May of 2005, but I would like to know what you would recommend in terms of external drive setup. As I began to fill the 80 gb internal, I added a FW 250gb external. It's not full (about

  • Slide "ON" button for I Phone 4S

    When I slide the button to turn on the phone; it goes to the end but does not turn on the phone .  I can hear a delayed teletale "click" but the phone does not come on.  If I try to shut it off; that doesn't work either.  After a whille it comes back