import hashlib


def hash_test_code(main_path):
    """Hashes all lines in file main_path starting from 'int main()\n' until the end.
       The same function was used to hash the original main.c."""
    with open(main_path) as main:
        test_code_hash = hashlib.sha256()
        in_test_code = False
        for line in main:
            if not in_test_code and line == 'int main()\n':
                in_test_code = True
            if in_test_code:
                test_code_hash.update(line.encode())
    return test_code_hash.hexdigest()