function h = funchash(fcnname)

% FUNCHASH compute MD5 hash of a MATLAB m-file.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: FUNCHASH compute MD5 hash of a MATLAB m-file.
%
% CALL:       h = funchash(mfile_name)
%
% INPUTS:     fcnname - The name of an m-file.
% 
% The first file found by 'which' is hashed.
%
% OUTPUTS:    h  - the hash string
%
% PARAMETERS: None.
% 
% EXAMPLES:
% 
%     >> h = funchash('ao');
% 
% VERSION:     $Id: funchash.m,v 1.1 2008/06/18 13:35:11 hewitson Exp $
%
% HISTORY: 21-11-07 M Hewitson
%            Creation.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Get filename
s = which(fcnname);

% Read in file
mfile = textread(s,'%s','delimiter','\n','whitespace','');

% hash this
h = ltpda_hash(char(mfile), 'MD5');

