1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2020 - Stéphane MOTTELET
6 * This file is hereby licensed under the terms of the GNU GPL v2.0,
7 * For more information, see the COPYING file which you should have received
8 * along with this program.
11 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="hash">
13 <refname>hash</refname>
14 <refpurpose>get checksum of file or string using various digest algorithms</refpurpose>
18 <synopsis>res = hash(fd, algorithm)
19 res = hash(string, algorithm)
23 <title>Arguments</title>
28 <para>hash result (a string)</para>
34 <para>a matrix of file descriptors returned by the function mopen.</para>
40 <para>a string or a matrix of strings</para>
44 <term>algorithm</term>
46 <para>a string (the hashing algorithm)</para>
52 <title>Description</title>
54 <function>hash</function> get the checksum of a file or a string using the hashing function <term>algorithm</term>. The available functions are:
57 <informaltable border="1">
60 <td>'crc32'</td><td>crc32 chechsum</td>
63 <td>'md5'</td><td>Message-Digest Algorithm 5</td>
66 <td>'sha1'</td><td>Secure Hash Algorithm 1 (160 bits)</td>
69 <td>'sha2', 'sha256'</td><td>Secure Hash Algorithm 2 (256 bits)</td>
72 <td>'sha3-224'</td><td>Secure Hash Algorithm 3 (224 bits)</td>
75 <td>'sha3-256'</td><td>Secure Hash Algorithm 3 (256 bits)</td>
78 <td>'sha3-384'</td><td>Secure Hash Algorithm 3 (384 bits)</td>
81 <td>'sha3-512'</td><td>Secure Hash Algorithm 3 (512 bits)</td>
88 <title>Examples</title>
89 <programlisting role="example"><![CDATA[
90 hash('hello world', 'md5')
91 hash('hello world', 'sha256')
92 hash(['hello';'world'], 'sha3-256')
94 fp = mopen(SCI+'/modules/core/etc/core.start')
100 <title>History</title>
103 <revnumber>6.1.1</revnumber>
104 <revremark>hash() introduced.</revremark>