AI systems produced over 100,000 versions of a data-hashing algorithm
The generated code included many valid variants, but also memory leaks, crashes and versions that failed some tests.
Editorial illustration — not from the study.
The study tested Llama-2-70b-chat-hf, Mistral-7B-Instruct-v0.1 and zephyr-7b-alpha on C code implementing SHA-1. The systems generated 154,433 attempted rewrites; 55,162 could be compiled under all of the tested compiler settings. By combining different rewritten component functions, the researchers identified more than 100,000 distinct versions that produced the expected SHA-1 outputs in their validation checks.
The results also showed how unreliable generated code can be. Some versions were correct for certain test inputs but wrong for others, while others contained memory leaks, integer overflows, out-of-bounds accesses, uninitialized values or behavior that changed with compiler settings. Some incorrect implementations produced outputs with basic features of hash functions without matching SHA-1.
What the AI produced
The researchers prompted the three AI systems to rewrite four C functions used in SHA-1, providing the surrounding source code and header files as context. Of 154,433 attempted function rewrites, 55,162 compiled with all tested compiler settings, meaning more than half did not produce valid C code that met that compilation test.
The researchers assessed compilation, algorithmic correctness, memory leaks, compiler-optimization stability and similarity to the original code. They used compiler settings and checksums of compiled programs to group versions that behaved equivalently even when their source code differed. This produced more than 100,000 distinct SHA-1 codebases in which every component function differed from the original, while still passing the study's input-output validation.
The output was not consistently reliable. Several variants gave the right result for some test vectors but the wrong result for others. Many rewrites contained serious coding problems, including memory leaks, integer overflows, out-of-bounds accesses, uninitialized values and compiler-related instability. Across the tested variants and compiler settings, the researchers recorded 10,685 segmentation faults, 559 abort errors, nine illegal-instruction errors, three floating-point errors and 13 bus errors.
Why the variation matters
The study shows that AI code generators can create a very large number of functionally similar source-code variants, but that apparent correctness is not enough to establish safe software. Code that compiles, or that passes some test inputs, can still fail other tests or contain vulnerabilities.
That combination of flexibility and instability matters especially for security-related code. The authors conclude that these systems are useful for studying and testing source-code variation, but that practical code generation requires thorough validation. They also identify the production of incorrect, hash-like algorithms at scale as an area needing further research, including because such variants could complicate cybersecurity analysis.
Evidence and limits
This was a controlled code-generation study using three open-source AI systems, a modified code-rewriting framework and a C implementation of SHA-1. The researchers evaluated the outputs with compilation tests, input-output checks, binary comparisons and tests for several software defects.
The study examined one relatively short algorithm implementation, rather than a broad range of software or cryptographic algorithms. Passing the reported input-output checks does not by itself establish that a version is secure in every respect, and the researchers did not thoroughly assess the cryptographic security of the implementations that produced hash-like but non-SHA-1 outputs. The large number of distinct versions was also obtained by recombining rewritten component functions, so it should not be read as every version being independently generated as a complete program.
// Source
Frontiers in Computer Science · 2026 · DOI: 10.3389/fcomp.2026.1823339
Researchers developed an AI system that helps humanoid robots learn interactive tasks from reference human movements. In tests involving picking up and pushing boxes, it achieved higher tracking accuracy and task success than recent comparison systems, including on a real Unitree G1 robot.
Researchers developed an AI-based system that converts ordinary-language descriptions of decision problems into mixed-integer linear programming models. In tests on 30 problems, it produced correct models for 29 and correctly generated 176 of 177 mathematical expressions.
Researchers used IBM quantum hardware to recover the best solutions to graph-based optimization problems with up to 117 decision variables. The results suggest favorable scaling compared with the tested classical sampling methods, but the same instances were efficiently solved by a classical optimization program.