aboutsummaryrefslogtreecommitdiff
path: root/main.sts
blob: 86139090b1a63f0a93078565418bdc3514cfcf07 (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
module ia32/elf/begin.sts
module cipher.sts

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

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

    ; decipher text (length is the same as for ciphertext)
    passlen 1 - length do 1 -
        as pos local cipos
            pos word_size mul ciphertext + @
            password
            passlen
            cipos
        cipher
        swap pos
    dup 0 = untilod drop drop
    local plaintext

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

    ; output text (todo: and language)
    length do 1 -
        dup word_size mul plaintext + @ sys_write
    dup 0 = untilod
sys_exit

module ia32/elf/end.sts