Remove all uses of [x..] syntax from examples and tests.

This commit is contained in:
Brian Huffman 2019-02-27 16:25:53 -08:00
parent 00b58277bb
commit c387dbe5fd
6 changed files with 11 additions and 12 deletions

View File

@ -554,14 +554,14 @@ ctr32 : {n} (2^^39 - 128 >= n) => Key -> [128] -> [n] -> [n]
ctr32 k iv pt = pt ^ take stream
where
stream = join [E(k,v) | v <- ivs]
ivs = [take `{96} iv # cnt + i | i <- [0,1..]]
ivs = [take `{96} iv # cnt + i | i <- [0 ...]]
cnt = drop `{back=32} iv
ctr64 : {n} (2^^71 - 128 >= n) => Key -> [128] -> [n] -> [n]
ctr64 k iv pt = pt ^ take stream
where
stream = join [E(k,v) | v <- ivs]
ivs = [take `{64} iv # cnt + i | i <- [0,1..]]
ivs = [take `{64} iv # cnt + i | i <- [0 ...]]
cnt = drop `{back=64} iv
```

View File

@ -91,7 +91,7 @@ ppArray = [farmerString, chickenString, cornString, foxString]
ppBits : [4] -> [4]StringRep
ppBits s = [ if b then ppArray!i else noString
| b <- s
| i <- [0 .. ]:[_][4] ]
| i <- [0 ...]:[_][4] ]
// takes a sequence of states and derives what moved, and in which direction for each transition
extractMoves : {a} [a+1]BankState -> [a](DirRep, [4]StringRep)

View File

@ -12,11 +12,11 @@ SubBytes : State -> State
SubBytes state = [ [ SubByte b | b <- row ] | row <- state ]
ShiftRows : State -> State
ShiftRows state = [ row <<< i | row <- state | i : [2] <- [0 .. ] ]
ShiftRows state = [ row <<< i | row <- state | i : [2] <- [0 .. 3] ]
MixColumns : State -> State
MixColumns state = gf28MatrixMult m state
where m = [ [2,3,1,1] >>> i | i <- [ 0 .. ] ]
where m = [ [2,3,1,1] >>> i | i <- [0 .. 3] ]
/** The final AES round */
AESFinalRound : RoundKey -> State -> State
@ -33,12 +33,12 @@ InvSubBytes state = [ [ InvSubByte b | b <- row ] | row <- state ]
InvShiftRows : State -> State
InvShiftRows state = [ row >>> shiftAmount | row <- state
| shiftAmount : [2] <- [0 ..]
| shiftAmount : [2] <- [0 .. 3]
]
InvMixColumns : State -> State
InvMixColumns state = gf28MatrixMult m state
where m = [[0x0e, 0x0b, 0x0d, 0x09] >>> i | i <- [ 0 .. ] ]
where m = [[0x0e, 0x0b, 0x0d, 0x09] >>> i | i <- [0 .. 3] ]
/** The final inverted AES round */
AESFinalInvRound : RoundKey -> State -> State

View File

@ -6,8 +6,7 @@ import AES::SubBytePlain
type SBox = [256] GF28
sbox : SBox
sbox = [ SubByte x | x <- [ 0 .. ] ]
sbox = [ SubByte x | x <- [0 .. 255] ]
sboxInv : SBox
sboxInv = [ InvSubByte x | x <- [ 0 .. ] ]
sboxInv = [ InvSubByte x | x <- [0 .. 255] ]

View File

@ -31,7 +31,7 @@ tboxInv : TBox
tboxInv = mkTBox [ 0x0e, 0x09, 0x0d, 0x0b ] sboxInv
mkTBox : [4]GF28 -> SBox -> TBox
mkTBox seed box = [ [ a >>> i | a <- t0 ] | i <- [ 0 .. ] ]
mkTBox seed box = [ [ a >>> i | a <- t0 ] | i <- [0 .. 3] ]
where
t0 = [ [ gf28Mult c s | c <- seed ] | s <- box ]

View File

@ -1,5 +1,5 @@
check11 = zz == ww
where
zz = [0 .. 99]
qq = zz @@ ([0 ..] : [_][32])
qq = zz @@ ([0 .. 0xffffffff] : [_][32])
ww = qq @@ [0 .. 99]