def _hash(data, algorithm):
if algorithm == '<STR_LIT>':<EOL><INDENT>return sha256(data).hexdigest()<EOL><DEDENT>elif algorithm == '<STR_LIT>':<EOL><INDENT>return sha512(data).hexdigest()<EOL><DEDENT>else:<EOL><INDENT>return md5(data).hexdigest()<EOL><DEDENT>
Encode binary data according to specified algorithm, use MD5 by default