aboutsummaryrefslogtreecommitdiff
path: root/main.sts
blob: b4cf8a9e26fe8821730898c5fb0f4832d692eb5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module ia32/elf/begin.sts
module cipher.sts

set_entry
    ; read file into stack
    0 do sys_read 0 = until
        swap 1 +
    od as length
    local ciphertext

        ; -= MAIN LOOP BEGIN =- ;
    ; place password ontop of stack
    33 32 31 local password
    3 as passlen

    ; decipher text (length is the same as for ciphertext)
    0 0 do dup length = until
        2 print_stack newline sys_write
        as pos local cipos
            pos ciphertext + @
            password
            passlen
            cipos
        cipher
        swap pos
    1 + od drop drop
    local plaintext

    ; todo: check deciphering attempt, exit if Ok
        ; -= MAIN LOOP END =- ;

    ; output text (todo: and language)
    0 do dup length = until
        dup plaintext + @ sys_write
    1 + od
sys_exit

module ia32/elf/end.sts