"함수 hash hmac()"의 두 판 사이의 차이

17번째 줄: 17번째 줄:
print( base64.b64encode( h ) )
print( base64.b64encode( h ) )
# sGXfsWEMawIp9we7B/iuuA==
# sGXfsWEMawIp9we7B/iuuA==
</source>
<source lang='Python'>
import hmac
import base64
import hashlib
secret = 'secret'
message = 'hello world'
digestmod = hashlib.sha1
h = hmac.new(secret, message, digestmod).digest()
print( base64.b64encode( h ) )
# Azdu5617v87umGYEOaTYsSUSKlo=
</source>
</source>


==같이 보기==
==같이 보기==
*[[HMAC]]
*[[HMAC]]

2016년 3월 3일 (목) 17:15 판

hash_hmac()

1 PHP

echo hash_hmac('ripemd160', 'The quick brown fox jumped over the lazy dog.', 'secret');
// b8e7ae12510bdfb1812e463a7f086122cf37e4f7

2 Python

import hmac
import base64
h = hmac.new('hello world').digest()
print( base64.b64encode( h ) )
# sGXfsWEMawIp9we7B/iuuA==
import hmac
import base64
import hashlib

secret = 'secret'
message = 'hello world'
digestmod = hashlib.sha1

h = hmac.new(secret, message, digestmod).digest()
print( base64.b64encode( h ) )
# Azdu5617v87umGYEOaTYsSUSKlo=

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}