This commit is contained in:
parent
9e90bdfc33
commit
ca0031431d
19 changed files with 287 additions and 0 deletions
24
examples/codegen.ang
Normal file
24
examples/codegen.ang
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
passphrase := "Hello world!".split("")
|
||||
start := [0, 0, 0]
|
||||
modulus := 10
|
||||
base := byte("!")
|
||||
|
||||
i := 0
|
||||
n := 0
|
||||
while n < passphrase.length() {
|
||||
b := byte(passphrase.at(n))
|
||||
|
||||
v = start.at(i) + b - base
|
||||
while v >= modulus {
|
||||
v = v - modulus
|
||||
}
|
||||
|
||||
start.put(i, v)
|
||||
|
||||
if i >= 3 {
|
||||
i = 0
|
||||
}
|
||||
n = n + 1
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue