RISC-V Encryption
Encryption concepts implemented at the hardware-software boundary, showing security logic at instruction level detail.
Overview
This project makes encryption tangible by implementing it directly in RISC-V assembly, where every operation is explicit. It is impressive because it exposes how security algorithms really work under the hood, not just through high-level libraries. The result is both educational and practical for understanding low-level systems.
Demo
No live demo available for this project. See the repo for setup and run instructions.
Description
xor_cipher.s). Encrypts plaintext with a 4-byte repeating key (e.g. "SU00"), decrypts into a buffer, then compares and prints plain, cipher, and deciphered strings via ecall. Key derivation: per-byte nibble swap and masking; encryption/decryption is XOR with that key. For RARS or Venus. Demonstrates low-level assembly: data layout, loops, branching, and system calls on RISC-V.Data and main The
.data section holds plaintext, password, cipher and deciphered buffers (.space 128), and string labels for output. main loads base addresses into s0–s3, calls ENCRYPT (plain, password, cipher, key index), then DECRYPT (password, cipher, deciphered), then COMPARE (plain, deciphered).ENCRYPT Loop: load a byte from plain; if null, return. Key index cycles 0–3; each byte uses one password byte. The key byte is transformed (nibble swap, mask 0xEE); the plain byte is XORed with it and stored to cipher. DECRYPT uses the same key derivation and XORs cipher bytes into the deciphered buffer.
COMPARE Byte-by-byte comparison of plain and deciphered. On match to end-of-string, print all three strings (plain label, plaintext, cipher label, ciphertext, deciphered label, deciphered text) via ecall 4 and return; on mismatch, set result and return.
Tech & tools
- RISC-V assembly
- C
- RISC-V toolchain
Highlights
- RISC-V assembly and C for crypto-related code
- Use of RISC-V toolchain (assembler, simulator or hardware)
- Encryption implementation or analysis at low level
More projects
tinyTemp
Custom tiny temperature monitor that evolved from an ATmega328P prototype into a compact ATtiny85 OLED PCB.
WorldWide Rover
Award-winning internet-controlled rover that lets users drive and monitor a physical robot from anywhere in real time.
BareTag Tool Tracker
Smart tool tracking that helps teams instantly find equipment, prevent loss, and stay coordinated in real time.
Buffet
Automated trading system that tests strategies, learns from market behavior, and executes decisions with built-in risk controls.
HeadHunter
AI-powered job search assistant that helps people find better-fit roles faster, with smarter resume matching and cleaner tracking.
Meal Planner
Personal meal planning app that turns “what should I cook?” into a clear weekly routine with pantry awareness and shopping support.
BrickVision
Turns ideas or 3D models into buildable LEGO-style instructions, making custom creations faster and more accessible.
Pong on Assembly
Classic Pong rebuilt from the ground up in hardware and low-level assembly, showing full-stack systems engineering in action.
Custom Single-Cycle 32-Bit Processor
From-scratch 32-bit processor design that brings core computer architecture concepts to life in working hardware.
ThreadLib Disk Scheduler
C++ user-level threading library paired with a concurrent disk scheduler that coordinates requester threads and SSTF service.
Multilateration 3D Positioning
3D location engine that estimates where an object is in space and validates accuracy through realistic simulation.
PUF Tester
Hardware security testing toolkit for measuring unique device fingerprints and reliability under real test conditions.
tinyTemp
Custom tiny temperature monitor that evolved from an ATmega328P prototype into a compact ATtiny85 OLED PCB.
WorldWide Rover
Award-winning internet-controlled rover that lets users drive and monitor a physical robot from anywhere in real time.