Skip to content

Commit

Permalink
edit docs wording
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Mar 17, 2024
1 parent 2e3d805 commit 9277351
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 50 deletions.
28 changes: 14 additions & 14 deletions R/base.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@

#' Cryptographic Hashing Using the SHA-3 Algorithms
#'
#' Returns a SHA-3 hash of the supplied R object or file.
#'
#' @param x R object to hash. A character string or raw vector (without
#' attributes) is hashed 'as is'. All other objects are hashed using R
#' serialization in a memory-efficient 'streaming' manner, without
#' allocation of the serialized object. To ensure portability, serialization
#' v3 XDR is always used with headers skipped (as these contain R version
#' and encoding information).
#' Returns a SHA-3 hash of the supplied object or file.
#'
#' @param x object to hash. A character string or raw vector (without
#' attributes) is hashed 'as is'. All other objects are stream hashed using
#' R serialization, but without requiring allocation of the serialized
#' object. To ensure portability, serialization version 3 big-endian
#' represenation is always used with headers skipped (as these contain R
#' version and native encoding information).
#' @param bits [default 256L] output size of the returned hash. If one of 224,
#' 256, 384 or 512, uses the relevant SHA-3 cryptographic hash function. For
#' all other values, uses the SHAKE256 extendable-output function (XOF).
#' 256, 384 or 512, uses the respective SHA-3 cryptographic hash function.
#' For all other values, uses the SHAKE256 extendable-output function (XOF).
#' Must be between 8 and 2^24 and coercible to integer.
#' @param convert [default TRUE] if TRUE, the hash is converted to its hex
#' representation as a character string, if FALSE, output directly as a raw
#' vector, or if NA, a vector of (32-bit) integer values.
#' @param file character file name / path. If specified, 'x' is ignored. The
#' file is hashed in a streaming fashion and may be larger than memory.
#' file is stream hashed, thus capable of handling files larger than memory.
#'
#' @return A character string, raw or integer vector depending on 'convert'.
#'
Expand Down Expand Up @@ -101,7 +101,7 @@ sha3 <- function(x, bits = 256L, convert = TRUE, file)

#' Cryptographic Hashing Using the SHA-256 Algorithm
#'
#' Returns a SHA-256 hash of the supplied R object or file.
#' Returns a SHA-256 hash of the supplied object or file.
#'
#' @inheritParams sha3
#'
Expand Down Expand Up @@ -135,8 +135,8 @@ sha256 <- function(x, convert = TRUE, file)

#' Hashing Using the SipHash-1-3 Pseudorandom Function
#'
#' Returns a cryptographically-strong SipHash-1-3 hash of the supplied R object
#' or file.
#' Returns a fast, cryptographically-strong SipHash-1-3 hash of the supplied
#' object or file.
#'
#' @inheritParams sha3
#' @param key [default NULL] an atomic vector comprising the 16 byte (128 bit)
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ The SHA-256 and SHA-3 implementations are based on those by the 'Mbed TLS' Trust

### Installation

Install the latest version from R-releases or CRAN:
Install the latest version from CRAN:

```{r rrel, eval=FALSE}
install.packages("secretbase", repos = "https://r-releases.r-universe.dev")
install.packages("secretbase")
```

Or the development version from the author's R-universe:
Or the development version from R-universe:

```{r runiv, eval=FALSE}
install.packages("secretbase", repos = "https://shikokuchuo.r-universe.dev")
Expand Down Expand Up @@ -68,7 +68,7 @@ sha3("秘密の基地の中", bits = 512)
##### Hash arbitrary R objects:

- uses memory-efficient 'streaming' serialization (no allocation of serialized object)
- portable as always uses R serialization v3 XDR, skipping headers (which contain R version and encoding information)
- portable as always uses R serialization version 3 big-endian representation, skipping headers (which contain R version and native encoding information)

```{r streaming}
sha3(data.frame(a = 1, b = 2), bits = 160)
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ Daniel J. Bernstein released to the public domain at

### Installation

Install the latest version from R-releases or CRAN:
Install the latest version from CRAN:

``` r
install.packages("secretbase", repos = "https://r-releases.r-universe.dev")
install.packages("secretbase")
```

Or the development version from the author’s R-universe:
Or the development version from R-universe:

``` r
install.packages("secretbase", repos = "https://shikokuchuo.r-universe.dev")
Expand Down Expand Up @@ -85,8 +85,9 @@ sha3("秘密の基地の中", bits = 512)

- uses memory-efficient ‘streaming’ serialization (no allocation of
serialized object)
- portable as always uses R serialization v3 XDR, skipping headers
(which contain R version and encoding information)
- portable as always uses R serialization version 3 big-endian
representation, skipping headers (which contain R version and native
encoding information)

``` r
sha3(data.frame(a = 1, b = 2), bits = 160)
Expand Down
16 changes: 8 additions & 8 deletions man/sha256.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions man/sha3.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions man/siphash13.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9277351

Please sign in to comment.