From: fiza khalid on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i0ldtk$9ua$1(a)fred.mathworks.com>...
> Dear Fiza,
>
> >its working now but tell me last thing that how do i confirm that it is giving correct hash of an image or not.
>
> How would or could you define "correct" for a hash??
> You can trust the Java libs, because they are tested millions of times. So any other computer, which uses an equivalent lib to calculate an MD5 will reply the same hash for the contents of the JPEG.
>
> Nevertheless, you could calculate the hash for the complete file also, such that the header and comment is included.
> If you define exactly, what you use as input to the MD5, the hash is "correct" already.
>
> What do you want to achieve with building a hash for a picture?
> If you formulate your demands exactly, it will take less than 29 posts to assist you.
>
> Kind regards, Jan
>>thanx jan for your guide actually i have to do a comparison of different hash algo's in response to an image.that's why i ma taking hash of a complete image the code that i ma using of micheal is giving me hash of an image but it is not correct as a check it with various hash calculating softwares that's why i am confused that hash is right or not.help me if u can.
From: fiza khalid on
Walter Roberson <roberson(a)hushmail.com> wrote in message <XfCXn.3986$Ls1.3469(a)newsfe11.iad>...
> fiza khalid wrote:
>
> > Error in ==> hash2 at 70
> > inp=typecast(inp,'uint8');
> > plz let me know how to remove that error.
>
> Hard to believe you are still working on this a week or more later.
>
> inp = typecast(inp(:),'uint8');
>>i done that.
From: Walter Roberson on
fiza khalid wrote:
> Walter Roberson <roberson(a)hushmail.com> wrote in message
> <XfCXn.3986$Ls1.3469(a)newsfe11.iad>...
>> fiza khalid wrote:
>>
>> > Error in ==> hash2 at 70
>> > inp=typecast(inp,'uint8');
>> > plz let me know how to remove that error.
>>
>> Hard to believe you are still working on this a week or more later.
>>
>> inp = typecast(inp(:),'uint8');
>>> i done that.

If you had done that, then your code would have reflected it! Are you
_sure_ you noticed the (:) that I added after inp ?
From: Jan Simon on
Dear fiza,

> >>thanx jan for your guide actually i have to do a comparison of different hash algo's in response to an image.that's why i ma taking hash of a complete image the code that i ma using of micheal is giving me hash of an image but it is not correct as a check it with various hash calculating softwares that's why i am confused that hash is right or not.help me if u can.

The hash Michael's software replies *is* correct. If another program calculates a different MD5, it uses other inputs.
While IMREAD replies just the RGB values of the JPG, other programs might include the header section, comments, EXIF and IPTC strings also. If you want this, include this also, e.g. by reading the file as binary:
fid = fopen(FileName, 'rb');
Im = fread(FID, Inf, 'uint8=>uint8');

It would be much easier to help you, if you'd spend the time to describe your problems with more details. We cannot guess these details.

Kind regards, Jan
From: fiza khalid on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i0qnjl$nm9$1(a)fred.mathworks.com>...
> Dear fiza,
>
> > >>thanx jan for your guide actually i have to do a comparison of different hash algo's in response to an image.that's why i ma taking hash of a complete image the code that i ma using of micheal is giving me hash of an image but it is not correct as a check it with various hash calculating softwares that's why i am confused that hash is right or not.help me if u can.
>
> The hash Michael's software replies *is* correct. If another program calculates a different MD5, it uses other inputs.
> While IMREAD replies just the RGB values of the JPG, other programs might include the header section, comments, EXIF and IPTC strings also. If you want this, include this also, e.g. by reading the file as binary:
> fid = fopen(FileName, 'rb');
> Im = fread(FID, Inf, 'uint8=>uint8');
>
> It would be much easier to help you, if you'd spend the time to describe your problems with more details. We cannot guess these details.
>
> Kind regards, Jan
>>thnkyou for your help i have done dat image hashing
>>please tell me if i can check how much system memory is consumed while doing this hash calculation.by which method i can do that without using Whos.