2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

python3でtimestampをhash化した日

Last updated at Posted at 2019-07-09

#Timestampをsha256でhash化

###まず下準備

from datetime import datetime,date
import time
import hashlib

###encodeできるように型を変える&&取り出したい形に整える。

t_today = datetime.now()
s_today = t_today.strftime('%Y/%m/%d %H:%M*%S')

###sha256でhash化

crypto = hashlib.sha256(s_today.encode('utf-8')).hexdigest()

###SUCCESS !


###参考
https://docs.python.org/ja/3.8/library/datetime.html
https://pg-chain.com/python-hash-hashlib
https://note.nkmk.me/python-datetime-usage/

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?