在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
MD5算法常常被用来验证网络文件传输的完整性,防止文件被人篡改。MD5全称是报文摘要算法(Message-Digest Algorithm 5),此算法对任意长度的信息逐位进行计算,产生一个二进制长度为128位(十六进制长度就是32位)的“指纹”(或称“报文摘要”),不同的文件产生相 同的报文摘要的可能性是非常非常之小的。
适用于 Oracle 用户的技巧
一 生成一个文件的md5值 复制代码 代码如下:[oracle@node1 bin]$ md5sum lsnrctl
87df51eb21ee0643e47988a0d8136f18 lsnrctl 二 检查文件是否改变 复制代码 代码如下:[oracle@node1 ~]$ touch file1 file2
[oracle@node1 ~]$ ls file1 file2 patch.log [oracle@node1 ~]$ [oracle@node1 ~]$ md5sum file1 file2>f1f2 [oracle@node1 ~]$ md5sum --check f1f2 file1: OK file2: OK [oracle@node1 ~]$ echo "change" >>file1 [oracle@node1 ~]$ md5sum --check f1f2 file1: FAILED file2: OK md5sum: WARNING: 1 of 2 computed checksums did NOT match 实例如下: Shell 复制代码 代码如下:# touch f1.txt f2.txt # ls f1.txt f2.txt # md5sum *.txt > md5sumtest.md5 # cat md5sumtest.md5 d41d8cd98f00b204e9800998ecf8427e f1.txt d41d8cd98f00b204e9800998ecf8427e f2.txt # echo "hahaha" > f1.txt # md5sum -c md5sumtest.md5 f1.txt: FAILED f2.txt: OK md5sum: WARNING: 1 of 2 computed checksums did NOT match # echo "hahaha" > f2.txt # md5sum -c md5sumtest.md5 f1.txt: FAILED f2.txt: FAILED md5sum: WARNING: 2 of 2 computed checksums did NOT match # cat /dev/null > f1.txt # md5sum -c md5sumtest.md5 f1.txt: OK f2.txt: FAILED md5sum: WARNING: 1 of 2 computed checksums did NOT match # cat /dev/null > f2.txt # md5sum -c md5sumtest.md5 f1.txt: OK f2.txt: OK 复制代码 代码如下:# touch f1.txt f2.txt # ls f1.txt f2.txt # md5sum *.txt > md5sumtest.md5 # cat md5sumtest.md5 d41d8cd98f00b204e9800998ecf8427e f1.txt d41d8cd98f00b204e9800998ecf8427e f2.txt # echo "hahaha" > f1.txt # md5sum -c md5sumtest.md5 f1.txt: FAILED f2.txt: OK md5sum: WARNING: 1 of 2 computed checksums did NOT match # echo "hahaha" > f2.txt # md5sum -c md5sumtest.md5 f1.txt: FAILED f2.txt: FAILED md5sum: WARNING: 2 of 2 computed checksums did NOT match # cat /dev/null > f1.txt # md5sum -c md5sumtest.md5 f1.txt: OK f2.txt: FAILED md5sum: WARNING: 1 of 2 computed checksums did NOT match # cat /dev/null > f2.txt # md5sum -c md5sumtest.md5 f1.txt: OK f2.txt: OK |
请发表评论