Files
calc/help/md5
2017-05-21 15:38:36 -07:00

129 lines
3.6 KiB
Plaintext

NAME
md5 - MD5 Message-Digest Algorithm
SYNOPSIS
md5([arg1 [, val ...]])
TYPES
arg1 any
val any
return HASH or number
DESCRIPTION
The md5() builtin implements the MD5 Message-Digest Algorithm.
The SHA is a 128 bit hash.
With no args, md5() returns the default initial md5 HASH state.
If arg1 is a HASH state and no other val args are given, then the
HASH state is finalized and the numeric value of the hash is given.
If arg1 is a HASH state and one or more val args are given,
then the val args are used to modify the arg1 HASH state.
The new arg1 HASH state is returned.
If arg1 is not a a HASH state, then the initial HASH is
used and modifed by arg1 and any val args supplied. The
return value is the new HASH state.
The following table gives a summary of actions and return values.
Here, assume that 'h' is a HASH state:
md5() HASH returns initial HASH state
md5(h) number h is put into final form and the
numeric value of the hash state
md5(x) HASH modify the initial state by hashing 'x'
md5(md5(), x) HASH the same as md5(x)
md5(x, y) HASH the same as md5(md5(x), y)
md5(h, x, y) HASH modify state 'h' by 'x' and then 'y'
md5(md5(h,x,y)) number numeric value of the above call
NOTE: These functions were "derived from the RSA Data Security, Inc.
MD5 Message-Digest Algorithm".
EXAMPLE
> base(16)
0xa
> md5()
md5 hash state
> md5(md5())
0xd41d8cd98f00b204e9800998ecf8427e
> md5("x", "y", "z") == md5("xyz")
1
> md5("x", "y", "z") == md5("xy")
0
> md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash"))
0x5a90d942335b0dbbdce38d90e7cb6dac
> x = md5(list(1,2,3), "curds and whey", 2^21701-1, pi())
> x
md5 hash state
> md5(x)
0x88790b3ea9eb0128134c103ac9b683ed
> y = md5()
> y = md5(y, list(1,2,3), "curds and whey")
> y = md5(y, 2^21701-1)
> y = md5(y, pi())
> y
md5 hash state
> md5(y)
0x88790b3ea9eb0128134c103ac9b683ed
LIMITS
none
LINK LIBRARY
HASH* hash_init(int, HASH*);
void hash_free(HASH*);
HASH* hash_copy(HASH*);
int hash_cmp(HASH*, HASH*);
void hash_print(HASH*);
ZVALUE hash_final(HASH*);
HASH* hash_long(int, long, HASH*);
HASH* hash_zvalue(int, ZVALUE, HASH*);
HASH* hash_number(int, void*, HASH*);
HASH* hash_complex(int, void*, HASH*);
HASH* hash_str(int, char*, HASH*);
HASH* hash_usb8(int, USB8*, int, HASH*);
HASH* hash_value(int, void*, HASH*);
SEE ALSO
ishash, sha, sha1
## Copyright (C) 1999 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc 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 Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.1 $
## @(#) $Id: md5,v 29.1 1999/12/14 09:15:59 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/md5,v $
##
## Under source code control: 1997/04/06 19:45:54
## File existed as early as: 1997
##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/