// For windows compatibility, we normalize the key in case a
// filepath is passed as key ("path\\to\\file" -> "path/to/file")
data = data.replace("\\", "/")
return tf.compat.as_bytes(data)
class Hasher(object):
Hasher: to initialize a md5 with salt.
After Change
def _to_bytes(data: HashKey) -> bytes:
Converts the key to bytes.
if isinstance(data, bytes):
return data
elif isinstance(data, str):
// For windows compatibility, we normalize the key in case a
// filepath is passed as key ("path\\to\\file" -> "path/to/file")
data = data.replace("\\", "/")