티스토리 뷰

hacking/WEB hacking

cypto 간단 정리

kiwiiiv 2021. 6. 26. 19:45

 

블록 암호

DES(Data Encryption standard)

 - 대칭키 

 - key : 56bit

 - 복호화 가능

 - 평문 8byte 를 한 블록으로 하여 암호화 함.

 - 페이스텔 구조

 - 치환 순열의 과정을 교차하여 반복 적용시켜 암호의 혼돈, 확산 성질을 모두 만족하게 함

 

 

AES

 - key : 128, 192, 256 중 택 1

 - 복호화 가능

 - 평문 16byte를 한 블록으로 하여 암호화 함

 - 마찬가지로 치환, 순열 과정을 여러 라운드에 걸쳐 반복

 

 

해시 알고리즘

임의 크기의 데이터를 고정된 크기의 데이터로 변환함.

 

md5

 - 16byte 해시 값 생성

 - 취약점이 여럿 발견되어 최근에는 사용이 줄어들었음.

 

import hashlib

str="abcd"

enc=hashlib.md5()
enc.update(str.encode())
print(enc.hexdigest())

+평서문을 byte 형태로 인코딩 후 암호화해야 함.

 

 

sha256

 - 32byte 해시 값 생성

 

import hashlib

str="abcd"

result=hashlib.sha256(str.encode())
print(result.hexdigest())

+ 해시 알고리즘은 복호화가 불가능하지만, 한 글자를 암호화한 값만 복호화가 가능하다고 함.. ㄱ-

 

 

MAC(Message Authentication Code)

해시 함수를 응용한 메시지 인증 코드

데이터와 함께 전송하는 추가 정보로 데이터의 무결성을 보장함

 

HMAC

해시 함수를 기반

 

 

 


python에서 주로 사용하는 hashlib 

14.1. hashlib — Secure hashes and message digests — Python 2.7.18 documentation

 

14.1. hashlib — Secure hashes and message digests — Python 2.7.18 documentation

14.1. hashlib — Secure hashes and message digests Source code: Lib/hashlib.py This module implements a common interface to many different secure hash and message digest algorithms. Included are the FIPS secure hash algorithms SHA1, SHA224, SHA256, SHA384

docs.python.org

 

sha256 복호화 사이트

Sha256 Decrypt & Encrypt - More than 15.000.000.000 hashes (md5decrypt.net)

 

Sha256 Decrypt & Encrypt - More than 15.000.000.000 hashes

 

md5decrypt.net

+ 해시 함수는 복호화가 불가능하지만, 데이터베이스를 기반으로 하여 많이 사용되는 문자에 한해 복호화가 가능

'hacking > WEB hacking' 카테고리의 다른 글

baby-sqlite  (0) 2021.06.28
blind-command  (0) 2021.06.28
regex  (0) 2021.03.24
mongoboard(MongoDB)  (0) 2021.03.22
Flask-dev  (0) 2021.02.09
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함