js-caesarcipher 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -5
- package/index.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Caesar Cipher
|
|
2
2
|
|
|
3
|
+
[Caesar Cipher](https://en.wikipedia.org/wiki/Caesar_cipher) is a text encryption to shift letters to encrypt message in ancient time.
|
|
4
|
+
|
|
5
|
+
This package are some packed functions using for process Caesar cipher.
|
|
6
|
+
|
|
3
7
|
# Installation
|
|
8
|
+
|
|
4
9
|
Add this script tag to your html code
|
|
5
10
|
|
|
6
11
|
```html
|
|
@@ -11,7 +16,7 @@ Add this script tag to your html code
|
|
|
11
16
|
|
|
12
17
|
**Cipher the text**
|
|
13
18
|
|
|
14
|
-
Use the function `new CaesarCipher()`
|
|
19
|
+
Use the function `new CaesarCipher()` to cipher raw text.
|
|
15
20
|
|
|
16
21
|
Example: "Hello World", after shifting 2 letters will be "Jgnnq Yqtnf"
|
|
17
22
|
|
|
@@ -29,17 +34,54 @@ console.log(cipher.result);
|
|
|
29
34
|
|
|
30
35
|
**Decipher the text**
|
|
31
36
|
|
|
32
|
-
Use the function `CaesarCipher.deCipher()`
|
|
37
|
+
Use the function `CaesarCipher.deCipher()` to decipher ciphered text.
|
|
33
38
|
|
|
34
39
|
```javascript
|
|
35
|
-
CaesarCipher.deCipher("Jgnnq Yqtnf", 2)
|
|
40
|
+
let decipher = CaesarCipher.deCipher("Jgnnq Yqtnf", 2);
|
|
41
|
+
console.log(decipher)
|
|
36
42
|
// The output will be "Hello World"
|
|
37
43
|
```
|
|
38
44
|
|
|
39
45
|
**Crack ciphered text**
|
|
40
46
|
|
|
41
|
-
Use the function `CaesarCipher.crack()`
|
|
47
|
+
Use the function `CaesarCipher.crack()` to crack all the possible shifts of a ciphered text if you don't have the shift.
|
|
42
48
|
|
|
43
49
|
```javascript
|
|
44
|
-
CaesarCipher.crack("Jgnnq Yqtnf")
|
|
50
|
+
let crack = CaesarCipher.crack("Jgnnq Yqtnf");
|
|
51
|
+
console.log(crack);
|
|
52
|
+
/*
|
|
53
|
+
|
|
54
|
+
The output will be a array which list out all the shifts:
|
|
55
|
+
|
|
56
|
+
Example output:
|
|
57
|
+
[
|
|
58
|
+
'Jgnnq Yqtnf',
|
|
59
|
+
'Khoor Zruog',
|
|
60
|
+
'Lipps Asvph',
|
|
61
|
+
'Mjqqt Btwqi',
|
|
62
|
+
'Nkrru Cuxrj',
|
|
63
|
+
'Olssv Dvysk',
|
|
64
|
+
'Pmttw Ewztl',
|
|
65
|
+
'Qnuux Fxaum',
|
|
66
|
+
'Rovvy Gybvn',
|
|
67
|
+
'Spwwz Hzcwo',
|
|
68
|
+
'Tqxxa Iadxp',
|
|
69
|
+
'Uryyb Jbeyq',
|
|
70
|
+
'Vszzc Kcfzr',
|
|
71
|
+
'Wtaad Ldgas',
|
|
72
|
+
'Xubbe Mehbt',
|
|
73
|
+
'Yvccf Nficu',
|
|
74
|
+
'Zwddg Ogjdv',
|
|
75
|
+
'Axeeh Phkew',
|
|
76
|
+
'Byffi Qilfx',
|
|
77
|
+
'Czggj Rjmgy',
|
|
78
|
+
'Dahhk Sknhz',
|
|
79
|
+
'Ebiil Tloia',
|
|
80
|
+
'Fcjjm Umpjb',
|
|
81
|
+
'Gdkkn Vnqkc',
|
|
82
|
+
'Hello World',
|
|
83
|
+
'Ifmmp Xpsme'
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
*/
|
|
45
87
|
```
|
package/index.html
CHANGED