Browse Source

initial commit

Scitoshi Nakayobro 1 year ago
commit
a9f9759c1f
5 changed files with 41 additions and 0 deletions
  1. 1
    0
      .gitignore
  2. 3
    0
      README.md
  3. 2
    0
      build
  4. 2
    0
      run
  5. 33
    0
      src/main.lisp

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+bin

+ 3
- 0
README.md View File

@@ -0,0 +1,3 @@
1
+# cct
2
+Caesar Cipher Tool is a simple little tool for encrypting/decrypting with the Caesar Cipher as well as analyzing letter frequency and using frequency 
3
+analysis to crack the caesar cipher.

+ 2
- 0
build View File

@@ -0,0 +1,2 @@
1
+#!/bin/bash
2
+urn --emit-lua bin/cct src/main.lisp

+ 2
- 0
run View File

@@ -0,0 +1,2 @@
1
+#!/bin/bash
2
+lua bin/cct "$@"

+ 33
- 0
src/main.lisp View File

@@ -0,0 +1,33 @@
1
+(import core/base (get-idx))
2
+
3
+(defun usage! ()
4
+	(print! "Usage: cct <encrypt|decrypt|analyze|crack> [shift] <file>"))
5
+
6
+(defun min-nargs-or-usage! (n)
7
+	(when (< (len# *arguments*) n)
8
+		(usage!)
9
+		(exit!)))
10
+
11
+(defun nargs-or-usage! (n)
12
+	(when (/= (len# *arguments*) n)
13
+		(usage!)
14
+		(exit!)))
15
+
16
+(min-nargs-or-usage! 1)
17
+(with (mode (get-idx *arguments* 1))
18
+	(case mode
19
+		["encrypt"
20
+			(nargs-or-usage! 3)
21
+			]
22
+		["decrypt"
23
+			(nargs-or-usage! 3)
24
+			]
25
+		["analyze"
26
+			(nargs-or-usage! 2)
27
+			]
28
+		["crack"
29
+			(nargs-or-usage! 2)
30
+			]
31
+		[_
32
+			(print! ($ "Unrecognized mode '${mode}'"))
33
+			(usage!)]))

Loading…
Cancel
Save