From 451e6018dfbe415461896b2f97df019578cefd16 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 16 Oct 2020 16:53:58 +0300 Subject: Encryptor completed. --- Makefile | 2 +- cipher.sts | 4 ++++ encrypt.sts | 2 +- ia32/bitwise.sts | 6 ++++++ ia32/ia32.sts | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 ia32/bitwise.sts diff --git a/Makefile b/Makefile index 63defae..344c808 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ all: cryptrobber encrypt -.PHONY: all clean encrpyt cryptrobber +.PHONY: all clean encrypt cryptrobber cryptrobber: smack strans ./smack main.sts | ./strans > $@ diff --git a/cipher.sts b/cipher.sts index 0f20470..72d941e 100644 --- a/cipher.sts +++ b/cipher.sts @@ -4,6 +4,10 @@ defword ciphernew 0 exit +defword mod + swap / drop +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 diff --git a/encrypt.sts b/encrypt.sts index 64fade3..29424a2 100644 --- a/encrypt.sts +++ b/encrypt.sts @@ -24,6 +24,6 @@ set_entry passwd 3 ciphernew encrypt cipherdel -quit +sys_exit module ia32/elf/end.sts diff --git a/ia32/bitwise.sts b/ia32/bitwise.sts new file mode 100644 index 0000000..6d376e4 --- /dev/null +++ b/ia32/bitwise.sts @@ -0,0 +1,6 @@ +defasm xor + # 5b ?' ; pop ebx + # 58 ?' ; pop eax + # 31 ?' # d8 ?' ; xor eax, ebx + # 50 ?' ; push eax +next diff --git a/ia32/ia32.sts b/ia32/ia32.sts index 4d9e426..a667ebf 100644 --- a/ia32/ia32.sts +++ b/ia32/ia32.sts @@ -4,4 +4,5 @@ module ia32/stack.sts module ia32/branch.sts module ia32/memory.sts module ia32/math.sts +module ia32/bitwise.sts module ia32/syscall.sts -- cgit v1.2.3