国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

用git bash調(diào)用md5sum進(jìn)行批量MD5計(jì)算

這篇具有很好參考價(jià)值的文章主要介紹了用git bash調(diào)用md5sum進(jìn)行批量MD5計(jì)算。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

對(duì)于非常大的文件或者很重要的文件,在不穩(wěn)定的網(wǎng)絡(luò)環(huán)境下,可能文件的某些字節(jié)會(huì)損壞。此時(shí),對(duì)文件計(jì)算MD5即可以校驗(yàn)其完整性。比如本次的 OpenStreetMap 導(dǎo)出包,我的學(xué)弟反饋說(shuō),有朋友通過(guò)網(wǎng)盤(pán)下載無(wú)法解壓,并建議我增加每個(gè)文件的MD5校驗(yàn)。

對(duì)于文件非常多的情況,需要批量計(jì)算。尤其是對(duì)200多GB的分卷壓縮包,更可能傳輸過(guò)程中出錯(cuò)。最簡(jiǎn)便的方法是使用git自帶的md5sum進(jìn)行計(jì)算,看看哪個(gè)錯(cuò)了,再單獨(dú)下載一次。

1. 安裝git并進(jìn)入bash

到 https://git-scm.com/ 下載git,并安裝。

安裝后,右鍵單擊網(wǎng)盤(pán)下載的文件夾,選擇“git bash” 進(jìn)入bash:

用git bash調(diào)用md5sum進(jìn)行批量MD5計(jì)算,OpenStreetMap&GIS,基礎(chǔ)知識(shí),現(xiàn)場(chǎng)工程師,git,bash,開(kāi)發(fā)語(yǔ)言
用git bash調(diào)用md5sum進(jìn)行批量MD5計(jì)算,OpenStreetMap&GIS,基礎(chǔ)知識(shí),現(xiàn)場(chǎng)工程師,git,bash,開(kāi)發(fā)語(yǔ)言
可以查看 md5sum的說(shuō)明

$ md5sum --help
Usage: md5sum [OPTION]... [FILE]...
Print or check MD5 (128-bit) checksums.

With no FILE, or when FILE is -, read standard input.

  -b, --binary         read in binary mode (default unless reading tty stdin)
  -c, --check          read MD5 sums from the FILEs and check them
      --tag            create a BSD-style checksum
  -t, --text           read in text mode (default if reading tty stdin)
  -z, --zero           end each output line with NUL, not newline,
                       and disable file name escaping

The following five options are useful only when verifying checksums:
      --ignore-missing  don't fail or report status for missing files
      --quiet          don't print OK for each successfully verified file
      --status         don't output anything, status code shows success
      --strict         exit non-zero for improperly formatted checksum lines
  -w, --warn           warn about improperly formatted checksum lines

      --help     display this help and exit
      --version  output version information and exit

The sums are computed as described in RFC 1321.  When checking, the input
should be a former output of this program.  The default mode is to print a
line with checksum, a space, a character indicating input mode ('*' for binary,
' ' for text or where binary is insignificant), and name for each FILE.

Note: There is no difference between binary mode and text mode on GNU systems.

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Report any translation bugs to <https://translationproject.org/team/>
Full documentation <https://www.gnu.org/software/coreutils/md5sum>
or available locally via: info '(coreutils) md5sum invocation'

2. 批量計(jì)算md5

Linux常見(jiàn)命令 find 能夠枚舉文件并批量執(zhí)行指令。

執(zhí)行下面的指令,可以在屏幕輸出各個(gè)文件的md5:

$ find ./Arch*.* -exec md5sum {} \;
d060dd81785d957ae4e2bbd4f9ebeb4e *./ArchOSManjaro.7z.001
b7326e73452d3fbbc56a889f55aa9a14 *./ArchOSManjaro.7z.002
805c9ef68887953554c6c160c2a72eeb *./ArchOSManjaro.7z.003
#...
2cc5ab567abba1d7e3a284ec5c383d84 *./ArchOSManjaro.7z.059
$

執(zhí)行下面的指令,可以在文件輸出各個(gè)文件的md5:

$ find ./Arch*.* -exec md5sum {} >> md5.txt \;

3.比較兩個(gè)文件是否一致

我們假設(shè)本地校驗(yàn)結(jié)果放在check.txt,標(biāo)準(zhǔn)校驗(yàn)結(jié)果放在 md5.txt,則使用下面指令比較:

$ diff --help
Usage: diff [OPTION]... FILES
Compare FILES line by line.

Mandatory arguments to long options are mandatory for short options too.
      --normal                  output a normal diff (the default)
  -q, --brief                   report only when files differ
  -s, --report-identical-files  report when two files are the same
  -c, -C NUM, --context[=NUM]   output NUM (default 3) lines of copied context
  -u, -U NUM, --unified[=NUM]   output NUM (default 3) lines of unified context
  -e, --ed                      output an ed script
  -n, --rcs                     output an RCS format diff
  -y, --side-by-side            output in two columns
  -W, --width=NUM               output at most NUM (default 130) print columns
      --left-column             output only the left column of common lines
      --suppress-common-lines   do not output common lines

  -p, --show-c-function         show which C function each change is in
  -F, --show-function-line=RE   show the most recent line matching RE
      --label LABEL             use LABEL instead of file name and timestamp
                                  (can be repeated)

  -t, --expand-tabs             expand tabs to spaces in output
  -T, --initial-tab             make tabs line up by prepending a tab
      --tabsize=NUM             tab stops every NUM (default 8) print columns
      --suppress-blank-empty    suppress space or tab before empty output lines
  -l, --paginate                pass output through 'pr' to paginate it

  -r, --recursive                 recursively compare any subdirectories found
      --no-dereference            don't follow symbolic links
  -N, --new-file                  treat absent files as empty
      --unidirectional-new-file   treat absent first files as empty
      --ignore-file-name-case     ignore case when comparing file names
      --no-ignore-file-name-case  consider case when comparing file names
  -x, --exclude=PAT               exclude files that match PAT
  -X, --exclude-from=FILE         exclude files that match any pattern in FILE
  -S, --starting-file=FILE        start with FILE when comparing directories
      --from-file=FILE1           compare FILE1 to all operands;
                                    FILE1 can be a directory
      --to-file=FILE2             compare all operands to FILE2;
                                    FILE2 can be a directory

  -i, --ignore-case               ignore case differences in file contents
  -E, --ignore-tab-expansion      ignore changes due to tab expansion
  -Z, --ignore-trailing-space     ignore white space at line end
  -b, --ignore-space-change       ignore changes in the amount of white space
  -w, --ignore-all-space          ignore all white space
  -B, --ignore-blank-lines        ignore changes where lines are all blank
  -I, --ignore-matching-lines=RE  ignore changes where all lines match RE

  -a, --text                      treat all files as text
      --strip-trailing-cr         strip trailing carriage return on input
      --binary                    read and write data in binary mode

  -D, --ifdef=NAME                output merged file with '#ifdef NAME' diffs
      --GTYPE-group-format=GFMT   format GTYPE input groups with GFMT
      --line-format=LFMT          format all input lines with LFMT
      --LTYPE-line-format=LFMT    format LTYPE input lines with LFMT
    These format options provide fine-grained control over the output
      of diff, generalizing -D/--ifdef.
    LTYPE is 'old', 'new', or 'unchanged'.  GTYPE is LTYPE or 'changed'.
    GFMT (only) may contain:
      %<  lines from FILE1
      %>  lines from FILE2
      %=  lines common to FILE1 and FILE2
      %[-][WIDTH][.[PREC]]{doxX}LETTER  printf-style spec for LETTER
        LETTERs are as follows for new group, lower case for old group:
          F  first line number
          L  last line number
          N  number of lines = L-F+1
          E  F-1
          M  L+1
      %(A=B?T:E)  if A equals B then T else E
    LFMT (only) may contain:
      %L  contents of line
      %l  contents of line, excluding any trailing newline
      %[-][WIDTH][.[PREC]]{doxX}n  printf-style spec for input line number
    Both GFMT and LFMT may contain:
      %%  %
      %c'C'  the single character C
      %c'\OOO'  the character with octal code OOO
      C    the character C (other characters represent themselves)

  -d, --minimal            try hard to find a smaller set of changes
      --horizon-lines=NUM  keep NUM lines of the common prefix and suffix
      --speed-large-files  assume large files and many scattered small changes
      --color[=WHEN]       color output; WHEN is 'never', 'always', or 'auto';
                             plain --color means --color='auto'
      --palette=PALETTE    the colors to use when --color is active; PALETTE is
                             a colon-separated list of terminfo capabilities

      --help               display this help and exit
  -v, --version            output version information and exit

FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE' or 'FILE DIR'.
If --from-file or --to-file is given, there are no restrictions on FILE(s).
If a FILE is '-', read standard input.
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.

Report bugs to: bug-diffutils@gnu.org
GNU diffutils home page: <https://www.gnu.org/software/diffutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>

執(zhí)行指令:

$ diff  check.txt  md5.txt
36c36
< 23dfa036cd5d772f01173da67ebf2634 *./ArchOSManjaro.7z.029
---
> db2ce0bc5c39fd5d8f672f478788095c *./ArchOSManjaro.7z.029

可以看到第29號(hào)文件有問(wèn)題。

使用 -y 選項(xiàng),可以查看完整輸出(左右兩列)

$ diff -y check.txt  md5.txt
..
e155774f7dd158ded02d9a9aae68f5eb *./ArchOSManjaro.7z.028        e155774f7dd158ded02d9a9aae68f5eb *./ArchOSManjaro.7z.028
23dfa036cd5d772f01173da67ebf2634 *./ArchOSManjaro.7z.029      | db2ce0bc5c39fd5d8f672f478788095c *./ArchOSManjaro.7z.029
c8c32363ebd14a7eefce1cadaaa64def *./ArchOSManjaro.7z.030        c8c32363ebd14a7eefce1cadaaa64def *./ArchOSManjaro.7z.030
...

不一致的行,會(huì)用豎線“|”標(biāo)記。文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-819517.html

到了這里,關(guān)于用git bash調(diào)用md5sum進(jìn)行批量MD5計(jì)算的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • Linux shell編程學(xué)習(xí)筆記44:編寫(xiě)一個(gè)腳本,將md5sum命令執(zhí)行結(jié)果保存到變量中,進(jìn)而比較兩個(gè)文件內(nèi)容是否相同

    Linux shell編程學(xué)習(xí)筆記44:編寫(xiě)一個(gè)腳本,將md5sum命令執(zhí)行結(jié)果保存到變量中,進(jìn)而比較兩個(gè)文件內(nèi)容是否相同

    在? Linux shell編程學(xué)習(xí)筆記42:md5sum https://blog.csdn.net/Purpleendurer/article/details/137125672?spm=1001.2014.3001.5501 中,我們提到編寫(xiě)一個(gè)在Linux系統(tǒng)下比較兩個(gè)文件內(nèi)容是否相同的腳本。 基本思路是: 其中有兩個(gè)難點(diǎn): 1.文件的md5值的獲取 2.md5值的比較 對(duì)于第1個(gè)難點(diǎn),我們的解決辦法是

    2024年04月10日
    瀏覽(28)
  • 使用md5collgen進(jìn)行MD5碰撞實(shí)驗(yàn)

    使用md5collgen進(jìn)行MD5碰撞實(shí)驗(yàn)

    題目1:可在ubuntu主機(jī)上預(yù)先安裝md5collgen,題目為“生成兩個(gè)MD5哈希值一致但是文件內(nèi)容不同的文件”。 所謂“文件內(nèi)容不同但卻有相同的哈希值”就是 碰撞。 在這個(gè)題目中,我們將生成兩個(gè)具有相同MD5哈希值的不同文件。這兩個(gè)文件的開(kāi)始部分需要相同,即它們共享相同

    2024年01月24日
    瀏覽(22)
  • MD5算法:利用python進(jìn)行md5 hash值的獲取

    MD5算法:利用python進(jìn)行md5 hash值的獲取

    MD5,即信息摘要算法,英文為MD5 Message-Digest Algorithm,是一種被廣泛使用的密碼散列函數(shù),可以產(chǎn)生出一個(gè)128位(16字節(jié))的散列值(hash value),也叫散列值,用于確保信息傳輸完整一致。 它可以從一個(gè)字符串或一個(gè)文件中按照一定的規(guī)則生成一個(gè)特殊的字符串,這個(gè)特殊的

    2024年02月07日
    瀏覽(33)
  • postman 請(qǐng)求參數(shù)進(jìn)行md5加密

    1.在代碼片段中,使用 JavaScript 將需要加密的參數(shù)拼接成一個(gè)字符串,例如 2.安裝 CryptoJS 庫(kù)。在 Postman 的 \\\"Pre-request Script\\\" 或 \\\"Tests\\\" 中,使用以下命令安裝 CryptoJS: 3.在代碼片段中,使用 CryptoJS 對(duì)拼接后的字符串進(jìn)行 MD5 加密,轉(zhuǎn)化為小寫(xiě)字符串,賦值給請(qǐng)求變量。例如:

    2024年02月05日
    瀏覽(26)
  • shell腳本-批量獲取目錄下所有文件的md5值、大小、inode值

    shell腳本-批量獲取目錄下所有文件的md5值、大小、inode值

    MD5的全稱是Message-Digest Algorithm 5,它一種被廣泛使用的密碼散列函數(shù),可以產(chǎn)生出一個(gè)128位(16字節(jié))的散列值(hash value),用于確保信息傳輸完整一致。MD5值等同于文件的ID,它的值是唯一的。 如果文件已被修改,其MD5值將發(fā)生變化。 運(yùn)行結(jié)果: 文件儲(chǔ)存在硬盤(pán)上,硬盤(pán)的

    2024年02月09日
    瀏覽(26)
  • 在前端對(duì)登錄密碼進(jìn)行加密,md5+鹽值

    在前端對(duì)登錄密碼進(jìn)行加密,md5+鹽值

    場(chǎng)景:前端制定規(guī)則賬號(hào)密碼,后端不進(jìn)行參與,完全就是前端進(jìn)行校驗(yàn) 缺點(diǎn):對(duì)于現(xiàn)在網(wǎng)絡(luò)發(fā)達(dá)的時(shí)代,大部分人隨便攻擊你的網(wǎng)站就可以看到你的賬號(hào)密碼這樣就可以輕松進(jìn)入你的網(wǎng)站、不安全。 優(yōu)點(diǎn):基本沒(méi)有,除非就是臨時(shí)搭建 不需要后端 當(dāng)然這是我開(kāi)發(fā)時(shí)候的場(chǎng)

    2024年02月09日
    瀏覽(92)
  • java 使用hutool工具進(jìn)行MD5加密

    引入依賴 MD5加密

    2024年02月16日
    瀏覽(20)
  • 030:vue中使用md5進(jìn)行數(shù)據(jù)加密示例

    030:vue中使用md5進(jìn)行數(shù)據(jù)加密示例

    第030個(gè) 查看專欄目錄: VUE ------ element UI 在vue和element UI聯(lián)合技術(shù)棧的操控下,本專欄提供行之有效的源代碼示例和信息點(diǎn)介紹,做到靈活運(yùn)用。 (1)提供vue2的一些基本操作:安裝、引用,模板使用,computed,watch,生命周期(beforeCreate,created,beforeMount,mounted, beforeUpdate,upda

    2024年02月09日
    瀏覽(29)
  • Apifox&Postman請(qǐng)求參數(shù)進(jìn)行SHA256/MD5加密

    Base64加密,代碼如下: Base64解密,代碼如下: MD5加密,代碼如下: SHA256加密,代碼如下

    2024年02月16日
    瀏覽(27)
  • Java使用MD5加鹽對(duì)密碼進(jìn)行加密處理,附注冊(cè)和登錄加密解密處理

    Java使用MD5加鹽對(duì)密碼進(jìn)行加密處理,附注冊(cè)和登錄加密解密處理

    在開(kāi)發(fā)的時(shí)候,有一些敏感信息是不能直接通過(guò)明白直接保存到數(shù)據(jù)庫(kù)的。最經(jīng)典的就是密碼了。如果直接把密碼以明文的形式入庫(kù),不僅會(huì)泄露用戶的隱私,對(duì)系統(tǒng)也是極其的不厲,這樣做是非常危險(xiǎn)的。 那么我們就需要對(duì)這些銘文進(jìn)行加密。 現(xiàn)在市場(chǎng)是加密的方式已經(jīng)

    2024年02月02日
    瀏覽(22)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包