aboutsummaryrefslogtreecommitdiff
path: root/sts/keygen.sts
blob: 6067c0d52e06dedd2be31bafee83d4bd053b3d5b (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
defword keygen
    ; Increment
    0
    do
    over over = until
        dup 2 + get
        dup ff < if
            1 + over 2 + set
            drop
            exit
        fi
        drop 0 over 2 + set
        1 +
    od
    drop

    ; Clean old stack data
    dup
    do
    dup 0 = until
        1 get 2 set swap drop
        1 -
    od
    drop

    1 +
    0
    do
    over over = until
        dup 2 get 1 set 0 2 set
        1 +
    od
    drop
exit