'''md5の使い方'''
m = md5.new('pass-word')
print (m) #
print (m.hexdigest()) #ed0eacb4e34e50c1c53f9698600d4b86
import urllib
'''多分クオートしないとエラーになる...'''
try:
print m.digest()
except UnicodeDecodeError:
print u'UnicodeDecodeErrorなのだ'
'''URLのパラメータとして使用する場合はクオートする必要がある'''
quoted =''.join([urllib.quote_plus(x) for x in m.digest()])
print quoted #%ED%0E%AC%B4%E3NP%C1%C5%3F%96%98%60%0DK%86
'''shaの使い方'''
m = sha.new('pass-word')
print (m) #
print (m.hexdigest()) #ed0eacb4e34e50c1c53f9698600d4b86
import urllib
'''多分クオートしないとエラーになる...'''
try:
print m.digest()
except UnicodeDecodeError:
print u'UnicodeDecodeErrorなのだ'
'''URLのパラメータとして使用する場合はクオートする必要がある'''
quoted =''.join([urllib.quote_plus(x) for x in m.digest()])
print quoted #%ED%0E%AC%B4%E3NP%C1%C5%3F%96%98%60%0DK%86
0 件のコメント:
コメントを投稿