Context Triggered Piecewise Hash Computation Using 'ssdeep'
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

18 lines
443 B

#' Return CTP hash of a raw vector
#'
#' @note Length 1 character vectors will be auto-converted to a raw vectors
#' @param x raw vector or length 1 character vector
#' @return character(1)
#' @export
#' @examples
#' ltrs <- paste0(c(letters, LETTERS), collapse="")
#' hash_raw(ltrs)
hash_raw <- function(x) {
stopifnot(is.raw(x) ||((length(x) == 1) && is.character(x)))
if (is.character(x[1])) x <- rawToChar(x[1])
int_hash_buf(x)
}