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

hashlib 모듈 - update 메서드(method)


/// 설명

해시 알고리즘에 적용할 바이트 객체를 업데이트 합니다.
hash.update(b'First string, ')
hash.update(b'Second string')
= hash.update(b'First string, Second string')

※ 형식
hash.update(data)

/// 예제

1
2
3
4
5
6
7
8
9
10
11
import hashlib
 
test_hash = hashlib.new('sha1')
test_hash.update(b'First string, ')
test_hash.update(b'Second string')
print(test_hash.digest())  # b'\xbc\x0b\xaeU\xb8w\x0e>\xedU\xfa\xdf\n\xa5K\xae2\xf6\xd2\xfe'
 
test_hash = hashlib.new('sha1')
test_hash.update(b'First string, Second string')
print(test_hash.digest())  # b'\xbc\x0b\xaeU\xb8w\x0e>\xedU\xfa\xdf\n\xa5K\xae2\xf6\xd2\xfe'
 
cs

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


– 당신을 응원합니다. –

댓글

이 블로그의 인기 게시물

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

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

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

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

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