示例#1
0
文件: updater.py 项目: rrosajp/addon
def getSha(path):
    try:
        f = io.open(path, 'rb', encoding="utf8")
    except:
        return ''
    size = len(f.read())
    f.seek(0)
    return githash.blob_hash(f, size).hexdigest()
示例#2
0
文件: updater.py 项目: rrosajp/addon
def getShaStr(str):
    if PY3:
        return githash.blob_hash(BytesIO(str.encode('utf-8')),
                                 len(str.encode('utf-8'))).hexdigest()
    else:
        return githash.blob_hash(BytesIO(str), len(str)).hexdigest()
示例#3
0
def getShaStr(str):
    return githash.blob_hash(StringIO(str), len(str)).hexdigest()
示例#4
0
def getSha(path):
    f = open(path).read()
    return githash.blob_hash(path, len(f)).hexdigest()