Sha1()

From TinyMUX
Jump to navigation Jump to search

Description

FUNCTION: sha1(string)

Returns 40 hexadecimal characters which represent a 160-bit cryptographically secure hash of string.

This hash can also be described as a signature, fingerprint, or digest. sha1() implements SHA-1 as described in FIPS 180-1 and FIPS 180-2.

Related Topics: crc32(), digest(), sha0(), unpack().

Examples

> think sha1(abc)
A9993E364706816ABA3E25717850C26C9CD0D89D
> think sha1(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)
84983E441C3BD26EBAAE4AA1F95129E5E54670F1

Server Differences

PennMUSH provides sha0() instead of sha1(). As SHA was being adopted as a standard, it was also being implemented and deployed. SHA-0 is the submitted version and the version adopted in FIPS 180. It is also a de-facto standard in that it has been deployed. FIPS 180 was withdrawn shortly after publication. SHA-1 is the current version adopted in FIPS 180-1 and FIPS 180-2. To obtain SHA-1 on PennMUSH, use the sha1 algorithm in digest(). SHA-0 and SHA-1 are both available from digest().

TinyMUX hashes contain upper-case letters while PennMUSH produces lower-case letters.