开发者

Why does `print hashlib.sha224(some_string).digest()` differs from its `repr()`?

I want to store some hashes of some strings in my Database table. For that I created a column of type varchar(64). I do generate the hashes like this:

>>> thehash = hashlib.sha224(some_string).digest()

Now I realize that

>>> print thehash

is not the same as

>>> thehash

(By now, I know the difference between >>> prin开发者_StackOverflow社区t 'test' and >>> 'test'... :-)) I am confused which part I should store now. The repr() or the other version?


Neither. You should call the .hexdigest() method instead and store that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜