파이썬[Python]: hashlib - hexdigest 메서드

hashlib 모듈 - hexdigest 메서드(method)


/// 설명

update() 메서드에 의해 전달된 데이터의 결과(다이제스트 16진수 값)를 반환합니다.

※ 형식
shake.hexdigest(length)

/// 예제

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import hashlib
 
test_hash = hashlib.new('shake_256')
test_hash.update(b'This is a string')
 
print(test_hash.hexdigest(20))  # b3ce77bb4c14ffa462ff4471d7bb0cd604be0270
print(test_hash.digest_size)  # 0
print(test_hash.block_size)  # 136
 
# The NIST standard
# Output size d = digest_size
# b = state_size = 1600 bit = 200 bytes
# Rate r = block_size = 1088 bit = 136 bytes
# Capacity c = b - r = 512 bit = 64 bytes
#
# Security strengths in bits = the number of operations
# Collision ->        min(d/2, 256)
# Preimage ->       >=min(d, 256)
# 2nd Preimage ->     min(d, 256)
 
cs

* 실행환경: Microsoft Windows 10 Homes
* 인터프리터: 파이썬(Python 3.9)


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

파이썬[Python]: 내장함수 - from_bytes 메서드

파이썬[Python]: 내장함수 - __len__ 메서드

파이썬[Python]: kivy - 한글 사용

파이썬[Python]: 내장함수 - bit_length 메서드

C 언어: sin 함수, cos 함수, tan 함수