summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2000-09-18 15:34:57 (GMT)
committerTim Peters <tim.peters@gmail.com>2000-09-18 15:34:57 (GMT)
commit1de8098ca685a2d9e9c5eb2e3ebaeb8190004b4c (patch)
tree79f35b2ac79703ae6565d80384c82b44c71e36da
parent09cad08d754e5d458d79d26ff61fccfeff39a059 (diff)
downloadcpython-1de8098ca685a2d9e9c5eb2e3ebaeb8190004b4c.zip
cpython-1de8098ca685a2d9e9c5eb2e3ebaeb8190004b4c.tar.gz
cpython-1de8098ca685a2d9e9c5eb2e3ebaeb8190004b4c.tar.bz2
Repaired some glitches in the MD5 and SHA docs; copied the descriptions of
the MD5 methods into the SHA docs (substituting "sha" for "md5", of course, and changing the stuff that depended on digest size accordingly). Fred, don't trust me!
-rw-r--r--Doc/lib/libmd5.tex8
-rw-r--r--Doc/lib/libsha.tex33
2 files changed, 31 insertions, 10 deletions
diff --git a/Doc/lib/libmd5.tex b/Doc/lib/libmd5.tex
index cf35c8c..bec1132 100644
--- a/Doc/lib/libmd5.tex
+++ b/Doc/lib/libmd5.tex
@@ -8,7 +8,7 @@
This module implements the interface to RSA's MD5 message digest
\index{message digest, MD5}
algorithm (see also Internet \rfc{1321}). Its use is quite
-straightforward:\ use the \function{new()} to create an md5 object.
+straightforward:\ use \function{new()} to create an md5 object.
You can now feed this object with arbitrary strings using the
\method{update()} method, and at any point you can ask it for the
\dfn{digest} (a strong kind of 128-bit checksum,
@@ -56,13 +56,15 @@ arguments, i.e.\ \code{m.update(a); m.update(b)} is equivalent to
\begin{methoddesc}[md5]{digest}{}
Return the digest of the strings passed to the \method{update()}
-method so far. This is an 16-byte string which may contain
+method so far. This is a 16-byte string which may contain
non-\ASCII{} characters, including null bytes.
\end{methoddesc}
\begin{methoddesc}[md5]{hexdigest}{}
Like \method{digest()} except the digest is returned as a string of
-length 32, containing only hexadecimal digits.
+length 32, containing only hexadecimal digits. This may
+be used to exchange the value safely in email or other non-binary
+environments.
\end{methoddesc}
\begin{methoddesc}[md5]{copy}{}
diff --git a/Doc/lib/libsha.tex b/Doc/lib/libsha.tex
index d8a5c26..4d15abe 100644
--- a/Doc/lib/libsha.tex
+++ b/Doc/lib/libsha.tex
@@ -8,12 +8,12 @@
This module implements the interface to NIST's\index{NIST} secure hash
algorithm,\index{Secure Hash Algorithm} known as SHA. It is used in
-the same way as the \refmodule{md5} module:\ use the \function{new()}
+the same way as the \refmodule{md5} module:\ use \function{new()}
to create an sha object, then feed this object with arbitrary strings
using the \method{update()} method, and at any point you can ask it
for the \dfn{digest} of the concatenation of the strings fed to it
-so far.\index{checksum!SHA} SHA digests are 160 bits instead of 128
-bits.
+so far.\index{checksum!SHA} SHA digests are 160 bits instead of
+MD5's 128 bits.
\begin{funcdesc}{new}{\optional{string}}
@@ -37,14 +37,33 @@ attributes of the sha objects returned by \function{new()}:
\end{datadesc}
-A sha object has all the methods the md5 objects have, plus one:
+An sha object has the same methods as md5 objects:
+
+\begin{methoddesc}[sha]{update}{arg}
+Update the sha object with the string \var{arg}. Repeated calls are
+equivalent to a single call with the concatenation of all the
+arguments, i.e.\ \code{m.update(a); m.update(b)} is equivalent to
+\code{m.update(a+b)}.
+\end{methoddesc}
+
+\begin{methoddesc}[sha]{digest}{}
+Return the digest of the strings passed to the \method{update()}
+method so far. This is a 20-byte string which may contain
+non-\ASCII{} characters, including null bytes.
+\end{methoddesc}
\begin{methoddesc}[sha]{hexdigest}{}
- Return the digest value as a string of hexadecimal digits. This may
- be used to exchange the value safely in email or other non-binary
- environments.
+Like \method{digest()} except the digest is returned as a string of
+length 40, containing only hexadecimal digits. This may
+be used to exchange the value safely in email or other non-binary
+environments.
\end{methoddesc}
+\begin{methoddesc}[sha]{copy}{}
+Return a copy (``clone'') of the sha object. This can be used to
+efficiently compute the digests of strings that share a common initial
+substring.
+\end{methoddesc}
\begin{seealso}
\seetitle[http://csrc.nist.gov/fips/fip180-1.txt]{Secure Hash Standard}{