From TinyMUX
Jump to: navigation, search


FUNCTION: 20px-Function.png 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().


> think sha1(abc)
> think sha1(abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq)

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.