Skip to main content
← SproulTech

How much crypto is in a typical TypeScript codebase?

We only have one sample, our own site's src folder. A Cupel scan on 2026-12-02 found 137 crypto call sites in 17 of 874 files: 54 hash, 50 public-key, 15 symmetric, 17 key-derivation and 1 unclassified. Only 18 are in non-test source. That is n=1, not an average.

By Nate Sproul, software engineer · Updated December 2, 2026

What is this data, and what is it not?

This is one scan of one codebase: the src folder of sproultech.com, run with Cupel on 2026-12-02. It is our own site, so it is a sample of one. We have no other codebase's numbers on this page, and we do not claim these figures are typical. Read it as a picture of what an inventory looks like, so you know what to expect when you run the same command on yours.

The command was npx github:1Aa1k/cupel --report src, with --crypto --json for the per-file counts and --check --forbid-rsa for the RSA list.

How many crypto call sites are there?

Measured 2026-12-02 on the site's src folder: 137 crypto call sites across 874 scanned files, and 257 bare mentions, which are algorithm names on lines with no call. Nothing was ignored, skipped or errored. The scan ran before this page was added to the folder. Re-running it afterwards reads 875 files and 280 mentions, because this page's own text names algorithms, and the same 137 call sites.

  • Hash: 54
  • Public-key: 50
  • Key derivation: 17
  • Symmetric: 15
  • Unclassified: 1

Where do the call sites sit?

Only 17 of the 874 files have a call site at all. Counting by kind of file shows how much of a raw total is not production code.

  • Non-test source: 18 call sites in 7 files (8 hash, 5 key-derivation, 4 symmetric, 1 public-key).
  • Test files: 101 call sites in 8 files. One of them is the scanner's own test file, which holds a sample of every kind of call on purpose.
  • Page copy in src/data: 18 call sites in 2 files. These are the code examples written into the guides, such as the jose and jsonwebtoken lines on How to replace RS256 JWTs.
  • Of the 18 non-test call sites, 13 are in the two helper folders, src/lib/hash (8) and src/lib/crypto (5). The other 5 are password-hashing calls in three files: pbkdf2 in src/lib/cabin/password.ts, and scrypt in src/lib/crm/password.ts and src/lib/sales/reps.ts.

Which primitives and algorithms show up most?

Across all 137 call sites, the most common primitives are createHmac (26), createHash (19), generateKeyPair (11), jwt.verify (11), createCipheriv (10) and jwt.sign (8).

The most common algorithms are sha256 (28), then dynamic (22), sha3-256 (12), ed25519 (9), eddsa (9), aes-256-gcm (7) and rs256 (6). dynamic means the scanner could not read the algorithm from the call, for example when it comes from a variable or from the key. In the non-test source, 7 of the 18 call sites read dynamic, so those are the ones to open by hand.

How much of it is RSA?

Running npx github:1Aa1k/cupel --check --forbid-rsa src exits 1 and lists 14 lines. None is in the site's non-test source. Nine are in the scanner's own test file, src/lib/hash/hash-scan.test.ts, which carries RSA samples so the scanner can be tested. Five are in src/data/services-rsa-exit-guides.ts, the guide copy that shows RS256 as the thing to replace.

That is a real result and also a limit of the tool: a match inside a string or a comment counts as a finding. The README says so, and this scan shows it. A clean --forbid-rsa run on production code needs those lines allowed or ignored first, and the scan is line-based, so a pass means no known pattern was found, not proof. See How to find every RSA use in a JS/TS codebase for the full list of limits.

Mentions are separate. Of the 257, 145 are the string rsa, and 184 sit in src/data. A mention is a pointer to read, not a call site.

How does this compare with the case study?

The crypto agility case study counted 41 hashing call sites in 7 categories on the same site, then listed each one and routed it through a named helper. The work took 3 hours 13 minutes of wall-clock time, from the first helper commit (2026-11-30 14:14) to the last live commit (2026-11-30 17:27), by one person with AI coding agents.

The 41 was counted for that migration, when sites still called a hash directly. Today's scan counts the code as it is now, including tests and page copy, and its hash total is 54, of which 8 are in non-test source. They are different counts of different things, so do not subtract one from the other.

The same case study moved the Telnyx Ed25519 webhook check and the AES-256-GCM sealing of calendar tokens behind named-purpose helpers in src/lib/crypto. ChaCha20-Poly1305 is ready in the helper but not active.

What should you take from one sample?

Run the scan on your own repo and split the result the same way: non-test source, tests, and anything that is text about crypto rather than a call. Our raw total was 137, but the part that would have to change in production was 18 call sites in 7 files. Your split will differ, and one site does not tell you how.

Then read the dynamic lines by hand and check the places a source scan cannot see, such as TLS certificates, SSH keys and your JWKS endpoint. The RSA exit plan lists each.

If you want the engineer who wrote this to do the swap in your code, the fix sprint is $2,500 per repo for up to 25 RSA call sites, plus $75 for each site after that. Details on the RSA exit page.

Questions

Is this what a typical TypeScript codebase looks like?
We do not know. It is one codebase, our own site, scanned on 2026-12-02. Use it as an example of how to read a scan, not as an average.
Why are there so many more call sites than in the case study?
They count different things. The case study's 41 was the hashing call sites counted for the migration. The 137 is every crypto call the scanner sees in src today, hash and the other families, including 101 in test files and 18 in page copy.
Does the scan prove there is no RSA in the code?
No. Cupel is line-based pattern matching, not a parser, and it reports dynamic algorithm names without resolving them. A pass means no known pattern was found.

Send a few lines about the codebase and where it hashes, signs or encrypts things. The reply comes from the engineer who would do the work.

nate@sproultech.com