Skip to content

Commit

Permalink
Merge pull request #118 from ropensci/patch-checksum
Browse files Browse the repository at this point in the history
sha1 -> sha256
Tested with `dataone` package and verified that uploaded sysmeta contains the `sha256` value, and confirmed that the value is calculated correctly.
  • Loading branch information
gothub authored Aug 7, 2020
2 parents eed92cc + e958e80 commit ceef2d1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/DataObject.R
Original file line number Diff line number Diff line change
Expand Up @@ -557,16 +557,16 @@ setMethod("updateXML", signature("DataObject"), function(x, xpath=NA_character_,
x@data <- charToRaw(metadata)
x@filename <- NA_character_
x@sysmeta@size <- length(x@data)
x@sysmeta@checksum <- digest(x@data, algo="sha1", serialize=FALSE, file=FALSE)
x@sysmeta@checksumAlgorithm <- "SHA-1"
x@sysmeta@checksum <- digest(x@data, algo="sha256", serialize=FALSE, file=FALSE)
x@sysmeta@checksumAlgorithm <- "SHA-256"
} else {
# Read the file from disk and return the contents as raw
x@data <- raw()
x@filename <- newfile
fileinfo <- file.info(newfile)
x@sysmeta@size <- fileinfo$size
x@sysmeta@checksum <- digest(newfile, algo="sha1", serialize=FALSE, file=TRUE)
x@sysmeta@checksumAlgorithm <- "SHA-1"
x@sysmeta@checksum <- digest(newfile, algo="sha256", serialize=FALSE, file=TRUE)
x@sysmeta@checksumAlgorithm <- "SHA-256"
}

return(x)
Expand Down Expand Up @@ -624,4 +624,4 @@ setMethod("show", "DataObject",
}
}
)


0 comments on commit ceef2d1

Please sign in to comment.