-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakehash.m
28 lines (24 loc) · 950 Bytes
/
makehash.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% ------------- DOKUMENTATION OF THIS FUNCTION -------------
%
% #DESCRIPTION: This function generates a sha1 hash to name the
% simulated optics files. Further a string "strline"
% to write in a database and a generic data name
% "DataNameOptics" is generated.
%
% #INPUT: input_string (string)
%
% #OUTPUT: DataNameOptics (string)
% strline (string)
% hash (string)
%
% #SAVED DATA: -
%
% #REQUIRED SUBFUNCTIONS: -
%
% -----------------------------------------------------------
function hash = makehash( input_string )
% Generate sha1 hash using .NET environement (only works with windows)
sha1hasher = System.Security.Cryptography.SHA1Managed;
sha1 = uint8(sha1hasher.ComputeHash(uint8(input_string)));
hash = convertCharsToStrings(dec2hex(sha1));
end