Bug #5167 ยป 0001-adding-head-documentation-and-example-for-Digest-mod.patch
| ext/digest/digest.c | ||
|---|---|---|
|
* Document-module: Digest
|
||
|
*
|
||
|
* This module provides a framework for message digest libraries.
|
||
|
*
|
||
|
* You may want to have a look at OpenSSL::Digest as this implementation is more efficient, more up to date, and
|
||
|
* support more algorithms.
|
||
|
*
|
||
|
*
|
||
|
* A cryptographic hash function is a procedure that takes data and return a fixed bit string : the hash value,
|
||
|
* also known as _digest_. Hash functions are also called one-way functions : it is easy to compute a digest from
|
||
|
* a message, but it is infeasable to generate a message from a digest.
|
||
|
*
|
||
|
* ==Example
|
||
|
* require 'digest'
|
||
|
*
|
||
|
* # Compute a complete digest
|
||
|
* sha256 = Digest::SHA256.new
|
||
|
* digest = sha256.digest(message)
|
||
|
*
|
||
|
* # Compute digest by shunks
|
||
|
* sha256.reset
|
||
|
* sha256.update(message1)
|
||
|
* sha256 << message2 # << is an alias for update
|
||
|
* digest = sha256.digest
|
||
|
*
|
||
|
* ==Digest algorithms
|
||
|
* Different digest algorithms (or hash functions) are available :
|
||
|
* * SHA1 (see FIPS 180-2 <i>Secure Hash Standard</i>);
|
||
|
* * SHA2 family (SHA256, SHA384, SHA512, see FIPS 180-2 <i>Secure Hash Standard</i>) ;
|
||
|
* * HMAC (see FIPS PUB 198 <i>The Keyed-Hash Message Authentication Code (HMAC)</i>).
|
||
|
*
|
||
|
*/
|
||
|
static VALUE
|
||