暗号理論 – Rによるファイルのハッシュ値生成

Script
library(digest)
username<-Sys.info()['user']
pathForHash<-paste("C:/Users/",username,"/Desktop/hashFiles/",sep="")
files<-dir(pathForHash)
algo<-"sha256"
#"md5", "sha1", "crc32", "sha256", "sha512", "xxhash32", "xxhash64", "murmur32"
if(1<=length(files)){
  for(fff in 1:length(files)){
    hash<-digest(
      paste(pathForHash,files[fff],sep=""),
      algo,
      serialize=T,
      file=T,
      length=Inf,
      skip=0,
      ascii=F,
      raw=F,
      seed=0
    )
    cat("No.",fff,"\n")
    cat("FileName",files[fff],"\n")
    cat("Algorithm",algo,"\n")
    cat("Hash",hash,"\n\n")
  }
}
Result
No. 1 
FileName CPIAUCSL.xls 
Algorithm sha256 
Hash 393ce3690c2a19d2056f140dee102ff5c97372cd421f0421f38b003be8e4a503 

No. 2 
FileName d41ma.csv 
Algorithm sha256 
Hash c517f15fa93666a2c101dd62a045d84c8e7214f6916a590ffd669720ee1ad612 

No. 3 
FileName d51ma.csv 
Algorithm sha256 
Hash 2ac8b2037397b0501785f4392552e67e8279bbb665417759d85b9e0f2860f77e 

No. 4 
FileName d52ma001.csv 
Algorithm sha256 
Hash 2ee1910cd8807881bc457ab5421969d9b4c5168cc5f9fba93154e808452bb94b 

No. 5 
FileName GDPC1.xls 
Algorithm sha256 
Hash 972d60ef7862350ceeb7f03581d49b303a1c4e4a01dd19d10b58e9751f163190 

No. 6 
FileName UNRATE.xls 
Algorithm sha256 
Hash 4a260017f6e7514715cfe9ff2c21f707f058e9fe8724e304951fba51c891710d