Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Hash Functions

tarcieri edited this page Dec 1, 2014 · 6 revisions

Cryptographic hash functions compute a fixed length string, the message digest. Even a small change in the input data should produce a large change in the digest, and it is 'very difficult' to create two messages with the same digest.

A cryptographic hash can be used for checking the integrity of data, but there is no secret involved in the hashing, so anyone can create the hash of a given message.

Hash function diagram

Code Example

# compute the SHA-256 digest of the message.
RbNaCl::Hash.sha256(message)
#=> "..." # a string of bytes.

# compute the Blake2b digest of a message
RbNaCl::Hash.blake2b(message)
#=> "..." # a string of bytes.
Clone this wiki locally
Morty Proxy This is a proxified and sanitized view of the page, visit original site.