Compare commits

...

3 Commits

3 changed files with 112 additions and 93 deletions

167
README.md
View File

@@ -1,55 +1,5 @@
# OTP Cipher - One Time Pad Implementation # OTP Cipher - One Time Pad Implementation
## Quick Start
### Download Pre-Built Binaries
**Latest Release:** [View all releases on Gitea](https://git.laantungir.net/laantungir/otp/releases)
**For x86_64 Linux:**
```bash
# Download latest x86_64 binary (replace VERSION with latest from releases page)
wget https://git.laantungir.net/laantungir/otp/releases/latest/download/otp-latest-linux-x86_64
chmod +x otp-latest-linux-x86_64
./otp-latest-linux-x86_64
```
**For ARM64/AArch64 (Raspberry Pi, etc.):**
```bash
# Download latest ARM64 binary
wget https://git.laantungir.net/laantungir/otp/releases/latest/download/otp-latest-linux-arm64
chmod +x otp-latest-linux-arm64
./otp-latest-linux-arm64
```
> **Note:** If the `/latest/download/` URLs don't work with your Gitea version, visit the [releases page](https://git.laantungir.net/laantungir/otp/releases) and download the latest version manually.
**Or use the local build:**
```bash
# After building from source
./build/otp-x86_64 # x86_64 systems
./build/otp-arm64 # ARM64 systems
```
### First Steps
1. **Generate your first pad:**
```bash
./build/otp-x86_64 generate 1GB
```
2. **Encrypt a message:**
```bash
./build/otp-x86_64 encrypt
# Follow the interactive prompts
```
3. **Decrypt a message:**
```bash
./build/otp-x86_64 decrypt
# Paste the encrypted message
```
## Introduction ## Introduction
A secure one-time pad (OTP) cipher implementation in C. A secure one-time pad (OTP) cipher implementation in C.
@@ -90,8 +40,6 @@ To address this problem, we can use Nostr to share among devices the place in th
One-time pads can be trivially encrypted and decrypted using pencil and paper, making them accessible even without electronic devices. One-time pads can be trivially encrypted and decrypted using pencil and paper, making them accessible even without electronic devices.
## Features ## Features
- **Perfect Security**: Implements true one-time pad encryption with information-theoretic security - **Perfect Security**: Implements true one-time pad encryption with information-theoretic security
@@ -106,73 +54,108 @@ One-time pads can be trivially encrypted and decrypted using pencil and paper, m
- **Cross-Platform**: Works on Linux and other UNIX-like systems - **Cross-Platform**: Works on Linux and other UNIX-like systems
## Building ## Quick Start
### Download Pre-Built Binaries
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.32/otp-v0.3.32-linux-x86_64)**
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.32/otp-v0.3.32-linux-arm64)**
After downloading:
```bash
# Make executable and rename for convenience
chmod +x otp-v0.3.32-linux-x86_64
mv otp-v0.3.32-linux-x86_64 otp
# Run it
./otp
```
### First Steps
1. **Generate your first pad:**
```bash
./otp generate 1GB
```
2. **Encrypt a message:**
```bash
./otp encrypt
# Follow the interactive prompts
```
3. **Decrypt a message:**
```bash
./otp decrypt
# Paste the encrypted message
```
## Building from Source
### Prerequisites ### Prerequisites
- GCC compiler - GCC compiler
- Git (for version tracking)
- Make - Make
- Optional: ARM64 cross-compiler (`gcc-aarch64-linux-gnu`) for cross-compilation
### Build Commands ### Build Commands
Use the included build script for automatic versioning and cross-compilation:
```bash
# Build for current architecture (with auto-versioning)
./build.sh "commit message"
# Build commands
./build.sh build "commit message" # Build x86_64 and ARM64 (if cross-compiler available)
./build.sh clean # Clean build artifacts
./build.sh install # Install to system
./build.sh uninstall # Remove from system
```
The build script automatically:
- Increments patch version (v0.3.24 → v0.3.25)
- Creates git commit and tag
- Builds for x86_64 and ARM64 (if cross-compiler available)
- Outputs to `build/otp-x86_64` and `build/otp-arm64`
- Uploads binaries to Gitea releases (if `~/.gitea_token` exists)
### Traditional Make
You can also use make directly (without automatic versioning):
```bash ```bash
make # Build for current architecture make # Build for current architecture
make static # Static linking make static # Static linking (standalone binary)
make clean # Clean artifacts make clean # Clean build artifacts
make install # Install to /usr/local/bin/otp make install # Install to /usr/local/bin/otp
make uninstall # Remove from system make uninstall # Remove from system
``` ```
Output: `build/otp-$(ARCH)` (e.g., `build/otp-x86_64`) Output: `build/otp-$(ARCH)` (e.g., `build/otp-x86_64`)
## Usage After building, run with:
### Interactive Mode
```bash ```bash
./build/otp-x86_64 ./build/otp-x86_64
# or
./build/otp-arm64 # On ARM systems
``` ```
## Usage
The OTP Cipher operates in two modes:
**Interactive Mode**: Run without arguments to access a menu-driven interface. Best for exploring features, managing pads, and performing operations step-by-step with prompts and guidance.
**Command Line Mode**: Provide arguments to execute specific operations directly. Ideal for scripting, automation, and quick one-off tasks.
### Interactive Mode
Launch the menu-driven interface:
```bash
./otp
```
Navigate through menus to generate pads, encrypt/decrypt messages, manage pads, and configure settings.
### Command Line Mode ### Command Line Mode
Execute operations directly with arguments:
```bash ```bash
# Generate a new pad # Generate a new pad
./build/otp-x86_64 generate 1GB ./otp generate 1GB
# Encrypt text (interactive input) # Encrypt text (will prompt for input)
./build/otp-x86_64 encrypt <pad_hash_or_prefix> ./otp encrypt <pad_hash_or_prefix>
# Decrypt message (interactive input) # Decrypt message (will prompt for input)
./build/otp-x86_64 decrypt <pad_hash_or_prefix> ./otp decrypt <pad_hash_or_prefix>
# List available pads # List available pads
./build/otp-x86_64 list ./otp list
``` ```
## Version System ## Version System

View File

@@ -155,6 +155,42 @@ update_source_version() {
else else
print_warning "src/main.h not found - skipping version update" print_warning "src/main.h not found - skipping version update"
fi fi
# Update README.md with direct download links
if [ -f "README.md" ]; then
print_status "Updating README.md with download links for $NEW_VERSION..."
# Create the new download section with direct download links
local NEW_DOWNLOAD_SECTION="### Download Pre-Built Binaries
**[Download Current Linux x86](https://git.laantungir.net/laantungir/otp/releases/download/${NEW_VERSION}/otp-${NEW_VERSION}-linux-x86_64)**
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/${NEW_VERSION}/otp-${NEW_VERSION}-linux-arm64)**
After downloading:
\`\`\`bash
# Make executable and run
chmod +x otp-${NEW_VERSION}-linux-x86_64
./otp-${NEW_VERSION}-linux-x86_64
\`\`\`"
# Use awk to replace the section between "### Download Pre-Built Binaries" and "### First Steps"
awk -v new_section="$NEW_DOWNLOAD_SECTION" '
/^### Download Pre-Built Binaries/ {
print new_section
skip=1
next
}
/^### First Steps/ {
skip=0
}
!skip
' README.md > README.md.tmp && mv README.md.tmp README.md
print_success "Updated README.md with download links for $NEW_VERSION"
else
print_warning "README.md not found - skipping README update"
fi
} }
# Cross-platform build functions # Cross-platform build functions

View File

@@ -23,7 +23,7 @@
#include <ctype.h> #include <ctype.h>
// Version - Updated automatically by build.sh // Version - Updated automatically by build.sh
#define OTP_VERSION "v0.3.29" #define OTP_VERSION "v0.3.32"
// Constants // Constants
#define MAX_INPUT_SIZE 4096 #define MAX_INPUT_SIZE 4096