From f515bee931c4ebfcde6a3a73f02e1195305ef969 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Tue, 14 May 2024 11:11:01 +0100 Subject: [PATCH] streamline DESCRIPTION --- DESCRIPTION | 15 +++++---------- R/base.R | 10 +++++----- README.Rmd | 15 +++++++++------ README.md | 25 +++++++++++++++---------- man/secretbase-package.Rd | 10 +++++----- 5 files changed, 39 insertions(+), 36 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bd1d56a..81396d1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,16 +3,11 @@ Type: Package Title: Cryptographic Hash and Extendable-Output Functions Version: 0.5.0.9000 Description: Fast and memory-efficient streaming hash functions. Performs direct - hashing of strings, raw bytes, and files potentially larger than memory, as - well as hashing in-memory objects through R's serialization mechanism, - without requiring allocation of the serialized object. Implementations - include the SHA-256, SHA-3 and 'Keccak' cryptographic hash functions, - SHAKE256 extendable-output function (XOF), and 'SipHash' pseudo-random - function. The SHA-3 Secure Hash Standard was published by the National - Institute of Standards and Technology (NIST) in 2015 at - . The SHA-256 Secure Hash Standard was published - by NIST in 2002 at - . + hashing of strings and raw vectors. Stream hashes files potentially larger + than memory, as well as in-memory objects through R's serialization + mechanism. Implementations include the SHA-256, SHA-3 and 'Keccak' + cryptographic hash functions, SHAKE256 extendable-output function (XOF), and + 'SipHash' pseudo-random function. Authors@R: c(person(given = "Charlie", family = "Gao", diff --git a/R/base.R b/R/base.R index 5df872b..9160a63 100644 --- a/R/base.R +++ b/R/base.R @@ -19,11 +19,11 @@ #' secretbase: Cryptographic Hash and Extendable-Output Functions #' #' Fast and memory-efficient streaming hash functions. Performs direct hashing -#' of strings, raw bytes, and files potentially larger than memory, as well -#' as hashing in-memory objects through R's serialization mechanism, without -#' requiring allocation of the serialized object. Implementations include -#' the SHA-256, SHA-3 and Keccak cryptographic hash functions, SHAKE256 -#' extendable-output function (XOF), and 'SipHash' pseudo-random function. +#' of strings and raw vectors. Stream hashes files potentially larger than +#' memory, as well as in-memory objects through R's serialization mechanism. +#' Implementations include the SHA-256, SHA-3 and 'Keccak' cryptographic +#' hash functions, SHAKE256 extendable-output function (XOF), and 'SipHash' +#' pseudo-random function. #' #' @encoding UTF-8 #' @author Charlie Gao \email{charlie.gao@@shikokuchuo.net} diff --git a/README.Rmd b/README.Rmd index 0cbe35c..237ebc0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -22,7 +22,7 @@ knitr::opts_chunk$set( [![DOI](https://zenodo.org/badge/745691432.svg)](https://zenodo.org/doi/10.5281/zenodo.10553139) -Fast and memory-efficient streaming hash functions. Performs direct hashing of strings, raw bytes, and files potentially larger than memory, as well as hashing in-memory objects through R's serialization mechanism, without requiring allocation of the serialized object. +Fast and memory-efficient streaming hash functions. Performs direct hashing of strings and raw vectors. Stream hashes files potentially larger than memory, as well as in-memory objects through R's serialization mechanism. Implementations include the SHA-256, SHA-3 and 'Keccak' cryptographic hash functions, SHAKE256 extendable-output function (XOF), and 'SipHash' pseudo-random function. @@ -63,10 +63,13 @@ sha3("秘密の基地の中", bits = 512) ``` -#### Hash arbitrary R objects +#### Hash strings and raw vectors - - Character strings and raw vectors (without attributes) are hashed 'as is' - - Other objects are hashed using memory-efficient 'streaming' serialization, without allocation of the serialized object + - Character strings and raw vectors are hashed directly (as per the above) + +#### Stream hash R objects + + - All other objects are stream hashed using R serialization (memory-efficient as performed without allocation of the serialized object) - Portable as always uses R serialization version 3 big-endian representation, skipping headers (which contain R version and native encoding information) ```{r streaming} @@ -75,9 +78,9 @@ sha3(data.frame(a = 1, b = 2), bits = 224) sha3(NULL) ``` -#### Hash files +#### Stream hash files - - Performed in a streaming fashion, accepting files larger than memory + - Files are read and hashed incrementally, accepting files larger than memory ```{r files} file <- tempfile(); cat("secret base", file = file) diff --git a/README.md b/README.md index e1af322..1649ce7 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ badge](https://shikokuchuo.r-universe.dev/badges/secretbase?color=e4723a)](https Fast and memory-efficient streaming hash functions. Performs direct -hashing of strings, raw bytes, and files potentially larger than memory, -as well as hashing in-memory objects through R’s serialization -mechanism, without requiring allocation of the serialized object. +hashing of strings and raw vectors. Stream hashes files potentially +larger than memory, as well as in-memory objects through R’s +serialization mechanism. Implementations include the SHA-256, SHA-3 and ‘Keccak’ cryptographic hash functions, SHAKE256 extendable-output function (XOF), and ‘SipHash’ @@ -80,12 +80,16 @@ sha3("秘密の基地の中", bits = 512) #> [1] "e30cdc73f6575c40d55b5edc8eb4f97940f5ca491640b41612e02a05f3e59dd9c6c33f601d8d7a8e2ca0504b8c22f7bc69fa8f10d7c01aab392781ff4ae1e610" ``` -#### Hash arbitrary R objects +#### Hash strings and raw vectors -- Character strings and raw vectors (without attributes) are hashed ‘as - is’ -- Other objects are hashed using memory-efficient ‘streaming’ - serialization, without allocation of the serialized object +- Character strings and raw vectors are hashed directly (as per the + above) + +#### Stream hash R objects + +- All other objects are stream hashed using R serialization + (memory-efficient as performed without allocation of the serialized + object) - Portable as always uses R serialization version 3 big-endian representation, skipping headers (which contain R version and native encoding information) @@ -98,9 +102,10 @@ sha3(NULL) #> [1] "b3e37e4c5def1bfb2841b79ef8503b83d1fed46836b5b913d7c16de92966dcee" ``` -#### Hash files +#### Stream hash files -- Performed in a streaming fashion, accepting files larger than memory +- Files are read and hashed incrementally, accepting files larger than + memory ``` r file <- tempfile(); cat("secret base", file = file) diff --git a/man/secretbase-package.Rd b/man/secretbase-package.Rd index f2ff20b..784963c 100644 --- a/man/secretbase-package.Rd +++ b/man/secretbase-package.Rd @@ -8,11 +8,11 @@ \title{secretbase: Cryptographic Hash and Extendable-Output Functions} \description{ Fast and memory-efficient streaming hash functions. Performs direct hashing - of strings, raw bytes, and files potentially larger than memory, as well - as hashing in-memory objects through R's serialization mechanism, without - requiring allocation of the serialized object. Implementations include - the SHA-256, SHA-3 and Keccak cryptographic hash functions, SHAKE256 - extendable-output function (XOF), and 'SipHash' pseudo-random function. + of strings and raw vectors. Stream hashes files potentially larger than + memory, as well as in-memory objects through R's serialization mechanism. + Implementations include the SHA-256, SHA-3 and 'Keccak' cryptographic + hash functions, SHAKE256 extendable-output function (XOF), and 'SipHash' + pseudo-random function. } \seealso{ Useful links: