summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorcyfraeviolae <cyfraeviolae>2022-08-28 02:32:00 -0400
committercyfraeviolae <cyfraeviolae>2022-08-28 02:32:00 -0400
commitc6d2859dd229d6ad058440feac910b9905a761d7 (patch)
tree884b4aa604841ccc72ce63d10067ef15744193c9 /static
parent4ab74d6a630b3a8b74bd1f96f00309d157844c43 (diff)
k1 for ffff, diagrams int ext
Diffstat (limited to 'static')
-rw-r--r--static/decrypt-aes-gcm.go52
-rw-r--r--static/styles.css13
2 files changed, 62 insertions, 3 deletions
diff --git a/static/decrypt-aes-gcm.go b/static/decrypt-aes-gcm.go
new file mode 100644
index 0000000..bab07b5
--- /dev/null
+++ b/static/decrypt-aes-gcm.go
@@ -0,0 +1,52 @@
+package main
+
+import (
+ "crypto/aes"
+ "crypto/cipher"
+ "encoding/hex"
+ "errors"
+ "io/ioutil"
+ "os"
+)
+
+func main() {
+ err := inner()
+ if err != nil {
+ panic(err.Error())
+ }
+}
+
+func inner() error {
+ if len(os.Args) < 3 {
+ return errors.New("usage: ./decrypt-aes-gcm <key> <nonce> < input-file > output-file")
+ }
+ key, err := hex.DecodeString(os.Args[1])
+ if err != nil {
+ return err
+ }
+ nonce, err := hex.DecodeString(os.Args[2])
+ if err != nil {
+ return err
+ }
+ ciphertext, err := ioutil.ReadAll(os.Stdin)
+ if err != nil {
+ return err
+ }
+ block, err := aes.NewCipher(key)
+ if err != nil {
+ return err
+ }
+ aesgcm, err := cipher.NewGCM(block)
+ if err != nil {
+ return err
+ }
+ plaintext, err := aesgcm.Open(nil, nonce, ciphertext, nil)
+ if err != nil {
+ return err
+ }
+ _, err = os.Stdout.Write(plaintext)
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/static/styles.css b/static/styles.css
index 5ea8a95..768aba7 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -20,7 +20,7 @@ ul {
}
pre {
- white-space: pre-wrap;
+ /* white-space: pre-wrap; */
}
details[open=""] {
@@ -51,6 +51,13 @@ code {
max-height: 200px;
max-width: 300px;
min-height: 150px;
- /* width: 48%; */
- /* height: auto; */
+}
+
+.demo {
+ border: 1px dotted grey;
+ display: inline-block;
+ padding: 20px;
+ overflow-x: scroll;
+ width: 100%;
+ box-sizing: border-box;
}