Learn R Programming

digest (version 0.6.37)

sha1: Calculate a SHA1 hash of an object

Description

Calculate a SHA1 hash of an object. The main difference with digest(x, algo = "sha1") is that sha1() will give the same hash on 32-bit and 64-bit systems. Note that the results depends on the setting of digits and zapsmall when handling floating point numbers. The current defaults keep digits and zapsmall as large as possible while maintaining the same hash on 32 bit and 64 bit systems.

Usage

sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for numeric
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for complex
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for Date
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for matrix
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for data.frame
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for array
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for list
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for pairlist
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for POSIXlt
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for POSIXct
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")
# S3 method for anova
sha1(x, digits = 4, zapsmall = 7, ..., algo = "sha1")
# S3 method for function
sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

# S3 method for formula sha1(x, digits = 14, zapsmall = 7, ..., algo = "sha1") # S3 method for `(` sha1(...)

sha1_digest(x, digits = 14, zapsmall = 7, ..., algo = "sha1") # S3 method for NULL sha1(...) # S3 method for name sha1(...)

sha1_attr_digest(x, digits = 14, zapsmall = 7, ..., algo = "sha1") # S3 method for call sha1(...) # S3 method for character sha1(...) # S3 method for factor sha1(...) # S3 method for integer sha1(...) # S3 method for logical sha1(...) # S3 method for raw sha1(...)

Author

Thierry Onkelinx

Arguments

x

the object to calculate the SHA1

digits

the approximate number of significant digits in base 10. Will be converted to a base 16 equivalent. Defaults to digits = 14, except for sha1.anova where digits = 4

zapsmall

the approximate negative magnitude of the smallest relevant digit. Will be converted to a base 2 equivalent. Values smaller than this number are equivalent to 0. Defaults to zapsmall = 7

...

If it is the only defined argument, passed to another sha1 method. If other arguments exist, see Details for usage.

algo

The hashing algoritm to be used by digest. Defaults to "sha1"

Details

sha1_digest() is a convenience function for objects where attributes cannot be added to apply the digest() function to its arguments. sha1_attr_digest() is a convenience function for objects where objects can be added to generate the hash. If generating hashes for objects in other packages, one of these two functions is recommended for use (typically, sha1_attr_digest()).

Extra arguments:

environment: An optional extra argument for sha1.function and sha1.formula should be TRUE, FALSE or missing. sha1.function and sha1.formula will ignore the enviroment of the function only when environment = FALSE.