Skip to content

Commit

Permalink
tidy up readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jun 11, 2024
1 parent 1541979 commit 125673f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
18 changes: 8 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Base64 encoding and decoding of strings, raw vectors and serialized objects.

The SHA-3 Secure Hash Standard was published by the National Institute of Standards and Technology (NIST) in 2015 at [doi:10.6028/NIST.FIPS.202](https://dx.doi.org/10.6028/NIST.FIPS.202). SHA-3 is based on the Keccak algorithm, designed by G. Bertoni, J. Daemen, M. Peeters and G. Van Assche. The SHA-256 Secure Hash Standard was published by NIST in 2002 at <https://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf>. The SipHash family of pseudo-random functions by Jean-Philippe Aumasson and Daniel J. Bernstein was published in 2012 at <https://ia.cr/2012/351>.<sup>[1]</sup>

The SHA-256, SHA-3, Keccak, and base64 encoding/decoding implementations are based on those by the 'Mbed TLS' Trusted Firmware Project at <https://www.trustedfirmware.org/projects/mbed-tls>. The SipHash implementation is based on that of Daniele Nicolodi, David Rheinsberg and Tom Gundersen at <https://github.com/c-util/c-siphash>, which is in turn based on the reference implementation by Jean-Philippe Aumasson and Daniel J. Bernstein released to the public domain at <https://github.com/veorq/SipHash>.
The SHA-256, SHA-3, Keccak, and base64 implementations are based on those by the 'Mbed TLS' Trusted Firmware Project at <https://www.trustedfirmware.org/projects/mbed-tls>. The SipHash implementation is based on that of Daniele Nicolodi, David Rheinsberg and Tom Gundersen at <https://github.com/c-util/c-siphash>, which is in turn based on the reference implementation by Jean-Philippe Aumasson and Daniel J. Bernstein released to the public domain at <https://github.com/veorq/SipHash>.

### Quick Start

Expand All @@ -63,9 +63,10 @@ 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).
All other objects are stream hashed using R serialization

- Portable as always uses R serialization version 3 big-endian representation, skipping headers (which contain R version and native encoding information)
- 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}
sha3(data.frame(a = 1, b = 2), bits = 224)
Expand All @@ -85,10 +86,8 @@ unlink(file)

#### Hash to integer / SHAKE256 XOF

Specify 'convert' as `NA` (and 'bits' as `32` for a single integer value).

- May be supplied as deterministic random seeds for R's pseudo random number generators (RNGs)

May be used as deterministic random seeds for R's pseudo random number generators (RNGs). <br />
Specify 'convert' as `NA` (and 'bits' as `32` for a single integer value):
```{r integer}
shake256("秘密の基地の中", bits = 32, convert = NA)
```
Expand All @@ -114,9 +113,8 @@ sha256("secret base", key = "秘密の基地の中")

#### SipHash

SipHash-1-3 is optimized for performance.

- Pass a character string or raw vector to 'key' - up to 16 bytes (128 bits) of the key data is used
SipHash-1-3 is optimized for performance. <br />
Pass a character string or raw vector to 'key' - up to 16 bytes (128 bits) of the key data is used:
```{r siphash}
siphash13("secret base", key = charToRaw("秘密の基地の中"))
```
Expand Down
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ SipHash family of pseudo-random functions by Jean-Philippe Aumasson and
Daniel J. Bernstein was published in 2012 at
<https://ia.cr/2012/351>.<sup>\[1\]</sup>

The SHA-256, SHA-3, Keccak, and base64 encoding/decoding implementations
are based on those by the ‘Mbed TLS’ Trusted Firmware Project at
The SHA-256, SHA-3, Keccak, and base64 implementations are based on
those by the ‘Mbed TLS’ Trusted Firmware Project at
<https://www.trustedfirmware.org/projects/mbed-tls>. The SipHash
implementation is based on that of Daniele Nicolodi, David Rheinsberg
and Tom Gundersen at <https://github.com/c-util/c-siphash>, which is in
Expand Down Expand Up @@ -81,10 +81,10 @@ 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
- 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)

Expand All @@ -108,11 +108,9 @@ sha3(file = file)

#### Hash to integer / SHAKE256 XOF

Specify ‘convert’ as `NA` (and ‘bits’ as `32` for a single integer
value).

- May be supplied as deterministic random seeds for R’s pseudo random
number generators (RNGs)
May be used as deterministic random seeds for R’s pseudo random number
generators (RNGs). <br /> Specify ‘convert’ as `NA` (and ‘bits’ as `32`
for a single integer value):

``` r
shake256("秘密の基地の中", bits = 32, convert = NA)
Expand Down Expand Up @@ -148,10 +146,9 @@ sha256("secret base", key = "秘密の基地の中")

#### SipHash

SipHash-1-3 is optimized for performance.

- Pass a character string or raw vector to ‘key’ - up to 16 bytes (128
bits) of the key data is used
SipHash-1-3 is optimized for performance. <br /> Pass a character string
or raw vector to ‘key’ - up to 16 bytes (128 bits) of the key data is
used:

``` r
siphash13("secret base", key = charToRaw("秘密の基地の中"))
Expand Down

0 comments on commit 125673f

Please sign in to comment.