美文网首页
使用Jacksum对文件夹和文件生成checksum

使用Jacksum对文件夹和文件生成checksum

作者: 新元素_max | 来源:发表于2018-06-05 16:07 被阅读0次

    Jacksum 是一个java开源工具, 用来 给单个文件生成checksum, 也可以给整个文件中所有文件生成checksum,生产的checksum 可以是MD系列,也可sha。

    你可以参考​ 官网 http://jacksum.net/

    Jacksum is a free and platform independent utility for computing and

    verifying checksums, CRCs and hashes (message digests) as well as 
    
    timestamps of files. Jacksum is written entirely in Java. 
    
    A Java Runtime Environment (JRE), at least version 1.3.1 or any 
    
    equivalent JRE is required. At least JRE 1.4.2 is recommended. 
    

    以下是一个给文件生产sha256.和MD5 checksum的示例

    ::Jacksum.bat "C:\Users\MingXin\Desktop\Temp" --> 要生产checksum的文件夹路径

    ::Temp-->checksum文件名

    ::Add by mingxin at 20160509 PM

    ::*******************start*************************

    jacksum.bat "C:\Users\MingXin\Desktop\Temp" Temp

    ::*******************end*************************

    ​​

    ​jacksum.bat

    @echo off

    :: ###############################################################################

    :: # Use this batch file for launching Jacksum easily from the command line #

    :: # just by typing "jacksum". You can remove this comment block if you like. #

    :: # #

    :: # You need to edit the path below (C:\Program Files ...) so jacksum.jar #

    :: # can be found! #

    :: # Make also sure, that this batch file is reachable by the #

    :: # operating system environment variable called PATH. #

    :: # #

    :: # The %* modifier is a unique modifier that represents all arguments #

    :: # passed in a batch file (e. g. %1 %2 %3 %4 %5 ...%5), but it may #

    :: # not work on all Windows platforms. In this case just use the old syntax: #

    :: # java -jar "C:\Program Files\Jacksum\jacksum.jar" %1 %2 %3 %4 %5 %6 %7 %8 %9 #

    :: ###############################################################################

    :: add by mingxin at 20160509 PM

    :: 执行jacksum.jar 文件产生checksum

    ::###################################Start#########################################

    java -jar jacksum.jar -a sha256 -f -r -w %1 > %2_object_Javasum_windows.sha256

    java -jar jacksum.jar -a sha256 %2_object_Javasum_windows.sha256 > %2_summary_Javasum_windows.sha256

    java -jar jacksum.jar -a md5sum -f -r -w %1 > MD5_object_Javasum_windows.md5

    ::移动checksum 文件到指定的目录checksum

    move %2_object_Javasum_windows.sha256 %1

    move %2_summary_Javasum_windows.sha256 %1

    move MD5_object_Javasum_windows.md5 %1

    ::生成存放checksum _summary_Javasum_windows.sha256 文件夹Javachecksum

    ::移动checksum 文件到 Javachecksum

    chdir %1

    mkdir Javachecksum

    chdir .

    move %2_object_Javasum_windows.sha256 %1\Javachecksum

    move %2_summary_Javasum_windows.sha256 %1\Javachecksum

    move MD5_object_Javasum_windows.md5 %1\Javachecksum

    ::###################################End##########################################

    相关文章

      网友评论

          本文标题:使用Jacksum对文件夹和文件生成checksum

          本文链接:https://www.haomeiwen.com/subject/orfmsftx.html