aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-10-18 01:40:03 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-10-18 01:40:03 +0300
commit82798ff947aab53e548c6f9e3d4d8c8ff98108c3 (patch)
treed573632c43e8c1d1d9bc05d2a18c65ae303c904b
parente7bc8f97c763a8fa31c2c14a4b437c6fd9502c6a (diff)
downloadcryptrobber-82798ff947aab53e548c6f9e3d4d8c8ff98108c3.tar
cryptrobber-82798ff947aab53e548c6f9e3d4d8c8ff98108c3.tar.xz
cryptrobber-82798ff947aab53e548c6f9e3d4d8c8ff98108c3.zip
It's capable to work, probably.
-rw-r--r--encrypt.sts2
-rw-r--r--main.sts17
2 files changed, 9 insertions, 10 deletions
diff --git a/encrypt.sts b/encrypt.sts
index 3b546fc..edc9bbc 100644
--- a/encrypt.sts
+++ b/encrypt.sts
@@ -2,7 +2,7 @@ module ia32/elf/begin.sts
module cipher.sts
set_entry
- 0 local password
+ 31 local password
1 as passlen
passlen 1 - local pos
do sys_read 0 = until
diff --git a/main.sts b/main.sts
index ec3592f..c172a33 100644
--- a/main.sts
+++ b/main.sts
@@ -7,19 +7,19 @@ module freq.sts
[ sd 0 swap drop ]
defword nicedist
- 1 float_iload 4 float_iload float_div
+ 3e9eb852 float_fload
exit
defword calcdist ; distance from ideal as sqrt sum square diff
- top 1a - as calcdist.textfr
+ 1b ref as calcdist.textfr
local calcdist.fr
0 do dup 1a = until
- dup word_size mul as calcdist.i
- calcdist.i calcdist.fr + @ float_fload
- calcdist.i calcdist.textfr + @ float_fload
+ dup word_size mul dup dup
+ calcdist.fr + @ float_fload
+ calcdist.textfr + @ float_fload
float_sub float_fstore dup float_fload float_fload
- float_mul float_fstore calcdist.i calcdist.fr + !
- 1 + od drop
+ float_mul float_fstore swap calcdist.fr + !
+ 1 + od drop newline sys_write
0 do dup 19 = until
swap float_fload swap float_fload float_add float_fstore swap
1 + od drop
@@ -45,7 +45,6 @@ defword checktext
checktext.count @ 1 + checktext.count !
fi drop
dup 0 = untilod drop
- 1b print_stack newline sys_write
; ZERO DIVISION SHALL NOT PASS
checktext.count 0 = if drop
drop drop drop drop drop drop drop drop drop drop drop drop drop
@@ -54,7 +53,7 @@ checktext.count 0 = if drop
; normalize:
0 do dup 1a = until
dup word_size mul checktext.fr + dup @ float_iload
- checktext.count float_iload
+ checktext.count @ float_iload
float_div float_fstore swap !
1 + od drop
; Decide if text is real: