RISC-V Encryption
Low-level encryption on RISC-V: assembly and C implementations for algorithms and analysis on a RISC-V toolchain.
View on GitHub →Overview
XOR-based cipher in a single RISC-V assembly file (xor_cipher.s). Encrypts plaintext with a 4-byte repeating key (password "SU00"), decrypts to a buffer, then compares and prints all three strings via ecall. Intended for RARS or Venus.
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.
Demo
No live demo available for this project. See the repo for setup and run instructions.
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
WorldWide Rover
HackUMass XII — Best Embedded System. Autonomous, globally accessible rover: web interface for real-time control, maze navigation, obstacle avoidance. Python/Flask backend, Raspberry Pi, Arduino, React, ngrok.
Buffet
Trading AI: paper and live trading on Alpaca, strategy optimization, signal processing, and Qiskit-based quantum optimization. Python, TensorFlow, Alpaca API.
Pong on Assembly
Interactive Pong on FPGA (Duke ECE 550). Hardware VGA/PS2 implementation plus full assembly version (pong.s) for custom 32-bit processor ISA.
Custom Single-Cycle 32-Bit Processor
Custom ISA and single-cycle datapath in Verilog; synthesis-ready design used as the execution target for Pong assembly (Pong-on-Assembly repo).
Baretag iOS App
iOS app (Swift) for real-time device tracking and management; Flask/Ngrok backend and 3D localization validated in Blender.
Multilateration 3D Positioning
3D multilateration and localization algorithms with Python implementation and Blender-based simulation; feeds into Baretag device positioning.
PUF Tester
Hardware tooling for testing and characterizing Physically Unclonable Functions (PUFs); supports security and fingerprinting use cases.
tinyTemp
Temperature display on ATtiny85: reads sensor via ADC and shows °F and °C on SSD1306 OLED (ECE 304, Spring 2024).
WorldWide Rover
HackUMass XII — Best Embedded System. Autonomous, globally accessible rover: web interface for real-time control, maze navigation, obstacle avoidance. Python/Flask backend, Raspberry Pi, Arduino, React, ngrok.
Buffet
Trading AI: paper and live trading on Alpaca, strategy optimization, signal processing, and Qiskit-based quantum optimization. Python, TensorFlow, Alpaca API.