Name
SHA1 — SHA1 message digest class
Synopsis
The SHA1
class provides a one-way hash function
from arbitrary text data.
Class Methods
SHA1::new([
str
])
SHA1::sha1([
str
])
Creates a new
SHA1
object. If a string argument is given, it’s added to the object.
Instance Methods
sh
.clone
Copies the
SHA1
object.sh
.digest
Returns the
SHA1
hash of the added strings as a string of 16 bytes.sh
.hexdigest
Returns the
SHA1
hash of the added strings as a string of 32 hexadecimal digits.sh
.update(
str
)
sh
<<
str
Updates the
SHA1
object with the stringstr
. Repeated calls are equivalent to a single call with the concatenation of all the arguments, i.e.,m.update(a)
;m.update(b
) is equivalent tom.update(a+b)
, andm << a << b
is equivalent tom <<
a+b
.
Get Ruby in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.