Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
YouTube Security VideosMeet “Cristina,” the Simulator | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Alex", The Optimizer | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Cleo", The Predictive Fixer | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Carlos", The Decision Driver | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet “James,” the Northstar | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosAtlassian: The fastest way forward is knowing where you’ve been.(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMicrosoft Copilot: Meet Home in Copilot(01.10.2026 um 03:04 Uhr)
•
Videos & KonferenzenAuree Joins MariaDB Foundation as Sponsor(01.10.2026 um 05:32 Uhr)
•
KI & AI VideosJulian Goldie SEO: New Claude Code Update is ABSURD!(01.10.2026 um 04:00 Uhr)
•
KI & AI VideosJulian Goldie SEO: Gemini 4 Argon: Google's New AI Model(01.10.2026 um 04:46 Uhr)
•
YouTube Security VideosMeet “Cristina,” the Simulator | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Alex", The Optimizer | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Cleo", The Predictive Fixer | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet "Carlos", The Decision Driver | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMeet “James,” the Northstar | The Atlassian Williams F1 Team Pack(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosAtlassian: The fastest way forward is knowing where you’ve been.(01.10.2026 um 06:00 Uhr)
•
YouTube Security VideosMicrosoft Copilot: Meet Home in Copilot(01.10.2026 um 03:04 Uhr)
•
Videos & KonferenzenAuree Joins MariaDB Foundation as Sponsor(01.10.2026 um 05:32 Uhr)
•
KI & AI VideosJulian Goldie SEO: New Claude Code Update is ABSURD!(01.10.2026 um 04:00 Uhr)
•
KI & AI VideosJulian Goldie SEO: Gemini 4 Argon: Google's New AI Model(01.10.2026 um 04:46 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

Keccak256 From Scratch in 200 Lines of Kotlin (Because Web3j Was 8 MB)

Web3j is 8 MB. My APK is 4.5 MB. So I wrote the Ethereum hash function from scratch. Why Not Just Import Web3j? I was building a native Ethereum wallet inside…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

Web3j is 8 MB. My APK is 4.5 MB. So I wrote the Ethereum hash function from scratch.









Why Not Just Import Web3j?



I was building a native Ethereum wallet inside an Android Capacitor app. The goal: sign transactions without MetaMask, without WalletConnect, without any external app.



Web3j handles everything — key generation, signing, ABI encoding, RLP. But it pulls in 8+ MB of dependencies. My entire APK is 4.5 MB.



So I implemented Keccak256 directly. 200 lines of Kotlin. Zero dependencies beyond what Android already ships.









What Is Keccak256?



Ethereum uses Keccak-256, a variant of SHA-3. It's a sponge construction — data is absorbed in 136-byte blocks, then squeezed out as a 32-byte hash.



The core is Keccak-f[1600]: 24 rounds of five transformation steps on a 5×5 matrix of 64-bit words.









The Round Constants



Each round XORs a different constant into the first lane. These overflow Long.MAX_VALUE in Kotlin, so they must be expressed as signed two's complement:




private val RC = longArrayOf(
0x0000000000000001L,
0x0000000000008082L,
-0x7fffffff7fff7f76L, // 0x800000000000808A
-0x7fffffff80008000L, // 0x8000000080008000
// ... 20 more
)












The Five Steps



Theta: XOR parity into each lane.

Rho+Pi: Rotate and permute in one pass.

Chi: Non-linear row mixing.

Iota: XOR round constant.



All implemented with primitive LongArray operations — no objects, no allocations inside the round loop.









Results




























Approach Size Impact Dependencies
Web3j +8 MB Full Web3j stack
ethers.js via WebView +800 KB JS bridge
Pure Kotlin +18 KB Zero


The entire crypto layer — Keccak256, RLP encoder, ECDSA wrapper — fits in under 50 KB. No Gradle dependency beyond BouncyCastle, which Android ships natively.






Sometimes the best library is the one you don't import.



📂 Source: AtlasNexusTech/ai2work-android

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Keccak256 From Scratch in 200 Lines of Kotlin (Because Web3j Was 8 MB)

Thematisch verwandte Begriffe: Keccak256, From, Scratch, Lines · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag