Skip to content

Commit 254c830

Browse files
authored
Create README.md
1 parent a517b73 commit 254c830

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<h1 align="center"><b>Implementation of Vigenere Cipher in PHP</b></h1>
2+
<p align="center">
3+
<img src="https://img.shields.io/packagist/dt/amculin/vigenere-cipher" alt="Packagist Download" />
4+
<img src="https://img.shields.io/github/stars/amculin/php-vigenere-cipher" alt="GitHub Repo stars" />
5+
<img src="https://img.shields.io/packagist/v/amculin/vigenere-cipher" alt="Packagist Version" />
6+
<img src="https://img.shields.io/github/actions/workflow/status/amculin/php-vigenere-cipher/build.yml" alt="Passed Build Workflow" />
7+
<img src="https://img.shields.io/badge/PHPStan-L_10-blue" alt="Passed PHPStan Level 10" />
8+
</p>
9+
10+
Encrypt/decrypt string using Vigenere Cipher algorithm
11+
## Instalation
12+
```bash
13+
composer require amculin/vigenere-cipher
14+
```
15+
## How to use
16+
Encryption
17+
```php
18+
use amculin\cryptography\classic\VigenereCipher;
19+
20+
$data = 'testtheencryptionprocess';
21+
$key = 'thisisthekey';
22+
23+
//Basic mode only support lowercase alphabet
24+
//You can use alpha_numeric mode for wider supported characters (a-z, A-Z, 0-9)
25+
$encrypted = VigenereCipher::encrypt($data, $key, 'basic');
26+
27+
echo "Plain text: {$data}\n";
28+
echo "Key: {$key}\n";
29+
echo "Cipher Text: {$encrypted}\n";
30+
```
31+
Output:
32+
```bash
33+
Plain text: testtheencryptionprocess
34+
Key: thisisthekey
35+
Cipher Text: mlalbzxlrmvwiaqgvhkvgowq
36+
```
37+
38+
Decryption
39+
```php
40+
use amculin\cryptography\classic\VigenereCipher;
41+
42+
$data = 'mlalbzxlrmvwiaqgvhkvgowq';
43+
$key = 'thisisthekey';
44+
$decrypted = VigenereCipher::decrypt($data, $key, 'basic');
45+
46+
echo "Cipher text: {$data}\n";
47+
echo "Key: {$key}\n";
48+
echo "Plain Text: {$decrypted}\n";
49+
```
50+
Output:
51+
```bash
52+
Cipher Text: mlalbzxlrmvwiaqgvhkvgowq
53+
Key: thisisthekey
54+
Plain text: testtheencryptionprocess
55+
```
56+
57+
## Features
58+
- [x] Support basic mode/lowercase alphabet only
59+
- [x] Support alpha-numeric mode (a-z, A-Z, 0-9)
60+
- [x] Unit test
61+
- [x] Comply PHPStan Level 10
62+
63+
## Todos
64+
- [ ] Add ASCII mode to support file encryption/decryption
65+
- [ ] Add Base64 mode to support Base64 string

0 commit comments

Comments
 (0)