An alternative to the simple interface when you need more control over the hashing (e.g. reading in a large file chunk-by-chunk). The mini-DSL is created with the concept of piping (i.e. use of %>%) in mind.

tlsh(content = NULL)

Arguments

content

Can be a URL, path, lenth 1+ character vector or raw vector. See Details for more info

Value

tlsh object

Details

At a minimum, a new, empty tlsh object will be created and returned. By specifying content, the caller can pre-populate the hash with content. Tests will performed on content and the behaviour will be different depending on what is passed in:

  • A raw vector will be added without any further processing

  • A single element character vector will be added without any further processing

  • A length >1 character vector will have each vector element added via the "update" mechanism.

Examples

# NOT RUN {
doc1 <- as.character(xml2::read_html(system.file("extdat", "index.html", package="tlsh")))

tlsh() %>%
  tlsh_update(doc1) %>%
  tlsh_finalize() -> x

tlsh_hash(x)

x
# }