2008. 6. 30. 00:09

linux - 해시함수

해시 함수로 암호화 하기

[root@centos ~]# seq 10 > nero.tar.gz
[root@centos ~]# cat nero.tar.gz
1
2
3
4
5
6
7
8
9
10
[root@centos ~]# md5sum nero.tar.gz
3b0332e02daabf31651a5a0d81ba830a  nero.tar.gz
[root@centos ~]# md5sum nero.tar.gz  > nero.md5
[root@centos ~]# scp nero.tar.gz nero.md5 root@192.168.10.10:
The authenticity of host '192.168.10.10 (192.168.10.10)' can't be established.
RSA key fingerprint is 5c:d1:a6:22:9c:d8:20:fb:6b:4c:e4:af:76:00:9e:d2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.10' (RSA) to the list of known hosts.
root@192.168.10.10's password:
nero.tar.gz                                   100%   21     0.0KB/s   00:00   
nero.md5                                      100%   46     0.0KB/s   00:00   
[root@centos ~]#

[root@fedora ~]# ls
Desktop          bbb.lst    install.log         nero.md5     scsrun.log
anaconda-ks.cfg  ftp.sniff  install.log.syslog  nero.tar.gz
[root@fedora ~]#
[root@fedora ~]# cat nero.md5
3b0332e02daabf31651a5a0d81ba830a  nero.tar.gz
[root@fedora ~]# md5sum nero.tar.gz
3b0332e02daabf31651a5a0d81ba830a  nero.tar.gz
두 값이 같다 고로 변조 x

[root@fedora ~]# echo "11" >> nero.tar.gz
[root@fedora ~]# md5sum nero.tar.gz
8ce7e6758e82461bb878b63ca917a3fa  nero.tar.gz
[root@fedora ~]# cat nero.md5
3b0332e02daabf31651a5a0d81ba830a  nero.tar.gz
두 값이 다르다 고로 변조!!!