js-caesarcipher 1.1.3 → 1.1.5

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 CHANGED
@@ -1,17 +1,22 @@
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
7
- <script src="https://cdn.jsdelivr.net/npm/js-caesarcipher@1.1.2/script.js"></script>
12
+ <script src="https://cdn.jsdelivr.net/npm/js-caesarcipher@1.1.5/script.js"></script>
8
13
  ```
9
14
 
10
15
  # Useage
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,7 +34,7 @@ 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
40
  let decipher = CaesarCipher.deCipher("Jgnnq Yqtnf", 2);
@@ -39,9 +44,44 @@ console.log(decipher)
39
44
 
40
45
  **Crack ciphered text**
41
46
 
42
- 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.
43
48
 
44
49
  ```javascript
45
50
  let crack = CaesarCipher.crack("Jgnnq Yqtnf");
46
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
+ */
47
87
  ```
package/index.html CHANGED
@@ -1,5 +1,5 @@
1
1
  <script src="script.js"></script>
2
2
  <script>
3
3
 
4
- console.table(CaesarCipher.crack("Jgnnq Yqtnf"))
4
+ console.log(CaesarCipher.crack("Jgnnq Yqtnf"))
5
5
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "js-caesarcipher",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "A JavaScript library for Caesar Cipher",
5
5
  "keywords": [
6
6
  "caesar cipher",
package/script.js CHANGED
@@ -27,7 +27,7 @@ function CaesarCipher({ input, shift }) {
27
27
  CaesarCipher.deCipher = function (encryptedText, shifted) {
28
28
  let decipher = new CaesarCipher({
29
29
  "input": encryptedText,
30
- "shift": shifted * -1
30
+ "shift": (shifted * -1) + 26
31
31
  });
32
32
  return decipher.result;
33
33
  }