Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b38d2da330d1936e5ab1307c039c4941 > files > 294

octave-doc-3.6.4-3.mga4.noarch.rpm

<html lang="en">
<head>
<title>Hashing Functions - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="System-Utilities.html#System-Utilities" title="System Utilities">
<link rel="prev" href="System-Information.html#System-Information" title="System Information">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Hashing-Functions"></a>
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="System-Information.html#System-Information">System Information</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="System-Utilities.html#System-Utilities">System Utilities</a>
<hr>
</div>

<h3 class="section">36.12 Hashing Functions</h3>

<p>It is often necessary to find if two strings or files are
identical.  This might be done by comparing them character by character
and looking for differences.  However, this can be slow, and so comparing
a hash of the string or file can be a rapid way of finding if the files
differ.

   <p>Another use of the hashing function is to check for file integrity.  The
user can check the hash of the file against a known value and find if
the file they have is the same as the one that the original hash was
produced with.

   <p>Octave supplies the <code>md5sum</code> function to perform MD5 hashes on
strings and files.  An example of the use of <code>md5sum</code> function might
be

<pre class="example">     if exist (file, "file")
       hash = md5sum (file);
     else
       # Treat the variable "file" as a string
       hash = md5sum (file, true);
     endif
</pre>
   <!-- md5sum src/DLD-FUNCTIONS/md5sum.cc -->
   <p><a name="doc_002dmd5sum"></a>

<div class="defun">
&mdash; Loadable Function:  <b>md5sum</b> (<var>file</var>)<var><a name="index-md5sum-3352"></a></var><br>
&mdash; Loadable Function:  <b>md5sum</b> (<var>str, opt</var>)<var><a name="index-md5sum-3353"></a></var><br>
<blockquote><p>Calculate the MD5 sum of the file <var>file</var>.  If the second parameter
<var>opt</var> exists and is true, then calculate the MD5 sum of the
string <var>str</var>. 
</p></blockquote></div>

<!-- DO NOT EDIT!  Generated automatically by munge-texi.pl. -->
<!-- Copyright (C) 2007-2012 S�ren Hauberg -->
<!-- This file is part of Octave. -->
<!-- Octave is free software; you can redistribute it and/or modify it -->
<!-- under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation; either version 3 of the License, or (at -->
<!-- your option) any later version. -->
<!-- Octave is distributed in the hope that it will be useful, but WITHOUT -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License -->
<!-- for more details. -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with Octave; see the file COPYING.  If not, see -->
<!-- <http://www.gnu.org/licenses/>. -->
   </body></html>