frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Hashing Go Functions Using SSA and Scalar Evolution

https://github.com/BlackVectorOps/semantic_firewall
2•BlackVectorOps•9h ago

Comments

BlackVectorOps•9h ago
Hello HN,

I built this because I've become paranoid about "safe" refactors in the wake of supply chain attacks like the xz backdoor.

We spend a lot of time reviewing code for syntax, but we lack good tools for verifying that a large refactor (e.g., renaming variables, changing loop styles) preserves the exact business logic. Standard SHA256 hashes break if you change a single whitespace or variable name, which makes them useless for verifying semantic equivalence.

I built Semantic Firewall (sfw) to solve this. It is an open-source tool that fingerprints Go code based on its behavior, not its bytes.

How it works:

1. SSA Conversion: It loads the Go source into Static Single Assignment form using golang.org/x/tools/go/ssa.

2. Canonicalization: It renames registers (v0, v1) deterministically and normalizes control flow graphs. This ensures that `if a { x } else { y }` fingerprints the same even if branches are swapped with inverted conditions.

3. Scalar Evolution (SCEV): This was the hardest part. I implemented an SCEV engine that mathematically solves loop trip counts. This means a `for range` loop and a `for i++` loop that iterate N times produce the exact same fingerprint.

Here is a quick example of what it catches:

  // Implementation A
  func wipe(k []byte) {
      for i := range k { k[i] = 0 }
  }

  // Implementation B (Refactor?)
  func wipe(buf []byte) {
      for i := 0; i < len(buf); i++ { buf[i] = 0 }
  }
These two produce identical hashes. If you change the logic (e.g. `i < len(buf)-1`), the hash diverges immediately.

It’s written in Go and available as a CLI or GitHub Action. I’d love to hear your thoughts on the approach or edge cases I might have missed in the normalization phase.

Repo: https://github.com/BlackVectorOps/semantic_firewall

bradleyjkemp•1h ago
I'd like to see some examples of before/after code samples which have the same hash.

I can see this will be tolerant of simple renames, but seems unlikely this hash will survive any real refactor of code

Show HN: Ferrite – Markdown editor in Rust with native Mermaid diagram rendering

https://github.com/OlaProeis/Ferrite
176•OlaProis•10h ago•95 comments

Show HN: I used Claude Code to discover connections between 100 books

https://trails.pieterma.es/
378•pmaze•19h ago•102 comments

Show HN: I built an Open Source screen timer for the m5stickc (Arduino)

https://partridge.works/screenie-christmas-project-2025-26/
7•urbandw311er•4d ago•0 comments

Show HN: Play poker with LLMs, or watch them play against each other

https://llmholdem.com/
124•projectyang•16h ago•58 comments

Show HN: Librario, a book metadata API that aggregates G Books, ISBNDB, and more

110•jamesponddotco•12h ago•38 comments

Show HN: Yellopages – New tab Chrome extension

https://yellopages.kawaicheung.io/
27•kiwigod17•2d ago•5 comments

Show HN: We Identified a Counterfeit Pharmaceutical Product in Uzbekistan

https://yashsm01-glwdj.wordpress.com/2026/01/11/how-i-help-to-fight-counterfeit-pharmaceuticals-w...
2•yashsm01•1h ago•1 comments

Show HN: VAM Seek – 2D video navigation grid, 15KB, zero server load

https://github.com/unhaya/vam-seek
37•haasiy•9h ago•4 comments

Show HN: mcpc – Universal command-line client for Model Context Protocol (MCP)

https://github.com/apify/mcp-cli
41•jancurn•4d ago•3 comments

Show HN: GlyphLang – An AI-first programming language

26•goose0004•12h ago•17 comments

Show HN: Show HN submissions have tripled since 2023

https://imgur.com/a/K0A1yc1
9•anythingworks•3h ago•3 comments

Show HN: Marten – Elegant Go web framework (nothing in the way)

https://github.com/gomarten/marten
14•jackprescott•15h ago•5 comments

Show HN: Umaro – An interactive music theory suite for guitarists

https://www.umaro.app/
9•SnowingXIV•8h ago•2 comments

Show HN: I built an Instagram-style productivity app with gamification

https://apps.apple.com/us/app/lockin-social-productivity/id6742454713
4•mandynoee•6h ago•1 comments

Show HN: I made a memory game to teach you to play piano by ear

https://lend-me-your-ears.specr.net
535•vunderba•1d ago•167 comments

Show HN: WinBorg, a beautiful alternative to Vorta for BorgBackup

https://github.com/robotnikz/WinBorg
2•robotnikz•6h ago•0 comments

Show HN: Various shape regularization algorithms

https://github.com/nickponline/shreg
74•nickponline•2d ago•5 comments

Show HN: Executable Markdown files with Unix pipes

120•jedwhite•2d ago•98 comments

Show HN: EuConform – Offline-first EU AI Act compliance tool (open source)

https://github.com/Hiepler/EuConform
71•hiepler•1d ago•45 comments

Show HN: Rocket Launch and Orbit Simulator

https://www.donutthejedi.com/
160•donutthejedi•1d ago•37 comments

Show HN: A website that auctions itself daily

https://www.thedailyauction.com/
41•nsomani•2d ago•18 comments

Show HN: Hashing Go Functions Using SSA and Scalar Evolution

https://github.com/BlackVectorOps/semantic_firewall
2•BlackVectorOps•9h ago•2 comments

Show HN: Scroll Wikipedia like TikTok

https://quack.sdan.io
321•sdan•1d ago•85 comments

Show HN: HAPI - Vibe Coding Anytime, Anywhere

https://github.com/tiann/hapi
3•weishu•10h ago•0 comments

Show HN: Yuanzai World – LLM RPGs with branching world-lines

https://www.yuanzai.world/
30•yuanzaiworld•23h ago•5 comments

Show HN: macOS menu bar app to track Claude usage in real time

https://github.com/richhickson/claudecodeusage
158•RichHickson•2d ago•48 comments

Show HN: Miditui – A terminal app/UI for MIDI composing, mixing, and playback

https://github.com/minimaxir/miditui
64•minimaxir•2d ago•13 comments

Show HN: Similarity = cosine(your_GitHub_stars, Karpathy) Client-side

https://puzer.github.io/github_recommender/
168•puzer•4d ago•39 comments

Show HN: Symfreq – Analyse symbol frequencies in code (Rust)

https://github.com/vaskort/symfreq
2•vaskort•13h ago•0 comments

Show HN: MCP Server for Job Search

https://github.com/jobswithgpt/mcp
5•sp1982•13h ago•0 comments