hashing_algs.py 文件源码

python
阅读 47 收藏 0 点赞 0 评论 0

项目:Dagon 作者: Ekultek 项目源码 文件源码
def sha384(string, salt=None, front=False, back=False, **placeholder):
    """
      Create an SHA384 hash from a given string

      > :param string:
      > :return:

      Example:
        >>> sha384("test")
        768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf17a0a9
    """
    if type(string) is unicode:
        string = lib.settings.force_encoding(string)
        if type(string) is unicode:
            string = lib.settings.force_encoding(string)
    obj = hashlib.sha384()
    if salt is not None and front and not back:
        obj.update(salt + string)
    elif salt is not None and back and not front:
        obj.update(string + salt)
    else:
        obj.update(string)
    return obj.hexdigest()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号