Class: Digest::SHA1

Inherits:
Base show all
Defined in:
sha1/sha1init.c,
sha1/sha1init.c

Overview

A class for calculating message digests using the SHA-1 Secure Hash Algorithm by NIST (the US’ National Institute of Standards and Technology), described in FIPS PUB 180-1.

See Digest::Instance for digest API.

SHA-1 calculates a digest of 160 bits (20 bytes).

Examples

require 'digest'

# Compute a complete digest
Digest::SHA1.hexdigest 'abc'      #=> "a9993e36..."

# Compute digest by chunks
sha1 = Digest::SHA1.new               # =>#<Digest::SHA1>
sha1.update "ab"
sha1 << "c"                           # alias for #update
sha1.hexdigest                        # => "a9993e36..."

# Use the same object to compute another digest
sha1.reset
sha1 << "message"
sha1.hexdigest                        # => "6f9b9af3..."

Method Summary

Methods inherited from Base

#<<, #block_length, #digest_length, #initialize_copy, #reset, #update

Methods inherited from Class

base64digest, bubblebabble, digest, file, hexdigest, #initialize

Methods included from Instance

#<<, #==, #base64digest, #base64digest!, #block_length, #bubblebabble, #digest, #digest!, #digest_length, #file, #hexdigest, #hexdigest!, #inspect, #length, #new, #reset, #size, #to_s, #update

Constructor Details

This class inherits a constructor from Digest::Class