Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 안드로이드
- Kotlin
- LifeCycle
- android
- appbar
- tabbar
- livedata
- scroll
- Coroutines
- Dialog
- 계측
- Button
- activity
- drift
- CustomScrollView
- binding
- data
- intent
- 앱바
- textfield
- 앱
- Compose
- Navigation
- 테스트
- ScrollView
- viewmodel
- DART
- Flutter
- TEST
- textview
Archives
- Today
- Total
Study Record
[암호 프로그래밍] 해시 함수 사용하기 본문
728x90
from Crypto.Hash import SHA256 as SHA
# 입력값이 없는 경우에도 default 값이 있다!
hash = SHA.new()
print(hash.hexdigest())
# 해시함수 사용법1
hash2 = SHA.new()
hash2.update(b'Hello')
print(hash2.hexdigest())
# 해시함수 사용법2
hash3 = SHA.new(b'Hello')
print(hash3.hexdigest())
# 해시함수 b'First', b'Second' 나중에 연결
hash4 = SHA.new()
hash4.update(b'First')
hash4.update(b'Second')
print('Second :', hash4.hexdigest())
# 해시 객체를 만들고, b'FirstSecond' 업데이트
hash5 = SHA.new(b'FirstSecond')
print('1st2nd :', hash5.hexdigest())
# hash4 와 hash5 는 같다.
728x90
'암호 > 프로그래밍' 카테고리의 다른 글
[암호 프로그래밍] HMAC , CMAC 프로그램 (0) | 2021.12.13 |
---|---|
[암호 프로그래밍] 하이브리드 암호 프로그램 (0) | 2021.12.10 |
[암호 프로그래밍] 해시 함수 관련 프로그램 (0) | 2021.12.09 |
[암호 프로그래밍] RSA를 이용한 암/복호화 , 서명 (0) | 2021.12.08 |
[암호 프로그래밍] 인코딩/디코딩 프로그램 (0) | 2021.12.07 |