Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)