Hash - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


StringTools

  

Hash

  

compute a hash value for a string

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

Hash( s, opts )

Parameters

s

-

Maple string or ByteArray; string to be hashed

opts

-

zero or more options of the form method=val or output=val

Options

• 

method : one of "md4", "md5", or "sha1". This specifies the hashing algorithm to use. The default value is "md5".

• 

output : one of string or integer This specifies whether the output should be a string with a hexadecimal representation of the hashed value, or an integer. The default value is string.

Description

• 

The procedure Hash computes a hash, or message digest of the string s. By default, it uses the MD5 message digest algorithm. However, by using the method= option, you can select a different hashing algorithm. The available methods are: "md5", "md4" and "sha1".

• 

This hashed value is represented by a string that is a hexadecimal representation of the integer value of the hash.

• 

The input can be a Maple string or a ByteArray. Using a ByteArray is necessary if the desired input contains bytes that are zero: a string cannot contain such bytes.

• 

It is extremely unlikely that two distinct strings, of arbitrary length, will produce the same hashed value.

• 

All of the StringTools package commands treat strings as (null-terminated) sequences of -bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

(9)

Compatibility

• 

The StringTools[Hash] command was updated in Maple 2019.

See Also

FileTools[Hash]

string

StringTools

 


Download Help Document