+
Skip to content

iyuangang/gpgenie

Repository files navigation

GPGenie

Go Test and Coverage codecov Go Report Card Release

GPGenie is a high-performance PGP key generation and management tool, focusing on generating PGP key pairs with special fingerprint characteristics.

Features

  • 🚀 High-performance concurrent key generation
  • 📊 Intelligent scoring system
  • 🔍 Detailed statistical analysis
  • 🔐 Secure key export
  • 📝 Comprehensive logging
  • 🎯 Configurable filtering criteria

Core Functions

1. Key Generation

  • Multi-worker concurrent key generation
  • Configurable generation parameters
  • Batch processing and storage
  • Automatic scoring and filtering

2. Scoring System

Scores are based on the following fingerprint characteristics:

  • Repeated character sequences
  • Increasing sequences
  • Decreasing sequences
  • Special magic sequences
  • Unique character count

3. Data Analysis

  • Score statistics analysis
  • Unique character statistics
  • Score component analysis
  • Correlation analysis

4. Key Management

  • Export keys by fingerprint
  • View highest scoring keys
  • View keys with least unique characters
  • ASCII Armor format support

Installation

go install github.com/iyuangang/gpgenie@latest

Configuration

Create a config/config.json configuration file:

{
  "environment": "development",
  "database": {
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "user": "postgres",
    "password": "your-password",
    "dbname": "gpgenie",
    "max_open_conns": 20,
    "max_idle_conns": 5,
    "conn_max_lifetime": 300,
    "log_level": "warn"
  },
  "key_generation": {
    "num_generator_workers": 4,
    "num_scorer_workers": 2,
    "total_keys": 1000,
    "min_score": 100,
    "max_letters_count": 8,
    "batch_size": 50,
    "name": "GPGenie Key",
    "comment": "Generated by GPGenie",
    "email": "key@gpgenie.local",
    "encryptor_public_key": "path/to/public.key"
  },
  "logging": {
    "log_level": "info",
    "log_file": "logs/gpgenie.log"
  }
}

Usage

Generate Keys

gpgenie generate -t 1000 -b 50

Show Top Scoring Keys

gpgenie show-top -n 10

Show Keys with Least Unique Characters

gpgenie show-low-letter-count -n 10

Export Specific Key

gpgenie export -f ABCDEF1234567890 -o ./exported_keys -a

Analyze Key Data

gpgenie analyze

Project Structure

gpgenie/
├── cmd/                   # Command line tools
├── internal/
│   ├── app/               # Application core
│   ├── config/            # Configuration management
│   ├── database/          # Database connection
│   ├── key/               # Key-related
│   │   ├── domain/        # Domain logic
│   │   └── service/       # Service layer
│   ├── logger/            # Logging management
│   └── repository/        # Data access
├── models/                # Data models
└── config/                # Configuration files

Tech Stack

  • Go 1.21+
  • GORM (Database ORM)
  • Cobra (CLI framework)
  • Viper (Configuration management)
  • Zap Logger (Logging)
  • go-crypto (Cryptography)

Development

  1. Clone the repository
git clone https://github.com/iyuangang/gpgenie.git
  1. Install dependencies
go mod download
  1. Run tests
# all tests
go test ./... -v

# single package tests
go test ./internal/key/domain -v

# integration tests
go test ./tests/integration -v

# generate test coverage report
go test ./... -coverprofile=coverage
go tool cover -html=coverage
  1. Build
go build -o gpgenie cmd/gpgenie/main.go

Key Features in Detail

Concurrent Key Generation

  • Uses worker pools for efficient key generation
  • Configurable number of generator and scorer workers
  • Batch processing for optimal database performance

Scoring Algorithm

The scoring system evaluates key fingerprints based on:

  • Repeated sequences (e.g., "AAAA")
  • Increasing sequences (e.g., "1234")
  • Decreasing sequences (e.g., "DCBA")
  • Magic sequences (special patterns)
  • Unique character distribution

Database Support

  • PostgreSQL support with GORM
  • SQLite support for development
  • Connection pooling and optimization
  • Transaction support for batch operations

Security Features

  • PGP encryption for private keys
  • ASCII Armor support
  • Secure file permissions for exported keys
  • Configurable encryption settings

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

MIT License

Acknowledgments

  • ProtonMail's go-crypto library
  • The Go community
  • All contributors to this project

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载