API-Dokumentation

advertisement

API-Dokumentation

Erste Schritte

Unsere umfassende RESTful API ermöglicht nahtlosen programmatischen Zugriff auf verschiedene klassische Verschlüsselungsoperationen, einschließlich der Caesar-Verschlüsselung, ROT13-Transformation und der polyalphabetischen Vigenère-Verschlüsselung. Speziell für Bildungszwecke entwickelt, ist diese API vollkommen kostenlos und perfekt für Studenten, Lehrkräfte, Entwickler und Kryptographie-Enthusiasten. Ob Sie Bildungsanwendungen erstellen, Forschung betreiben oder einfach die faszinierende Welt der historischen Kryptographie erkunden – unsere API bietet robuste Funktionalität mit intelligenten automatischen Lösungskapazitäten und Unterstützung für mehrere Sprachen und benutzerdefinierte Alphabete.

Basis-URL: https://caesar-cipher.com/api/v1

Inhaltstyp: application/json

Anfragenlimit: 60 Anfragen/Minute

Wichtige Vorteile

Unsere API zeichnet sich durch ihren Bildungsfokus, umfassende Dokumentation und entwicklerfreundliches Design aus. Alle Endpunkte geben detaillierte Antworten mit pädagogischem Kontext zurück, was sie perfekt für Lernumgebungen macht. Die eingebaute Häufigkeitsanalyse und automatische Verschlüsselungsbrechung bieten wertvolle Einblicke in kryptoanalytische Techniken.

🎓 Educational Focus

Designed specifically for learning environments with comprehensive educational context and examples.

🔍 Auto-Solving

Intelligent frequency analysis and automatic cipher-breaking capabilities for research and learning.

🌍 Multi-Language

Support for multiple alphabets including Polish, German, Spanish, French, and custom alphabets.

📚 Free & Open

Completely free for educational and research purposes with comprehensive documentation.

Caesar Cipher

Encrypt Text

POST /api/v1/caesar/encrypt

Anfrage-Body:

{
  "text": "Hello World",
  "shift": 3,
  "alphabet": "basic",  // optional: basic, polish, german, spanish, french, custom
  "custom_alphabet": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",  // required if alphabet is "custom"
  "preserve_case": true,  // optional, default: true
  "preserve_non_alpha": true  // optional, default: true
}

Antwort:

{
  "success": true,
  "result": "Khoor Zruog",
  "method": "encrypt",
  "shift": 3,
  "alphabet": "basic",
  "text_length": 11
}

Text entschlüsseln

POST /api/v1/caesar/decrypt

Anfrage-Body:

{
  "text": "Khoor Zruog",
  "shift": 3,
  "alphabet": "basic"
}

Antwort:

{
  "success": true,
  "result": "Hello World",
  "method": "decrypt",
  "shift": 3,
  "alphabet": "basic",
  "text_length": 11
}

Caesar-Verschlüsselung automatisch lösen

POST /api/v1/caesar/solve

Anfrage-Body:

{
  "text": "Khoor Zruog",
  "alphabet": "basic",  // optional
  "language": "en"  // optional: en, pl, de, es, fr
}

Antwort:

{
  "success": true,
  "best_solution": {
    "shift": 3,
    "text": "Hello World",
    "confidence": 95
  },
  "all_solutions": [
    {"shift": 3, "text": "Hello World", "score": 95.2},
    {"shift": 7, "text": "Dahhk Sknhz", "score": 42.1},
    ...
  ],
  "alphabet": "basic",
  "language": "en"
}

Massenverarbeitung

POST /api/v1/caesar/bulk

Anfrage-Body:

{
  "items": [
    {"text": "Hello", "shift": 3},
    {"text": "World", "shift": 5}
  ],
  "method": "encrypt",  // encrypt, decrypt, or solve
  "alphabet": "basic"
}

Antwort:

{
  "success": true,
  "method": "encrypt",
  "alphabet": "basic",
  "count": 2,
  "results": [
    {"index": 0, "original": "Hello", "result": "Khoor", "shift": 3},
    {"index": 1, "original": "World", "result": "Btwqi", "shift": 5}
  ]
}

ROT13

Text transformieren

POST /api/v1/rot13/transform

Anfrage-Body:

{
  "text": "Hello World",
  "preserve_case": true,
  "preserve_non_alpha": true
}

Antwort:

{
  "success": true,
  "result": "Uryyb Jbeyq",
  "method": "rot13",
  "text_length": 11
}

Massen-ROT13

POST /api/v1/rot13/bulk

Anfrage-Body:

{
  "items": ["Hello", "World", "ROT13"],
  "preserve_case": true
}

Antwort:

{
  "success": true,
  "method": "rot13",
  "count": 3,
  "results": [
    {"index": 0, "original": "Hello", "result": "Uryyb"},
    {"index": 1, "original": "World", "result": "Jbeyq"},
    {"index": 2, "original": "ROT13", "result": "EBG13"}
  ]
}

Vigenère-Verschlüsselung

Mit Vigenère verschlüsseln

POST /api/v1/vigenere/encrypt

Anfrage-Body:

{
  "text": "Hello World",
  "key": "KEY",
  "preserve_case": true,
  "preserve_non_alpha": true
}

Antwort:

{
  "success": true,
  "result": "Rijvs Uyvjn",
  "method": "encrypt",
  "key_length": 3,
  "text_length": 11
}

Vigenère analysieren & brechen

POST /api/v1/vigenere/analyze

Anfrage-Body:

{
  "text": "RIJVS UYVJN RIJVS UYVJN...", // Long encrypted text
  "max_key_length": 10  // optional, default: 10
}

Antwort:

{
  "success": true,
  "analysis": {
    "probable_key_lengths": [3, 6, 9],
    "best_key_length": 3,
    "ioc_scores": {"1": 0.043, "2": 0.045, "3": 0.065},
    "probable_key": "KEY",
    "decrypted_preview": "HELLO WORLD HELLO WORLD..."
  },
  "text_length": 100
}

Code-Beispiele

JavaScript / Node.js

// Caesar Cipher Encryption
const response = await fetch('https://caesar-cipher.com/api/v1/caesar/encrypt', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: 'Hello World',
    shift: 3,
    alphabet: 'basic'
  })
});

const data = await response.json();
console.log(data.result); // "Khoor Zruog"

Python

import requests

# ROT13 Transform
response = requests.post('https://caesar-cipher.com/api/v1/rot13/transform',
    json={
        'text': 'Hello World',
        'preserve_case': True
    })

data = response.json()
print(data['result'])  # "Uryyb Jbeyq"

cURL

# Vigenère Cipher Encryption
curl -X POST https://caesar-cipher.com/api/v1/vigenere/encrypt \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello World",
    "key": "SECRET",
    "preserve_case": true
  }'

PHP

// Caesar Cipher Solver
$data = [
    'text' => 'Khoor Zruog',
    'alphabet' => 'basic',
    'language' => 'en'
];

$options = [
    'http' => [
        'header'  => "Content-type: application/json\r\n",
        'method'  => 'POST',
        'content' => json_encode($data)
    ]
];

$context  = stream_context_create($options);
$result = file_get_contents('https://caesar-cipher.com/api/v1/caesar/solve', false, $context);
$response = json_decode($result, true);

echo $response['best_solution']['text']; // "Hello World"

Fehlerbehandlung

Die API verwendet Standard-HTTP-Statuscodes und gibt JSON-Fehlermeldungen zurück.

Häufige Statuscodes:

  • 200 OK - Request successful
  • 400 Bad Request - Invalid parameters
  • 422 Unprocessable Entity - Validation errors
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server error

Fehlerantwortformat:

{
  "success": false,
  "error": "Validation error",
  "errors": {
    "text": ["The text field is required."],
    "shift": ["The shift must be between -25 and 25."]
  }
}

Anfragenlimitierung

Die API ist auf 60 Anfragen pro Minute pro IP-Adresse begrenzt. Informationen zum Anfragenlimit sind in den Antwortheadern enthalten:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 58

# When rate limit is exceeded (HTTP 429):
{
  "error": "Too Many Requests",
  "message": "Rate limit exceeded. You can make up to 60 requests per minute.",
  "retry_after": 60,
  "documentation": "https://caesar-cipher.com/api-docs"
}

Für höhere Limits oder kommerzielle Nutzung verwenden Sie bitte das Kontaktformular auf unserer Website.

Bereit zum Loslegen?

Beginnen Sie noch heute mit der Erkundung unserer API! Testen Sie die Endpunkte direkt, integrieren Sie sie in Ihre Anwendungen oder nutzen Sie unsere interaktiven Web-Tools, um die klassische Kryptographie besser zu verstehen.