| Title: | Hardware-Accelerated 'CRC Checksums' from the AWS Common Runtime |
|---|---|
| Description: | Computes 'CRC32', 'CRC32C' and 'CRC64NVME' 'checksums' using the 'aws-checksums' library from the 'AWS' Common Runtime, with runtime dispatch to hardware instructions ('SSE4.2', 'PCLMULQDQ', 'AVX-512', 'ARMv8' 'CRC' and 'PMULL') and a portable software fallback. |
| Authors: | Dyfan Jones [aut, cre], Amazon.com, Inc. or its affiliates [cph] (Author of the bundled aws-checksums and aws-c-common libraries) |
| Maintainer: | Dyfan Jones <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.1.1 |
| Built: | 2026-10-18 18:28:11 UTC |
| Source: | https://github.com/paws-r/aws-crt-r |
Compute CRC32, CRC32C (Castagnoli) and CRC64NVME checksums with the
aws-checksums library from the AWS Common Runtime.
crc32(x, previous = NULL, raw = FALSE) crc32c(x, previous = NULL, raw = FALSE) crc64nvme(x, previous = NULL, raw = FALSE)crc32(x, previous = NULL, raw = FALSE) crc32c(x, previous = NULL, raw = FALSE) crc64nvme(x, previous = NULL, raw = FALSE)
x |
A raw vector, or a single string (converted to UTF-8 bytes). |
previous |
|
raw |
If |
Hardware instructions are used when the CPU supports them (SSE4.2, PCLMULQDQ and AVX-512 on x86-64, CRC and PMULL on arm64), otherwise a portable software implementation is used.
A hexadecimal string, or with raw = TRUE a big-endian raw vector
(length 4 or 8).
crc32c("123456789") crc64nvme("123456789") crc32c("123456789", raw = TRUE) # Incremental part1 <- crc32(charToRaw("1234"), raw = TRUE) identical(crc32(charToRaw("56789"), part1), crc32("123456789"))crc32c("123456789") crc64nvme("123456789") crc32c("123456789", raw = TRUE) # Incremental part1 <- crc32(charToRaw("1234"), raw = TRUE) identical(crc32(charToRaw("56789"), part1), crc32("123456789"))
Like crc32(), crc32c() and crc64nvme() but reading the file in chunks,
so files larger than memory can be checksummed.
crc32_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L) crc32c_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L) crc64nvme_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L)crc32_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L) crc32c_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L) crc64nvme_file(path, previous = NULL, raw = FALSE, chunk_size = 1048576L)
path |
Path to a file. |
previous |
|
raw |
If |
chunk_size |
Number of bytes to read at a time. Default chunk size (1 MiB) |
A hexadecimal string, or with raw = TRUE a big-endian raw vector,
see checksums.
f <- tempfile() writeLines("hello", f) crc32c_file(f) unlink(f)f <- tempfile() writeLines("hello", f) crc32c_file(f) unlink(f)
CPU features used for hardware acceleration
cpu_features()cpu_features()
A named logical vector of the CPU features detected at runtime by
the AWS Common Runtime. Features that do not apply to the current
architecture are FALSE.
cpu_features()cpu_features()