How to use the pyocr.builders.Box function in pyocr

To help you get started, we’ve selected a few pyocr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openpaperwork / paperwork / paperwork-backend / scripts / obfuscate.py View on Github external
content_hash = hashlib.sha512()
    content_hash.update(salt)
    content_hash.update(content.encode("utf-8"))

    dst_content = u""
    sha = content_hash.digest()
    for char_pos in range(0, len(src_content)):
        if not src_content[char_pos] in mapping:
            dst_content += char
        char = ord(sha[char_pos])
        char_idx = char % len(mapping)
        dst_content += mapping.values()[char_idx]

    dst_content = dst_content[:len(src_content)]

    return Box(dst_content, src_box.position)
github openpaperwork / paperwork / scripts / obfuscate.py View on Github external
content_hash = hashlib.sha512()
    content_hash.update(salt)
    content_hash.update(content.encode("utf-8"))

    dst_content = u""
    sha = content_hash.digest()
    for char_pos in xrange(0, len(src_content)):
        if not src_content[char_pos] in mapping:
            dst_content += char
        char = ord(sha[char_pos])
        char_idx = char % len(mapping)
        dst_content += mapping.values()[char_idx]

    dst_content = dst_content[:len(src_content)]

    return Box(dst_content, src_box.position)