Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c229aec88e | |||
| 862465c5c2 |
144
README.md
144
README.md
@@ -1,55 +1,5 @@
|
||||
# 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
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
|
||||
## Features
|
||||
|
||||
- **Perfect Security**: Implements true one-time pad encryption with information-theoretic security
|
||||
@@ -106,73 +54,95 @@ One-time pads can be trivially encrypted and decrypted using pencil and paper, m
|
||||
- **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.31/otp-v0.3.31-linux-x86_64)**
|
||||
|
||||
**[Download Current Raspberry Pi 64](https://git.laantungir.net/laantungir/otp/releases/download/v0.3.31/otp-v0.3.31-linux-arm64)**
|
||||
|
||||
After downloading:
|
||||
```bash
|
||||
# Make executable and run
|
||||
chmod +x otp-v0.3.31-linux-x86_64
|
||||
./otp-v0.3.31-linux-x86_64
|
||||
```
|
||||
|
||||
### First Steps
|
||||
|
||||
1. **Generate your first pad:**
|
||||
```bash
|
||||
./otp-v0.3.31-linux-x86_64 generate 1GB
|
||||
```
|
||||
|
||||
2. **Encrypt a message:**
|
||||
```bash
|
||||
./otp-v0.3.31-linux-x86_64 encrypt
|
||||
# Follow the interactive prompts
|
||||
```
|
||||
|
||||
3. **Decrypt a message:**
|
||||
```bash
|
||||
./otp-v0.3.31-linux-x86_64 decrypt
|
||||
# Paste the encrypted message
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Building from Source
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- GCC compiler
|
||||
- Git (for version tracking)
|
||||
- Make
|
||||
- Optional: ARM64 cross-compiler (`gcc-aarch64-linux-gnu`) for cross-compilation
|
||||
|
||||
### 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
|
||||
make # Build for current architecture
|
||||
make static # Static linking
|
||||
make clean # Clean artifacts
|
||||
make static # Static linking (standalone binary)
|
||||
make clean # Clean build artifacts
|
||||
make install # Install to /usr/local/bin/otp
|
||||
make uninstall # Remove from system
|
||||
```
|
||||
|
||||
Output: `build/otp-$(ARCH)` (e.g., `build/otp-x86_64`)
|
||||
|
||||
After building, run with:
|
||||
```bash
|
||||
./build/otp-x86_64
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Interactive Mode
|
||||
```bash
|
||||
# If you downloaded the binary:
|
||||
./otp-v0.3.31-linux-x86_64
|
||||
|
||||
# If you built from source:
|
||||
./build/otp-x86_64
|
||||
# or
|
||||
./build/otp-arm64 # On ARM systems
|
||||
```
|
||||
|
||||
### Command Line Mode
|
||||
```bash
|
||||
# Generate a new pad
|
||||
./build/otp-x86_64 generate 1GB
|
||||
./otp-v0.3.31-linux-x86_64 generate 1GB
|
||||
|
||||
# Encrypt text (interactive input)
|
||||
./build/otp-x86_64 encrypt <pad_hash_or_prefix>
|
||||
./otp-v0.3.31-linux-x86_64 encrypt <pad_hash_or_prefix>
|
||||
|
||||
# Decrypt message (interactive input)
|
||||
./build/otp-x86_64 decrypt <pad_hash_or_prefix>
|
||||
./otp-v0.3.31-linux-x86_64 decrypt <pad_hash_or_prefix>
|
||||
|
||||
# List available pads
|
||||
./build/otp-x86_64 list
|
||||
./otp-v0.3.31-linux-x86_64 list
|
||||
```
|
||||
|
||||
## Version System
|
||||
|
||||
36
build.sh
36
build.sh
@@ -155,6 +155,42 @@ update_source_version() {
|
||||
else
|
||||
print_warning "src/main.h not found - skipping version update"
|
||||
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
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
// Version - Updated automatically by build.sh
|
||||
#define OTP_VERSION "v0.3.29"
|
||||
#define OTP_VERSION "v0.3.31"
|
||||
|
||||
// Constants
|
||||
#define MAX_INPUT_SIZE 4096
|
||||
|
||||
Reference in New Issue
Block a user