Repository Analysis

RsaCtfTool/RsaCtfTool

RSA attack tool (mainly for ctf) - retrieve private key from weak public key and/or uncipher data

19.2 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of RsaCtfTool/RsaCtfTool, a Python project with 7,062 GitHub stars. SynthScan v2.0 examined 12,263 lines of code across 116 source files, recording 175 pattern matches distributed across 11 syntactic categories. The overall adjusted score of 19.2 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

19.2
Adjusted Score
19.2
Raw Score
100%
Time Factor
2026-08-12
Last Push
7.1K
Stars
Python
Language
12.3K
Lines of Code
116
Files
175
Pattern Hits
2026-08-13
Scan Date
0.07
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

Longitudinal tracking requires multiple scan runs. Once this repository is re-scanned after new commits land, this chart will visualise how the synthetic code signal evolves over time — enabling you to detect whether AI authorship is growing, stabilising, or being actively corrected by human engineers.

No multi-scan history yet — run the scanner again to build trend data.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 0HIGH 8MEDIUM 9LOW 158

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 175 distinct pattern matches across 11 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers85 hits · 92 pts
SeverityFileLineSnippetContext
LOWtests/test_number_theory.py81 def test_isqrt_perfect_squares(self):CODE
LOWtests/test_number_theory.py149 def test_next_prime_consecutive(self):CODE
LOWtests/test_number_theory.py164 def test_powmod_large_exponent(self):CODE
LOWtests/test_number_theory.py256 def test_chinese_remainder_basic(self):CODE
LOWtests/test_number_theory.py260 def test_chinese_remainder_same_modulus(self):CODE
LOWtests/test_number_theory.py278 def test_contfrac_to_rational_basic(self):CODE
LOWtests/test_number_theory.py282 def test_contfrac_to_rational_empty(self):CODE
LOWtests/test_number_theory.py306 def test_legendre_quadratic_residue(self):CODE
LOWtests/test_number_theory.py311 def test_legendre_quadratic_non_residue(self):CODE
LOWtests/test_number_theory.py447 def test_common_modulus_attack(self):CODE
LOWtests/test_number_theory.py528 def test_isqrt_rem_perfect_square(self):CODE
LOWtests/test_number_theory.py533 def test_isqrt_rem_non_perfect(self):CODE
LOWtests/test_number_theory.py561 def test_miller_rabin_composite(self):CODE
LOWtests/test_exceptions.py9 def test_factorization_error_can_be_raised(self):CODE
LOWtests/test_exceptions.py13 def test_factorization_error_message(self):CODE
LOWtests/test_exceptions.py20 def test_factorization_error_inheritance(self):CODE
LOWtests/test_pubkey_decode.py7 def test_weak_public_key_decodes_correctly(self, weak_public_key_path):CODE
LOWtests/test_pubkey_decode.py16 def test_pubkey_n_is_product_of_primes(self, weak_public_key_path):CODE
LOWtests/test_keys_wrapper.py23 def test_public_key_attributes(self, weak_public_key_path):CODE
LOWtests/test_keys_wrapper.py32 def test_public_key_invalid_format(self):CODE
LOWtests/test_keys_wrapper.py36 def test_public_key_str_representation(self, weak_public_key_path):CODE
LOWtests/test_keys_wrapper.py46 def test_private_key_from_p_q_e(self):CODE
LOWtests/test_keys_wrapper.py58 def test_private_key_str_returns_str(self):CODE
LOWtests/test_keys_wrapper.py67 def test_private_key_str_nonempty_for_valid_key(self):CODE
LOWtests/test_keys_wrapper.py76 def test_private_key_n_eq_p_squared(self):CODE
LOWtests/test_keys_wrapper.py86 def test_private_key_from_n_e_d(self):CODE
LOWtests/test_keys_wrapper.py98 def test_private_key_d_computed_from_p_q_e(self):CODE
LOWtests/test_keys_wrapper.py109 def test_generate_pq_from_n_and_q(self):CODE
LOWtests/test_keys_wrapper.py117 def test_generate_pq_from_n_and_p(self):CODE
LOWtests/test_keys_wrapper.py137 def test_generate_keys_pem_format(self):CODE
LOWtests/test_keys_wrapper.py161 def test_decrypt_non_list_input(self):CODE
LOWtests/test_algos.py138 def test_lehman_invalid_congruence(self):CODE
LOWtests/test_algos.py147 def test_strong_pseudoprime_basic(self):CODE
LOWtests/test_algos.py155 def test_strong_pseudoprime_returns_empty(self):CODE
LOWtests/test_algos.py159 def test_strong_pseudoprime_carmichael_example(self):CODE
LOWtests/test_algos.py505 def test_collect_relations_early_split(self):CODE
LOWtests/test_algos.py512 def test_gaussian_elim_underdetermined(self):CODE
LOWtests/test_algos.py518 def test_gaussian_elim_zero_column(self):CODE
LOWtests/test_algos.py527 def test_prime_base_collision_large(self):CODE
LOWtests/test_algos.py60 def test_fermat_invalid_congruence(self):CODE
LOWtests/test_algos.py69 def test_brent_small_composite(self):CODE
LOWtests/test_algos.py180 def test_squfof_invalid_congruence(self):CODE
LOWtests/test_algos.py201 def test_lehmer_machine_invalid_congruence(self):CODE
LOWtests/test_algos.py249 def test_pollard_strassen_basic(self):CODE
LOWtests/test_algos.py295 def test_factor_high_low_bits_equal_invalid_n(self):CODE
LOWtests/test_algos.py304 def test_fib_get_period_bigint(self):CODE
LOWtests/test_algos.py321 def test_full_rank_elimination(self):CODE
LOWtests/test_algos.py354 def test_dixon_small_semiprime(self):CODE
LOWtests/test_algos.py362 def test_dixon_medium_semiprime(self):CODE
LOWtests/test_algos.py390 def test_prime_base_collision_small(self):CODE
LOWtests/test_algos.py397 def test_prime_base_collision_larger(self):CODE
LOWtests/test_algos.py415 def test_factor_base_includes_divisor_primes(self):CODE
LOWtests/test_algos.py425 def test_sieve_returns_relations(self):CODE
LOWtests/test_algos.py469 def test_qs_larger_prime_fails(self):CODE
LOWtests/test_algos.py482 def test_qs_factor_base_divisor_primes(self):CODE
LOWtests/test_algos.py486 def test_qs_tiny_params_returns_none(self):CODE
LOWtests/test_attacks.py22 def test_factordb_attack_succeeds(self):CODE
LOWtests/test_attacks.py51 def test_noveltyprimes_attack(self):CODE
LOWtests/test_attacks.py63 def test_smallq_attack_with_decrypt(self):CODE
LOWtests/test_attacks.py105 def test_commonfactors_attack(self):CODE
25 more matches not shown…
Cross-File Repetition8 hits · 40 pts
SeverityFileLineSnippetContext
HIGH…/RsaCtfTool/attacks/single_key/prime_base_collision.py0-----begin public key----- mcawdqyjkozihvcnaqebbqaddwawdaifaqawajccaweaaq== -----end public key-----STRING
HIGHsrc/RsaCtfTool/attacks/single_key/quadratic_sieve.py0-----begin public key----- mcawdqyjkozihvcnaqebbqaddwawdaifaqawajccaweaaq== -----end public key-----STRING
HIGHsrc/RsaCtfTool/attacks/single_key/dixon.py0-----begin public key----- mcawdqyjkozihvcnaqebbqaddwawdaifaqawajccaweaaq== -----end public key-----STRING
HIGH…Tool/attacks/single_key/multiple_base_inversion_gcd.py0-----begin public key----- migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcg6zybpnfefpkadglb1idarrl3 gk+vs1csgk1cy3kspypfydlvv7akSTRING
HIGHsrc/RsaCtfTool/attacks/single_key/fermat.py0-----begin public key----- migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcg6zybpnfefpkadglb1idarrl3 gk+vs1csgk1cy3kspypfydlvv7akSTRING
HIGHsrc/RsaCtfTool/attacks/single_key/kraitchik.py0-----begin public key----- migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcg6zybpnfefpkadglb1idarrl3 gk+vs1csgk1cy3kspypfydlvv7akSTRING
HIGHsrc/RsaCtfTool/attacks/single_key/lehmer.py0-----begin public key----- migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcg6zybpnfefpkadglb1idarrl3 gk+vs1csgk1cy3kspypfydlvv7akSTRING
HIGHsrc/RsaCtfTool/attacks/single_key/lehman.py0-----begin public key----- migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcg6zybpnfefpkadglb1idarrl3 gk+vs1csgk1cy3kspypfydlvv7akSTRING
Excessive Try-Catch Wrapping32 hits · 32 pts
SeverityFileLineSnippetContext
LOWdocs/failure_modes.md69except Exception:CODE
LOWsrc/RsaCtfTool/main.py304 except Exception:STRING
LOWsrc/RsaCtfTool/main.py409 except Exception:STRING
LOWsrc/RsaCtfTool/main.py489 except Exception:STRING
LOWsrc/RsaCtfTool/lib/rsa_attack.py205 except Exception:CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py267 except Exception:CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py285 except Exception as e:CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py355 except Exception as e:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py72 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py142 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py217 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py224 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py256 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py275 except Exception:CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py277 except Exception:CODE
LOWsrc/RsaCtfTool/lib/utils.py35 except Exception:CODE
LOWsrc/RsaCtfTool/lib/utils.py65 except Exception:CODE
LOWsrc/RsaCtfTool/lib/utils.py129 except Exception:CODE
LOWsrc/RsaCtfTool/sage/roca_attack.py97 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/wolframalpha.py23 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/wolframalpha.py56 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/wolframalpha.py90 except Exception as e:CODE
MEDIUMsrc/RsaCtfTool/attacks/single_key/wolframalpha.py18def can_run(self):CODE
LOW…Tool/attacks/single_key/multiple_base_inversion_gcd.py61 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/factordb.py50 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/partial_d.py47 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/factor_2PN.py23 except Exception:CODE
LOW…c/RsaCtfTool/attacks/single_key/highandlowbitsequal.py19 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/SQUFOF.py19 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/z3_solver.py57 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/z3_solver.py69 except Exception:CODE
LOWsrc/RsaCtfTool/attacks/single_key/euler.py33 except Exception:CODE
Deep Nesting31 hits · 31 pts
SeverityFileLineSnippetContext
LOWsrc/RsaCtfTool/main.py270CODE
LOWsrc/RsaCtfTool/main.py286CODE
LOWsrc/RsaCtfTool/main.py403CODE
LOWsrc/RsaCtfTool/main.py529CODE
LOWsrc/RsaCtfTool/lib/algos.py43CODE
LOWsrc/RsaCtfTool/lib/algos.py79CODE
LOWsrc/RsaCtfTool/lib/algos.py141CODE
LOWsrc/RsaCtfTool/lib/algos.py161CODE
LOWsrc/RsaCtfTool/lib/algos.py226CODE
LOWsrc/RsaCtfTool/lib/algos.py317CODE
LOWsrc/RsaCtfTool/lib/algos.py523CODE
LOWsrc/RsaCtfTool/lib/algos.py654CODE
LOWsrc/RsaCtfTool/lib/algos.py821CODE
LOWsrc/RsaCtfTool/lib/algos.py925CODE
LOWsrc/RsaCtfTool/lib/algos.py961CODE
LOWsrc/RsaCtfTool/lib/algos.py577CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py58CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py141CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py183CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py192CODE
LOWsrc/RsaCtfTool/lib/rsa_attack.py248CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py19CODE
LOWsrc/RsaCtfTool/lib/keys_wrapper.py199CODE
LOWsrc/RsaCtfTool/lib/utils.py56CODE
LOWsrc/RsaCtfTool/lib/utils.py112CODE
LOWsrc/RsaCtfTool/sage/roca_attack.py24CODE
LOWsrc/RsaCtfTool/attacks/single_key/wolframalpha.py26CODE
LOW…Tool/attacks/single_key/multiple_base_inversion_gcd.py47CODE
LOWsrc/RsaCtfTool/attacks/single_key/factordb.py21CODE
LOWsrc/RsaCtfTool/attacks/single_key/ecm2.py17CODE
LOWsrc/RsaCtfTool/attacks/single_key/qs.py16CODE
Decorative Section Separators6 hits · 24 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_regression.py18# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_regression.py21# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_regression.py68# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_regression.py70# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_regression.py128# ---------------------------------------------------------------------------COMMENT
MEDIUMtests/test_regression.py130# ---------------------------------------------------------------------------COMMENT
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMsrc/RsaCtfTool/lib/algos.py116 # Create a look-up tableCOMMENT
MEDIUMsrc/RsaCtfTool/sage/roca_attack.py59 # Create the polynom f(x)COMMENT
Over-Commented Block3 hits · 3 pts
SeverityFileLineSnippetContext
LOWdocs/failure_modes.md161### 20. Recursion depth in continued fraction computationCOMMENT
LOWdocs/failure_modes.md181### 30. `PrivateKey._init_fields` truncates arbitrary `d` to `int` via `self.d = d` with no type checkCOMMENT
LOWsrc/RsaCtfTool/attacks/single_key/siqs.py1#!/usr/bin/env python3COMMENT
Redundant / Tautological Comments3 hits · 2 pts
SeverityFileLineSnippetContext
LOWsrc/RsaCtfTool/main.py374 # Check if a private key is provided and there's something to decryptSTRING
LOWsrc/RsaCtfTool/main.py381 # Check if a public key is providedSTRING
LOWsrc/RsaCtfTool/main.py385 # Check if n and e are providedSTRING
Unused Imports2 hits · 2 pts
SeverityFileLineSnippetContext
LOWsrc/RsaCtfTool/lib/algos.py11CODE
LOWsrc/RsaCtfTool/lib/algos.py11CODE
Modern Structural Boilerplate2 hits · 2 pts
SeverityFileLineSnippetContext
LOWsrc/RsaCtfTool/lib/number_theory.py674__all__ = [CODE
LOWsrc/RsaCtfTool/lib/crypto_wrapper.py23__all__ = [RSA, PKCS1_OAEP, number, long_to_bytes, bytes_to_long]CODE
AI Structural Patterns1 hit · 1 pts
SeverityFileLineSnippetContext
LOWsrc/RsaCtfTool/lib/keys_wrapper.py167CODE