aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-10-16 16:07:04 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-10-16 16:07:04 +0300
commit599a40b02532b65ce5b9ac538c8579e292389766 (patch)
tree6d7899072556d0f7ccaf735e8308b2c6e6b0a7d0
parent68ea390db8e5977dcc84dc93daeb467ee243cb35 (diff)
downloadcryptrobber-599a40b02532b65ce5b9ac538c8579e292389766.tar
cryptrobber-599a40b02532b65ce5b9ac538c8579e292389766.tar.xz
cryptrobber-599a40b02532b65ce5b9ac538c8579e292389766.zip
Encryptor added.
-rw-r--r--cipher.sts14
-rw-r--r--encrypt.sts29
2 files changed, 43 insertions, 0 deletions
diff --git a/cipher.sts b/cipher.sts
new file mode 100644
index 0000000..0f20470
--- /dev/null
+++ b/cipher.sts
@@ -0,0 +1,14 @@
+; cipher is password string (pointer to start and length) and position in it
+
+defword ciphernew
+ 0
+exit
+
+defword cipher ; ... passwd plen ppos key
+ 3 get 2 get + @ xor ; key = key ^ passwd[ppos]
+ over 1 + 3 get mod 2 set ; ppos = (ppos + 1) % plen
+exit
+
+defword cipherdel
+ drop drop drop
+exit
diff --git a/encrypt.sts b/encrypt.sts
new file mode 100644
index 0000000..378a686
--- /dev/null
+++ b/encrypt.sts
@@ -0,0 +1,29 @@
+module ia32/elf/begin.sts
+module cipher.sts
+
+defword encbyte
+ key dup if
+ drop
+ cipher
+ 1 1
+ fi 0 = if
+ drop 0
+ fi
+exit
+
+defword encrypt
+ encbyte if encrypt fi
+exit
+
+defarr passwd 3
+
+set_entry
+ 31 passwd !
+ 32 passwd 1 + !
+ 33 passwd 2 + !
+ passwd 3 ciphernew
+ encrypt
+ cipherdel
+quit
+
+module ia32/elf/end.sts