view m-toolbox/classes/+utils/@prog/funchash.m @ 11:9174aadb93a5 database-connection-manager

Add LTPDA Repository utility functions into utils.repository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

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');