https://in.mathworks.com/matlabcentral/fileexchange/45038-generate-digital-signature-of-images?focused=3805874&tab=function
I found this link for digital signature for images. This is exactly what I wanted. I saved all the functions. The main program is hash.m right? I tried running it, but got an error stating:
hash
Undefined function or variable 'METH'.
Error in hash (line 7)
if(METH=='SHA160')

 Risposta accettata

David Fletcher
David Fletcher il 15 Apr 2018
From the overview given by your link, the main function is:
function [digest, MSG_PADDED] = image_hash(V_LEN,H_LEN,METH,IMG_FILE)
There is also a list indicating what the arguments are, including METH

11 Commenti

Darsana P M
Darsana P M il 15 Apr 2018
Yes, I saved this code too. I run this and the run the hash.m file. I am not able to compile it?
David Fletcher
David Fletcher il 15 Apr 2018
You should only have to call the main function, the main function and subfunctions will call whatever they need to call themselves (you just need to make sure the functions are present on your system - which you seem to have done). When you say you are not able to compile it, are you talking about creating standalone code that runs outside of Matlab?
SHA160=0;
SHA224=0;
SHA256=0;
SHA384=0;
SHA512=0;
if(METH=='SHA160')
SHA160=1;
elseif(METH=='SHA224')
SHA224=1;
elseif(METH=='SHA256')
SHA256=1;
elseif(METH=='SHA384')
SHA384=1;
elseif(METH=='SHA512')
SHA512=1;
end
The hash.m starts with these lines,there is no calling function of image_hash() in that line. What should be done?
Darsana P M
Darsana P M il 15 Apr 2018
Sir I downloaded all the above files. I tried to run hash.m file. I got this error.
David Fletcher
David Fletcher il 15 Apr 2018
Modificato: David Fletcher il 15 Apr 2018
YOU should be calling image_hash(V_LEN,H_LEN,METH,IMG_FILE) NOT hash(). image_hash(V_LEN,H_LEN,METH,IMG_FILE) then calls hash (see the last line of image_hash). In turn I imagine hash then calls the other functions you have downloaded). Beyond dealing with the results image_hash returns (or the errors it produces), your interest in the matter ends with calling image_hash
Darsana P M
Darsana P M il 15 Apr 2018
So what must be done sir?
Darsana P M
Darsana P M il 15 Apr 2018
Modificato: Darsana P M il 15 Apr 2018
Sir, hash.m here its not a function. image_hash() is a function. At the end I see hash too. What change should i do to remove the error? I am confused now, but i really want to work this out. If you could help me, please do help.
Right now, I tried running hash.m, I got an error?
David Fletcher
David Fletcher il 15 Apr 2018
Modificato: David Fletcher il 15 Apr 2018
I've just had a closer look and noticed that hash is an m file rather than a function. I've tried setting the variables in the workspace and running image_hash on a test file. No errors as such, but that was about half an hour ago and it's still running. Maybe there's a reason the submission has no stars awarded.
V_LEN=169
H_LEN=298
METH='SHA160'
image_hash(V_LEN,H_LEN,METH,'three.jpg')
Darsana P M
Darsana P M il 15 Apr 2018
Yes sir. Thanks sir.Now there is no error, but the program is still running. is there a way out?
Can you suggest some other algorithms for digital signature on images.
David Fletcher
David Fletcher il 15 Apr 2018
Modificato: David Fletcher il 15 Apr 2018
It was running on my computer for over an hour before I interrupted it. Maybe it will eventually give an answer, or maybe it is badly written and gone into an infinite loop. Sorry, but I'm not much inclined trying to debug other people's submitted code. It might be worth putting a question out there asking for any recommendations for functions that do what you need. It's not really my area of expertise (not that I have any real areas of expertise anyway)
Darsana P M
Darsana P M il 15 Apr 2018
ok sir. Thanks a lot

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by