digest: Create Compact Hash Digests of R Objects

> library(digest)

バージョン: 0.6.10


関数名 概略
AES Create AES block cipher object
digest Create hash function digests for arbitrary R objects
hmac compute a hash-based message authentication code
sha1 Calculate a SHA1 hash of an object

AES

> as.raw(1:16)
 [1] 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
> aes <- as.raw(1:16) %>% AES(mode = "ECB", IV = NULL)
> 
> msg <- as.raw(c(1:16, 1:16))
> aes$encrypt(msg)
 [1] 34 c3 3b 7f 14 fd 53 dc ea 25 e0 1a 02 e1 67 27 34 c3 3b 7f 14 fd 53
[24] dc ea 25 e0 1a 02 e1 67 27
> aes$decrypt(aes$encrypt(msg), raw = TRUE)
 [1] 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 01 02 03 04 05 06 07
[24] 08 09 0a 0b 0c 0d 0e 0f 10

digest

> digest("aiueo", "md5", serialize = FALSE)
[1] "acd78951602a8cbc0cae289ceb6e579f"
> digest(letters, "md5", serialize = FALSE)
[1] "0cc175b9c0f1b6a831c399e269772661"

sha1

> sha1("foo", digits = 4, zapsmall = 7)
[1] "8994a9998ba9235362215f62449f081c3bf83965"