aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2020-10-18 03:22:55 +0300
committerAleksey Veresov <aleksey@veresov.pro>2020-10-18 03:22:55 +0300
commit06a07e3994aacce9e61ed2e02686a49fc38716b2 (patch)
treeb7a207847f8465ee8198ad836b5c46188b3650bd
parent14c904b06043fa6fbbf5194b838f294248d0a360 (diff)
downloadcryptrobber-06a07e3994aacce9e61ed2e02686a49fc38716b2.tar
cryptrobber-06a07e3994aacce9e61ed2e02686a49fc38716b2.tar.xz
cryptrobber-06a07e3994aacce9e61ed2e02686a49fc38716b2.zip
We can use average word length metric.
-rw-r--r--main.sts19
1 files changed, 12 insertions, 7 deletions
diff --git a/main.sts b/main.sts
index 5159f93..002849b 100644
--- a/main.sts
+++ b/main.sts
@@ -7,7 +7,7 @@ module freq.sts
[ sd 0 swap drop ]
defword nicedist
- 1 float_iload 2 float_iload float_div
+ 3e9eb852 float_fload
exit
defword calcdist ; distance from ideal as sqrt sum square diff
@@ -19,7 +19,7 @@ defword calcdist ; distance from ideal as sqrt sum square diff
calcdist.textfr + @ float_fload
float_sub float_fstore dup float_fload float_fload
float_mul float_fstore swap calcdist.fr + !
- 1 + od drop newline sys_write
+ 1 + od
0 do dup 19 = until
swap float_fload swap float_fload float_add float_fstore swap
1 + od drop
@@ -43,7 +43,7 @@ defword checktext
fi dup dup 'Z' > 0 = swap 'A' < 0 = mul if
dup 'Z' swap - word_size mul checktext.fr + dup @ 1 + swap !
checktext.count @ 1 + checktext.count !
- fi dup 9 < if drop drop drop
+ fi dup dup 8 > 0 = swap 1 < 0 = mul if drop drop drop
drop drop drop drop drop drop drop drop drop drop drop drop drop
drop drop drop drop drop drop drop drop drop drop drop drop drop
0 exit fi dup dup 1f > 0 = swap e < 0 = mul if drop drop drop
@@ -101,7 +101,7 @@ set_entry float_init ; this is program with floats
0 do dup length = until
swap drop 1 +
od drop keylen
- od as langcode
+ od as langcode drop
; output language
langcode 1 = if
@@ -154,12 +154,17 @@ set_entry float_init ; this is program with floats
'r' sys_write_err
'o' sys_write_err
'r' sys_write_err
- fi
+ fi newline sys_write_err
; output text
length do 1 -
- dup word_size mul plaintext + @ sys_write
- dup 0 = untilod
+ swap sys_write
+ dup 0 = untilod drop
+
+ ; output key
+ keylen do 1 -
+ swap sys_write_err
+ dup 0 = untilod drop newline sys_write_err
sys_exit
module ia32/elf/end.sts