fact stringlengths 5 19.5k | statement stringlengths 5 19.5k | proof stringlengths 0 4.29k | type stringclasses 7
values | symbolic_name stringlengths 0 36 | library stringclasses 13
values | filename stringclasses 71
values | imports listlengths 0 23 | deps listlengths 0 14 | docstring stringclasses 0
values | line_start int64 1 1.24k | line_end int64 1 1.24k | has_proof bool 2
classes | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
testPub = Curve25519 testPriv basePoint25519 | testPub = Curve25519 testPriv basePoint25519 | function | testPub | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
"testPriv"
] | null | 74 | 74 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
base58enc : {n,m} (fin n, fin m, n >= 6 ) => [n] -> [m][8]
base58enc ns = [ x.1 | x <- reverse (take `{m} (drop `{1} enc))]
where
enc = [(ns,zero)] # [ (n/58,charOf (n%58)) | (n,_) <- enc ]
charOf x = charMap @ x | base58enc : {n,m} (fin n, fin m, n >= 6 ) => [n] -> [m][8] | base58enc ns = [ x.1 | x <- reverse (take `{m} (drop `{1} enc))]
where
enc = [(ns,zero)] # [ (n/58,charOf (n%58)) | (n,_) <- enc ]
charOf x = charMap @ x | function | base58enc | examples.MiniLock.prim | examples/MiniLock/prim/Base58.cry | [] | [
">=",
"charMap",
"drop",
"fin",
"reverse",
"take"
] | null | 13 | 13 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
charMap : [58][8]
charMap = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" | charMap : [58][8] | charMap = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" | function | charMap | examples.MiniLock.prim | examples/MiniLock/prim/Base58.cry | [] | [] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
base58dec : {n,m} (fin n, fin m, n >= 1, n >= width m, n >= 8) => [m][8] -> [n]
base58dec ms = sum [ (dec m) * 58 ^^ i | m <- reverse ms | i <- [0..m] ]
where
dec : [8] -> [n]
dec x = zero # dec' x
dec' : [8] -> [8]
dec' x =
if x >= 'm'
then x - 'm' + 44
else if x >= 'a'
then x - 'a'... | base58dec : {n,m} (fin n, fin m, n >= 1, n >= width m, n >= 8) => [m][8] -> [n] | base58dec ms = sum [ (dec m) * 58 ^^ i | m <- reverse ms | i <- [0..m] ]
where
dec : [8] -> [n]
dec x = zero # dec' x
dec' : [8] -> [8]
dec' x =
if x >= 'm'
then x - 'm' + 44
else if x >= 'a'
then x - 'a' + 33
else if x >= 'P'
then x - 'P' + 22
... | function | base58dec | examples.MiniLock.prim | examples/MiniLock/prim/Base58.cry | [] | [
">=",
"^^",
"fin",
"reverse",
"sum",
"width",
"zero"
] | null | 22 | 22 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
Enc64 n = 4*(((3-(n%3))%3) + n)/3 | Enc64 n = 4*(((3-(n%3))%3) + n)/3 | type | Enc64 | examples.MiniLock.prim | examples/MiniLock/prim/Base64.cry | [] | [] | null | 7 | 7 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
base64enc : {n,m,padZ} (4*(padZ + n)/3 == m, fin n, fin m, padZ == (3-(n%3))%3, 2>=padZ)
=> [n][8] -> [Enc64 n][8]
base64enc ns = take `{m} (chunks # padEq)
where
chunks = take `{(4*n+2)/3} (base64chunks `{(n+2)/3} (ns # padZero))
padZero = take `{padZ} [zero | _ <- [1..2] : [_][2]]
padEq ... | base64enc : {n,m,padZ} (4*(padZ + n)/3 == m, fin n, fin m, padZ == (3-(n%3))%3, 2>=padZ)
=> [n][8] -> [Enc64 n][8] | base64enc ns = take `{m} (chunks # padEq)
where
chunks = take `{(4*n+2)/3} (base64chunks `{(n+2)/3} (ns # padZero))
padZero = take `{padZ} [zero | _ <- [1..2] : [_][2]]
padEq = "==" | function | base64enc | examples.MiniLock.prim | examples/MiniLock/prim/Base64.cry | [] | [
"==",
"base64chunks",
"fin",
"take"
] | null | 9 | 10 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
base64chunks : {n} (fin n) => [n*3][8] -> [n*4][8]
base64chunks m = [basify x | x <- ns]
where
ns = split (join m) : [_][6]
basify : [6] -> [8]
basify x = alphabet @ x
// Base64 strings are always in 4n byte chunks, the final chunk might be
// padded. We can not give a proper cryptol implementation that strips... | base64chunks : {n} (fin n) => [n*3][8] -> [n*4][8] | base64chunks m = [basify x | x <- ns]
where
ns = split (join m) : [_][6]
basify : [6] -> [8]
basify x = alphabet @ x
// Base64 strings are always in 4n byte chunks, the final chunk might be
// padded. We can not give a proper cryptol implementation that strips the
// padding because that would require the type... | function | base64chunks | examples.MiniLock.prim | examples/MiniLock/prim/Base64.cry | [] | [
"alphabet",
"fin",
"join",
"split"
] | null | 20 | 20 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
base64dec : {n,m} (fin m, 4*n == 3*m, fin n) => [m][8] -> ([n][8],[2])
base64dec ms = (split (join [debase x | x <- ms]), nrEq)
where
nrEq : [2]
nrEq = sum [ zero # [x == '='] | x <- take `{2} (reverse ms # [zero,zero]) ]
debase : [8] -> [6]
debase x = drop `{2} (debase' x)
debase' : [8] -> [8]
debase' x =
... | base64dec : {n,m} (fin m, 4*n == 3*m, fin n) => [m][8] -> ([n][8],[2]) | base64dec ms = (split (join [debase x | x <- ms]), nrEq)
where
nrEq : [2]
nrEq = sum [ zero # [x == '='] | x <- take `{2} (reverse ms # [zero,zero]) ]
debase : [8] -> [6]
debase x = drop `{2} (debase' x)
debase' : [8] -> [8]
debase' x =
if x >= 'A' /\ x <= 'Z'
then x - 'A'
else if x >= 'a' ... | function | base64dec | examples.MiniLock.prim | examples/MiniLock/prim/Base64.cry | [] | [
"/\\",
"<=",
"==",
">=",
"drop",
"fin",
"join",
"reverse",
"split",
"sum",
"take",
"zero"
] | null | 32 | 32 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
alphabet = ['A'..'Z'] # ['a'..'z'] # ['0'..'9'] # "+/" | alphabet = ['A'..'Z'] # ['a'..'z'] # ['0'..'9'] # "+/" | function | alphabet | examples.MiniLock.prim | examples/MiniLock/prim/Base64.cry | [] | [] | null | 17 | 17 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Block = [16][32] | Block = [16][32] | type | Block | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 7 | 7 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
State = [8][32] | State = [8][32] | type | State | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 8 | 8 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
LocalState = [16][32] | LocalState = [16][32] | type | LocalState | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 9 | 9 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
BCounter = [64] | BCounter = [64] | type | BCounter | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 10 | 10 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Context = { state : State, counter : BCounter }
// Block size | Context = { state : State, counter : BCounter }
// Block size | type | Context | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"BCounter"
] | null | 12 | 14 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
katsPass = ~zero ==
[ nthKat `{0}
, nthKat `{1}
, nthKat `{2}
, nthKat `{3}
, nthKat `{4}
, nthKat `{5}
, nthKat `{6}
, nthKat `... | katsPass = ~zero ==
[ nthKat `{0}
, nthKat `{1}
, nthKat `{2}
, nthKat `{3}
, nthKat `{4}
, nthKat `{5}
, nthKat `{6}
, nthKat `... | property | katsPass | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"==",
"nthKat"
] | null | 163 | 420 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bbVal : [64]
bbVal = 64 | bbVal : [64] | bbVal = 64 | function | bbVal | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 15 | 15 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
IV : [8][32]
IV = [ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
] | IV : [8][32] | IV = [ 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
] | function | IV | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
SIGMA_TABLE : [10][16][4]
SIGMA_TABLE =
[ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
, [ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 ]
, [ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 ]
, [ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, ... | SIGMA_TABLE : [10][16][4] | SIGMA_TABLE =
[ [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
, [ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 ]
, [ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 ]
, [ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 ]
, [ ... | function | SIGMA_TABLE | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 24 | 24 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
R1,R2,R3,R4 : [6] | R1,R2,R3,R4 : [6] | function | R1,R2,R3,R4 | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 39 | 39 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
G : [4] -> [4] -> LocalState -> [4][6] -> Block -> [16][32]
G r i vec abcd ms = foldl updateVector vec (zip abcd new)
where
new = G' r i (vec @@ abcd) ms | G : [4] -> [4] -> LocalState -> [4][6] -> Block -> [16][32] | G r i vec abcd ms = foldl updateVector vec (zip abcd new)
where
new = G' r i (vec @@ abcd) ms | function | G | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"Block",
"G'",
"LocalState",
"foldl",
"updateVector",
"zip"
] | null | 46 | 46 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
G' : [4] -> [4] -> [4][32] -> Block -> [4][32]
G' r i vals ms = [a2, b2, c2, d2]
where
x = ms @ (SIGMA_TABLE @ r @ (2*i))
y = ms @ (SIGMA_TABLE @ r @ (2*i+1))
[a,b,c,d] = vals
a1 = a + b + x
d1 = (d ^ a1) >>> R1
c1 = c + d1
b1 = (b ^ c1) >>> R2
a2 = a1 + b1 + y
d2 = (d1 ^ a2) >>> R3
c2 = c1 + ... | G' : [4] -> [4] -> [4][32] -> Block -> [4][32] | G' r i vals ms = [a2, b2, c2, d2]
where
x = ms @ (SIGMA_TABLE @ r @ (2*i))
y = ms @ (SIGMA_TABLE @ r @ (2*i+1))
[a,b,c,d] = vals
a1 = a + b + x
d1 = (d ^ a1) >>> R1
c1 = c + d1
b1 = (b ^ c1) >>> R2
a2 = a1 + b1 + y
d2 = (d1 ^ a2) >>> R3
c2 = c1 + d2
b2 = (b1 ^ c2) >>> R4
// Section 3.2: Com... | function | G' | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
">>>",
"Block",
"R1",
"R2",
"R3",
"R4",
"SIGMA_TABLE"
] | null | 51 | 51 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
F : State -> Block -> BCounter -> Bit -> State
F h ms t f = h ^ (take (vs!0)) ^ (drop (vs!0))
where
v = h # IV ^ (zero # [t0,t1,f0,zero])
[t1,t0] = split t : [2][32]
f0 = [f | _ <- [0..31] : [_][6]]
vs = [v] # [ round i ms v' | v' <- vs | i <- [0..9] ]
// Sub-function of F (first for loop) | F : State -> Block -> BCounter -> Bit -> State | F h ms t f = h ^ (take (vs!0)) ^ (drop (vs!0))
where
v = h # IV ^ (zero # [t0,t1,f0,zero])
[t1,t0] = split t : [2][32]
f0 = [f | _ <- [0..31] : [_][6]]
vs = [v] # [ round i ms v' | v' <- vs | i <- [0..9] ]
// Sub-function of F (first for loop) | function | F | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"BCounter",
"Bit",
"Block",
"IV",
"State",
"drop",
"round",
"split",
"take",
"zero"
] | null | 67 | 67 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
round : [4] -> Block -> LocalState -> LocalState
round r ms v = vs ! 0
where
vs = [v] # [ G r i v' ix ms
| v' <- vs
| i <- [0..7]
| ix <- [ [0,4,8,12], [1,5,9,13]
, [2,6,10,14], [3,7,11,15]
, [0,5,10,15], [1,... | round : [4] -> Block -> LocalState -> LocalState | round r ms v = vs ! 0
where
vs = [v] # [ G r i v' ix ms
| v' <- vs
| i <- [0..7]
| ix <- [ [0,4,8,12], [1,5,9,13]
, [2,6,10,14], [3,7,11,15]
, [0,5,10,15], [1,6,11,12]
, [2,7,8,13], ... | function | round | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"Block",
"LocalState"
] | null | 76 | 76 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
blake2s : {ll,nn} (fin ll, 32 >= nn, 64 >= width ll)
=> [ll][8] -> [nn*8]
blake2s m = blake2s' `{ll=ll,nn=nn} m | blake2s : {ll,nn} (fin ll, 32 >= nn, 64 >= width ll)
=> [ll][8] -> [nn*8] | blake2s m = blake2s' `{ll=ll,nn=nn} m | function | blake2s | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
">=",
"blake2s'",
"fin",
"width"
] | null | 95 | 96 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
blake2s' : {ll,dd,nn}
(fin ll
, 32 >= nn
, dd == (max 1 ((ll+63)/64)) - 1
, 64 >= width ll
)
=> [ll][8]
-> [nn*8]
blake2s' m = take `{nn*8} (blake2sFinish ({ state = (hs!0).state, counter = `ll}) lastBlock)
where
fullBlocks : [dd]Block
fullBlocks = ... | blake2s' : {ll,dd,nn}
(fin ll
, 32 >= nn
, dd == (max 1 ((ll+63)/64)) - 1
, 64 >= width ll
)
=> [ll][8]
-> [nn*8] | blake2s' m = take `{nn*8} (blake2sFinish ({ state = (hs!0).state, counter = `ll}) lastBlock)
where
fullBlocks : [dd]Block
fullBlocks = [mkBlock b | b <- split (join (take `{front=64*dd,back=ll-64*dd} m))]
partialBlock = drop `{front=64*dd,back=ll-64*dd} m
lastBlock : Block
lastBlock =
if (`ll == (zero:[6... | function | blake2s' | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"==",
">=",
"Block",
"Context",
"blake2sFinish",
"drop",
"fin",
"join",
"max",
"mkBlock",
"split",
"take",
"width",
"zero"
] | null | 99 | 106 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
blake2Update : Context -> Block -> Context
blake2Update ctx d = { state = newState, counter = newCount }
where newState = F ctx.state d newCount False
newCount = ctx.counter + (64 : [64]) | blake2Update : Context -> Block -> Context | blake2Update ctx d = { state = newState, counter = newCount }
where newState = F ctx.state d newCount False
newCount = ctx.counter + (64 : [64]) | function | blake2Update | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"Block",
"Context",
"False"
] | null | 127 | 127 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
postprocess : {ll} (64 >= ll, 64 >= width ll) => BCounter -> [ll][8] -> Block
postprocess c m =
if c == 0 /\ `ll == (zero:[64])
then zero
else split (join m # zero)
// The final round of blake | postprocess : {ll} (64 >= ll, 64 >= width ll) => BCounter -> [ll][8] -> Block | postprocess c m =
if c == 0 /\ `ll == (zero:[64])
then zero
else split (join m # zero)
// The final round of blake | function | postprocess | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"/\\",
"==",
">=",
"BCounter",
"Block",
"join",
"split",
"width",
"zero"
] | null | 132 | 132 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
blake2sFinish : Context -> Block -> [256]
blake2sFinish ctx b = join [ reverseBytes w | w <- F ctx.state b ctx.counter True ]
////////////////////////////////////////////////////////////////////////////////
// Utilities
//////////////////////////////////////////////////////////////////////////////// | blake2sFinish : Context -> Block -> [256] | blake2sFinish ctx b = join [ reverseBytes w | w <- F ctx.state b ctx.counter True ]
////////////////////////////////////////////////////////////////////////////////
// Utilities
//////////////////////////////////////////////////////////////////////////////// | function | blake2sFinish | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"Block",
"Context",
"True",
"join",
"reverseBytes"
] | null | 139 | 139 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
updateVector : {a, b, c} (c >= width (a-1), a >= 1, fin a, fin c) => [a]b -> ([c], b) -> [a]b
updateVector orig idxNew = vs
where
idx = idxNew.0
new = idxNew.1
vs = [if i == idx then new else orig@i | i <- [0..a-1]] | updateVector : {a, b, c} (c >= width (a-1), a >= 1, fin a, fin c) => [a]b -> ([c], b) -> [a]b | updateVector orig idxNew = vs
where
idx = idxNew.0
new = idxNew.1
vs = [if i == idx then new else orig@i | i <- [0..a-1]] | function | updateVector | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"==",
">=",
"fin",
"width"
] | null | 155 | 155 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
nthKat : {n} (fin n, 8 >= width n) => Bit
nthKat = blake2s (nthKatInput `{n}) == kats @ (`n : [8]) | nthKat : {n} (fin n, 8 >= width n) => Bit | nthKat = blake2s (nthKatInput `{n}) == kats @ (`n : [8]) | function | nthKat | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"==",
">=",
"Bit",
"blake2s",
"fin",
"kats",
"nthKatInput",
"width"
] | null | 423 | 423 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
nthKatInput : {n} (fin n) => [n][8]
nthKatInput = take ([0 ... ] : [inf][8]) | nthKatInput : {n} (fin n) => [n][8] | nthKatInput = take ([0 ... ] : [inf][8]) | function | nthKatInput | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"fin",
"take"
] | null | 426 | 426 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
R1 = 16 | R1 = 16 | function | R1 | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 40 | 40 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
R2 = 12 | R2 = 12 | function | R2 | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 41 | 41 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
R3 = 08 | R3 = 08 | function | R3 | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 42 | 42 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
R4 = 07
// Section 3.1: Mixing function 'G' | R4 = 07
// Section 3.1: Mixing function 'G' | function | R4 | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 43 | 45 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
mkBlock x = reverse (split (reverseBytes x)) | mkBlock x = reverse (split (reverseBytes x)) | function | mkBlock | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"reverse",
"reverseBytes",
"split"
] | null | 147 | 147 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
reverseBytes x = join (reverse (bytes x)) | reverseBytes x = join (reverse (bytes x)) | function | reverseBytes | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"bytes",
"join",
"reverse"
] | null | 149 | 149 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bytes x = split x : [_] [8]
// XXX can probably do a cleaner merge-sort style update. | bytes x = split x : [_] [8]
// XXX can probably do a cleaner merge-sort style update. | function | bytes | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [
"split"
] | null | 151 | 154 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
kats = [ 0x69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9
, 0xe34d74dbaf4ff4c6abd871cc220451d2ea2648846c7757fbaac82fe51ad64bea
, 0xddad9ab15dac4549ba42f49d262496bef6c0bae1dd342a8808f8ea267c6e210c
, 0xe8f91c6ef232a041452ab0e149070cdd7dd1769e75b3a5921be37876c45c9900
, 0x0cc70... | kats = [ 0x69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9
, 0xe34d74dbaf4ff4c6abd871cc220451d2ea2648846c7757fbaac82fe51ad64bea
, 0xddad9ab15dac4549ba42f49d262496bef6c0bae1dd342a8808f8ea267c6e210c
, 0xe8f91c6ef232a041452ab0e149070cdd7dd1769e75b3a5921be37876c45c9900
, 0x0cc70... | function | kats | examples.MiniLock.prim | examples/MiniLock/prim/Blake2s.cry | [] | [] | null | 429 | 685 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
uext : {a, b} (fin b,fin a) => [a] -> [a+b]
uext(x) = zero # x | uext : {a, b} (fin b,fin a) => [a] -> [a+b] | uext(x) = zero # x | function | uext | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"fin",
"zero"
] | null | 8 | 8 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
iext : {a, b} (fin b,fin a) => [a] -> [a+b]
iext(x) = (if x@0 then ~zero else zero) # x
/* Returns the (n+1)-bit sum of two n-bit numbers. */ | iext : {a, b} (fin b,fin a) => [a] -> [a+b] | iext(x) = (if x@0 then ~zero else zero) # x
/* Returns the (n+1)-bit sum of two n-bit numbers. */ | function | iext | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"fin",
"zero"
] | null | 11 | 11 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
safe_add : {n} (fin n) => ([n],[n]) -> [n+1]
safe_add(x,y) = uext(x) + uext(y)
/* returns the (n+1)-bit subtraction of two n-bit numbers. */ | safe_add : {n} (fin n) => ([n],[n]) -> [n+1] | safe_add(x,y) = uext(x) + uext(y)
/* returns the (n+1)-bit subtraction of two n-bit numbers. */ | function | safe_add | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"fin",
"uext"
] | null | 15 | 15 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
safe_sub : {n} (fin n) => ([n],[n]) -> [n+1]
safe_sub(x,y) = uext(x) - uext(y)
/* Is x in normalized form (relative to prime p)? */ | safe_sub : {n} (fin n) => ([n],[n]) -> [n+1] | safe_sub(x,y) = uext(x) - uext(y)
/* Is x in normalized form (relative to prime p)? */ | function | safe_sub | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"fin",
"uext"
] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
is_normal : {a} (fin a) => [a] -> [a] -> Bit
is_normal p x = (x < p)
/* Returns the product of two inputs. */ | is_normal : {a} (fin a) => [a] -> [a] -> Bit | is_normal p x = (x < p)
/* Returns the product of two inputs. */ | function | is_normal | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"Bit",
"fin"
] | null | 23 | 23 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
safe_product : {a} (fin a) => ([a],[a]) -> [2*a]
safe_product(x,y) = uext(x) * uext(y)
/* Returns module reduction on input. */ | safe_product : {a} (fin a) => ([a],[a]) -> [2*a] | safe_product(x,y) = uext(x) * uext(y)
/* Returns module reduction on input. */ | function | safe_product | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"fin",
"uext"
] | null | 27 | 27 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
safe_mod : {a, b} (fin a, fin b) => ([b],[a+b]) -> [b]
safe_mod(p,x) = drop `{a} (x % uext(p))
/* Add two n-bit numbers and input carry to obtain a n bit number and output carry. */ | safe_mod : {a, b} (fin a, fin b) => ([b],[a+b]) -> [b] | safe_mod(p,x) = drop `{a} (x % uext(p))
/* Add two n-bit numbers and input carry to obtain a n bit number and output carry. */ | function | safe_mod | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"drop",
"fin",
"uext"
] | null | 31 | 31 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
adc : {n} (fin n) => ([n],[n]) -> ([n],Bit)
adc(x,y) = (drop(sm), sm@0)
where sm = safe_add(x,y)
/* sbb(x,y) subtracts y from x, and returns result along with output borrow bit. */ | adc : {n} (fin n) => ([n],[n]) -> ([n],Bit) | adc(x,y) = (drop(sm), sm@0)
where sm = safe_add(x,y)
/* sbb(x,y) subtracts y from x, and returns result along with output borrow bit. */ | function | adc | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"drop",
"fin",
"safe_add"
] | null | 35 | 35 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sbb : {n} (fin n) => ([n],[n]) -> ([n],Bit)
sbb(x,y) = (drop(r), r@0)
where r = ([False] # x) - ([False] # y) | sbb : {n} (fin n) => ([n],[n]) -> ([n],Bit) | sbb(x,y) = (drop(r), r@0)
where r = ([False] # x) - ([False] # y) | function | sbb | examples.MiniLock.prim | examples/MiniLock/prim/bv.cry | [] | [
"drop",
"fin"
] | null | 40 | 40 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
cat_in_a_box priv1 priv2 msg nonce = open == msg
where pub1 = Curve25519 priv1 basePoint25519
pub2 = Curve25519 priv2 basePoint25519
box = crypto_box (msg : [100][8]) nonce pub2 priv1
open = (crypto_box_open box nonce pub1 priv2).1 | cat_in_a_box priv1 priv2 msg nonce = open == msg
where pub1 = Curve25519 priv1 basePoint25519
pub2 = Curve25519 priv2 basePoint25519
box = crypto_box (msg : [100][8]) nonce pub2 priv1
open = (crypto_box_open box nonce pub1 priv2).1 | property | cat_in_a_box | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
"==",
"crypto_box",
"crypto_box_open"
] | null | 48 | 52 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
hat_in_a_box k msg nonce = open == msg
where box = crypto_secretbox (msg : [88][8]) k nonce
open = (crypto_secretbox_open box k nonce).1 | hat_in_a_box k msg nonce = open == msg
where box = crypto_secretbox (msg : [88][8]) k nonce
open = (crypto_secretbox_open box k nonce).1 | property | hat_in_a_box | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
"==",
"crypto_secretbox",
"crypto_secretbox_open"
] | null | 54 | 56 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
crypto_box_kats = zero != [ katTest1 ]
// KAT generated from sodium | crypto_box_kats = zero != [ katTest1 ]
// KAT generated from sodium | property | crypto_box_kats | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
"!=",
"katTest1",
"zero"
] | null | 58 | 60 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
crypto_box : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes)) => [msgBytes][8] -> [24][8] -> Public25519 -> Private25519 -> [msgBytes + 16][8]
crypto_box m n pub priv = crypto_secretbox m k n
where
s = Curve25519 priv pub
k = HSalsa20_bytes `{r=20} s zero | crypto_box : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes)) => [msgBytes][8] -> [24][8] -> Public25519 -> Private25519 -> [msgBytes + 16][8] | crypto_box m n pub priv = crypto_secretbox m k n
where
s = Curve25519 priv pub
k = HSalsa20_bytes `{r=20} s zero | function | crypto_box | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
">=",
"HSalsa20_bytes",
"crypto_secretbox",
"fin",
"width",
"zero"
] | null | 13 | 13 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
crypto_box_open : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes)) => [msgBytes+16][8] -> [24][8] -> Public25519 -> Private25519 -> (Bit,[msgBytes][8])
crypto_box_open box n pub priv = crypto_secretbox_open box k n
where
(tag,ct) = splitAt `{16} box
s = Curve25519 priv pub
k = HSalsa20_byt... | crypto_box_open : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes)) => [msgBytes+16][8] -> [24][8] -> Public25519 -> Private25519 -> (Bit,[msgBytes][8]) | crypto_box_open box n pub priv = crypto_secretbox_open box k n
where
(tag,ct) = splitAt `{16} box
s = Curve25519 priv pub
k = HSalsa20_bytes `{r=20} s zero | function | crypto_box_open | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
">=",
"HSalsa20_bytes",
"crypto_secretbox_open",
"fin",
"splitAt",
"width",
"zero"
] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
crypto_secretbox : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes))
=> [msgBytes][8] -> [32][8] -> [24][8] -> [msgBytes + 16][8]
crypto_secretbox m k n = box
where
blob = XSalsa20_encrypt `{r=20} k n ((zero : [32][8]) # m)
authKey = join (take `{32} blob)
ciphertext = drop `{32} bl... | crypto_secretbox : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes))
=> [msgBytes][8] -> [32][8] -> [24][8] -> [msgBytes + 16][8] | crypto_secretbox m k n = box
where
blob = XSalsa20_encrypt `{r=20} k n ((zero : [32][8]) # m)
authKey = join (take `{32} blob)
ciphertext = drop `{32} blob
authTag = Poly1305 authKey ciphertext
box = authTag # ciphertext | function | crypto_secretbox | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
">=",
"XSalsa20_encrypt",
"drop",
"fin",
"join",
"take",
"width",
"zero"
] | null | 26 | 27 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
crypto_secretbox_open : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes))
=> [msgBytes + 16][8] -> [32][8] -> [24][8] -> (Bit,[msgBytes][8])
crypto_secretbox_open box k n = (valid,pt)
where
(tag,ct) = splitAt `{16} box
blob = XSalsa20_encrypt `{r=20} k n ((zero : [32][8]) # ct)
au... | crypto_secretbox_open : {msgBytes} (fin msgBytes, 64 >= width (32 + msgBytes))
=> [msgBytes + 16][8] -> [32][8] -> [24][8] -> (Bit,[msgBytes][8]) | crypto_secretbox_open box k n = (valid,pt)
where
(tag,ct) = splitAt `{16} box
blob = XSalsa20_encrypt `{r=20} k n ((zero : [32][8]) # ct)
authKey = join (take `{32} blob)
plaintext = drop blob : [msgBytes][8]
cTag = Poly1305 authKey ct
valid = cTag == tag
pt = if ... | function | crypto_secretbox_open | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
"==",
">=",
"XSalsa20_encrypt",
"drop",
"fin",
"join",
"splitAt",
"take",
"width",
"zero"
] | null | 36 | 37 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
katTest1 = crypto_secretbox "hello" zero zero == split 0xc769f9d535dc338e99ac93440502c7ceae5bd79391 | katTest1 = crypto_secretbox "hello" zero zero == split 0xc769f9d535dc338e99ac93440502c7ceae5bd79391 | function | katTest1 | examples.MiniLock.prim | examples/MiniLock/prim/CryptoBox.cry | [
"Salsa20",
"Poly1305",
"CfrgCurves"
] | [
"==",
"crypto_secretbox",
"split",
"zero"
] | null | 61 | 61 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
pass =
~zero ==
[ hmacSHA256 [0x0b | _ <- [1..20] : [_][6]] "Hi There" == 0xb0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7
, hmacSHA256 "Jefe" "what do ya want for nothing?" == 0x5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
] | pass =
~zero ==
[ hmacSHA256 [0x0b | _ <- [1..20] : [_][6]] "Hi There" == 0xb0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7
, hmacSHA256 "Jefe" "what do ya want for nothing?" == 0x5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
] | property | pass | examples.MiniLock.prim | examples/MiniLock/prim/HMAC.cry | [
"SHA256"
] | [
"==",
"hmacSHA256"
] | null | 38 | 42 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
hmacSHA256 : {pwBytes, msgBytes}
(fin pwBytes, fin msgBytes
, 32 >= width msgBytes
, 64 >= width (8*pwBytes)
) => [pwBytes][8] -> [msgBytes][8] -> [256]
hmacSHA256 = hmac `{blockLength=64} SHA256 SHA256 SHA256
// Due to limitations of the type system we must accept t... | hmacSHA256 : {pwBytes, msgBytes}
(fin pwBytes, fin msgBytes
, 32 >= width msgBytes
, 64 >= width (8*pwBytes)
) => [pwBytes][8] -> [msgBytes][8] -> [256] | hmacSHA256 = hmac `{blockLength=64} SHA256 SHA256 SHA256
// Due to limitations of the type system we must accept two
// separate arguments (both aledgedly the same) for two
// separate length inputs. | function | hmacSHA256 | examples.MiniLock.prim | examples/MiniLock/prim/HMAC.cry | [
"SHA256"
] | [
">=",
"SHA256",
"fin",
"hmac",
"width"
] | null | 9 | 13 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
hmac : { msgBytes, pwBytes, digest, blockLength }
( fin pwBytes, fin digest, fin blockLength
)
=> ([blockLength + msgBytes][8] -> [8*digest])
-> ([blockLength + digest][8] -> [8*digest])
-> ([pwBytes][8] -> [8*digest])
-> [pwBytes][8]
-> [msgBytes][8]
-> [digest*8]
hmac hash hash2 ... | hmac : { msgBytes, pwBytes, digest, blockLength }
( fin pwBytes, fin digest, fin blockLength
)
=> ([blockLength + msgBytes][8] -> [8*digest])
-> ([blockLength + digest][8] -> [8*digest])
-> ([pwBytes][8] -> [8*digest])
-> [pwBytes][8]
-> [msgBytes][8]
-> [digest*8] | hmac hash hash2 hash3 key message = hash2 (okey # internal)
where
ks : [blockLength][8]
ks = if `pwBytes > (`blockLength : [max (width pwBytes) (width blockLength)])
then take `{blockLength} (split (hash3 key) # (zero : [blockLength][8]))
else take `{blockLength} (key # (zero : [blockLength... | function | hmac | examples.MiniLock.prim | examples/MiniLock/prim/HMAC.cry | [
"SHA256"
] | [
"fin",
"ks",
"split",
"take",
"width",
"zero"
] | null | 19 | 27 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
littleendian_passes_tests =
(littleendian [ 0, 0, 0, 0] == 0x00000000) &&
(littleendian [ 86, 75, 30, 9] == 0x091e4b56) &&
(littleendian [255, 255, 255, 250] == 0xfaffffff) | littleendian_passes_tests =
(littleendian [ 0, 0, 0, 0] == 0x00000000) &&
(littleendian [ 86, 75, 30, 9] == 0x091e4b56) &&
(littleendian [255, 255, 255, 250] == 0xfaffffff) | property | littleendian_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/LittleEndian.cry | [] | [
"&&",
"==",
"littleendian"
] | null | 13 | 16 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
littleendian_is_invertable b = littleendian_inverse(littleendian b) == b | littleendian_is_invertable b = littleendian_inverse(littleendian b) == b | property | littleendian_is_invertable | examples.MiniLock.prim | examples/MiniLock/prim/LittleEndian.cry | [] | [
"==",
"littleendian",
"littleendian_inverse"
] | null | 21 | 21 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
littleendian : {a}(fin a) => [a][8] -> [a*8]
littleendian b = join(reverse b) | littleendian : {a}(fin a) => [a][8] -> [a*8] | littleendian b = join(reverse b) | function | littleendian | examples.MiniLock.prim | examples/MiniLock/prim/LittleEndian.cry | [] | [
"fin",
"join",
"reverse"
] | null | 10 | 10 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
littleendian_inverse : [32] -> [4][8]
littleendian_inverse b = reverse(split b) | littleendian_inverse : [32] -> [4][8] | littleendian_inverse b = reverse(split b) | function | littleendian_inverse | examples.MiniLock.prim | examples/MiniLock/prim/LittleEndian.cry | [] | [
"reverse",
"split"
] | null | 18 | 18 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_add : {n} (fin n) => ([n],[n],[n]) -> [n]
mod_add(p,x,y) = if c1 || ~c2 then r2 else r1
where
(r1,c1) = adc( x, y)
(r2,c2) = sbb(r1, p)
/* Subtract two numbers in normalized form. */ | mod_add : {n} (fin n) => ([n],[n],[n]) -> [n] | mod_add(p,x,y) = if c1 || ~c2 then r2 else r1
where
(r1,c1) = adc( x, y)
(r2,c2) = sbb(r1, p)
/* Subtract two numbers in normalized form. */ | function | mod_add | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"adc",
"fin",
"sbb",
"||"
] | null | 10 | 10 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_sub : {n} (fin n) => ([n],[n],[n]) -> [n]
mod_sub(p,x,y) = if b then r2 else r1
where
(r1,b) = sbb( x, y)
(r2,_) = adc(r1, p) | mod_sub : {n} (fin n) => ([n],[n],[n]) -> [n] | mod_sub(p,x,y) = if b then r2 else r1
where
(r1,b) = sbb( x, y)
(r2,_) = adc(r1, p) | function | mod_sub | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"adc",
"fin",
"sbb"
] | null | 17 | 17 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_neg : {n} (fin n) => ([n],[n]) -> [n]
mod_neg(p,x) = if x == 0 then 0 else (p - x) | mod_neg : {n} (fin n) => ([n],[n]) -> [n] | mod_neg(p,x) = if x == 0 then 0 else (p - x) | function | mod_neg | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"==",
"fin"
] | null | 23 | 23 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_half : {n} (fin n, n >= 1) => ([n],[n]) -> [n]
mod_half(p, x) = if even(x) then x >> 1
else take(safe_add(x, p))
where even y = (y && 1) == 0
/* Definition of modular multiplication. */ | mod_half : {n} (fin n, n >= 1) => ([n],[n]) -> [n] | mod_half(p, x) = if even(x) then x >> 1
else take(safe_add(x, p))
where even y = (y && 1) == 0
/* Definition of modular multiplication. */ | function | mod_half | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"&&",
"==",
">=",
">>",
"fin",
"safe_add",
"take"
] | null | 26 | 26 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_mul : {n} (fin n) => ([n],[n],[n]) -> [n]
mod_mul(p,x,y) = safe_mod(p, safe_product(x, y))
/* Returns x/y in F_p using Euler's binary gcd algorithm. */
/* Taken from [HMV] */ | mod_mul : {n} (fin n) => ([n],[n],[n]) -> [n] | mod_mul(p,x,y) = safe_mod(p, safe_product(x, y))
/* Returns x/y in F_p using Euler's binary gcd algorithm. */
/* Taken from [HMV] */ | function | mod_mul | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"fin",
"safe_mod",
"safe_product"
] | null | 32 | 32 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_div : {a} (fin a, a >= 1) => ([a],[a],[a]) -> [a]
mod_div(p,x,y) = egcd(p,0,y,x)
where
/* In code below, a is always odd. */
egcd(a,ra,b,rb) =
if b == 0 then
ra
else if (b && 1) == 0 then /* b is even. */
egcd(a, ra, b >> 1, mod_half(p, rb))
else if a < b then
egc... | mod_div : {a} (fin a, a >= 1) => ([a],[a],[a]) -> [a] | mod_div(p,x,y) = egcd(p,0,y,x)
where
/* In code below, a is always odd. */
egcd(a,ra,b,rb) =
if b == 0 then
ra
else if (b && 1) == 0 then /* b is even. */
egcd(a, ra, b >> 1, mod_half(p, rb))
else if a < b then
egcd(a, ra, (b - a) >> 1, mod_half(p, mod_sub(p, rb, ra))... | function | mod_div | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
"&&",
"==",
">=",
">>",
"fin",
"mod_half",
"mod_sub"
] | null | 37 | 37 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod_pow : {a} (fin a, a >= 1) => ([a] , [a] , [a]) -> [a]
mod_pow (p,x0,e0) = (results ! 0).2
where
results = [(x0,e0,1)] # [ (mod_mul (p,x,x), e>>1, if(e!0) then mod_mul(p,result,x) else result)
| (x,e,result) <- results | _ <- [0..a] :[_][width a] ] | mod_pow : {a} (fin a, a >= 1) => ([a] , [a] , [a]) -> [a] | mod_pow (p,x0,e0) = (results ! 0).2
where
results = [(x0,e0,1)] # [ (mod_mul (p,x,x), e>>1, if(e!0) then mod_mul(p,result,x) else result)
| (x,e,result) <- results | _ <- [0..a] :[_][width a] ] | function | mod_pow | examples.MiniLock.prim | examples/MiniLock/prim/mod_arith.cry | [
"bv"
] | [
">=",
"fin",
"mod_mul"
] | null | 51 | 51 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
test1 = pbkdf2 `{C=1,dkLenBits=64*8} "passwd" "salt" == 0x55ac046e56e3089fec1691c22544b605f94185216dde0465e68b9d57c20dacbc49ca9cccf179b645991664b39d77ef317c71b845b1e30bd509112041d3a19783 | test1 = pbkdf2 `{C=1,dkLenBits=64*8} "passwd" "salt" == 0x55ac046e56e3089fec1691c22544b605f94185216dde0465e68b9d57c20dacbc49ca9cccf179b645991664b39d77ef317c71b845b1e30bd509112041d3a19783 | property | test1 | examples.MiniLock.prim | examples/MiniLock/prim/PBKDF2.cry | [
"SHA256",
"HMAC"
] | [
"==",
"pbkdf2"
] | null | 46 | 46 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
pbkdf2 : {pwBytes, saltBytes, dkLenBits, C}
( 64 >= width (8 * pwBytes)
, dkLenBits >= 1
, fin dkLenBits
, C >= 1
, 16 >= width C
, 32 >= width (4 + saltBytes)
, 32 >= width ((dkLenBits + 255)/256)
)
=> [pwBytes][8] -> [saltBytes][8] -> [dkLe... | pbkdf2 : {pwBytes, saltBytes, dkLenBits, C}
( 64 >= width (8 * pwBytes)
, dkLenBits >= 1
, fin dkLenBits
, C >= 1
, 16 >= width C
, 32 >= width (4 + saltBytes)
, 32 >= width ((dkLenBits + 255)/256)
)
=> [pwBytes][8] -> [saltBytes][8] -> [dkLe... | pbkdf2 P S = take `{dkLenBits} (join Ts)
where
Ts : [_][256]
Ts = [ inner `{C=C} P (split (hmacSHA256 P (S # split i))) | i <- [1..len] : [_][32] ]
type len = (dkLenBits + 255)/256 | function | pbkdf2 | examples.MiniLock.prim | examples/MiniLock/prim/PBKDF2.cry | [
"SHA256",
"HMAC"
] | [
">=",
"fin",
"hmacSHA256",
"inner",
"join",
"split",
"take",
"width"
] | null | 11 | 20 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
inner : {pwBytes, C}
( 64 >= width (8 * pwBytes)
, C >= 1, 16 >= width C
)
=> [pwBytes][8] -> [32][8] -> [256]
inner P U0 = (Ts @ 0).0 // XXX should be ! 0
where
// Ts : [_][([256],[32][8])]
Ts = [(join U0, U0)] # [ F P t u | _ <- [1..C] : [_][16] | (t,u) <- Ts ] | inner : {pwBytes, C}
( 64 >= width (8 * pwBytes)
, C >= 1, 16 >= width C
)
=> [pwBytes][8] -> [32][8] -> [256] | inner P U0 = (Ts @ 0).0 // XXX should be ! 0
where
// Ts : [_][([256],[32][8])]
Ts = [(join U0, U0)] # [ F P t u | _ <- [1..C] : [_][16] | (t,u) <- Ts ] | function | inner | examples.MiniLock.prim | examples/MiniLock/prim/PBKDF2.cry | [
"SHA256",
"HMAC"
] | [
">=",
"join",
"width"
] | null | 27 | 31 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
F : {pwBytes} ( 64 >= width (8 * pwBytes)
) => [pwBytes][8] -> [256] -> [32][8] -> ([256],[32][8])
F P Tprev Uprev = (Tnext,Unext)
where
Unext = split (hmacSHA256 P Uprev)
Tnext = Tprev ^ join Unext | F : {pwBytes} ( 64 >= width (8 * pwBytes)
) => [pwBytes][8] -> [256] -> [32][8] -> ([256],[32][8]) | F P Tprev Uprev = (Tnext,Unext)
where
Unext = split (hmacSHA256 P Uprev)
Tnext = Tprev ^ join Unext | function | F | examples.MiniLock.prim | examples/MiniLock/prim/PBKDF2.cry | [
"SHA256",
"HMAC"
] | [
">=",
"hmacSHA256",
"join",
"split",
"width"
] | null | 37 | 38 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
test1 : Bit | test1 : Bit | function | test1 | examples.MiniLock.prim | examples/MiniLock/prim/PBKDF2.cry | [
"SHA256",
"HMAC"
] | [
"Bit"
] | null | 45 | 45 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
quarterround_passes_tests =
(quarterround [0x00000000, 0x00000000, 0x00000000, 0x00000000] == [0x00000000, 0x00000000, 0x00000000, 0x00000000]) /\
(quarterround [0x00000001, 0x00000000, 0x00000000, 0x00000000] == [0x08008145, 0x00000080, 0x00010200, 0x20500000]) /\
(quarterround [0x00000000, 0x00000001, 0x0000000... | quarterround_passes_tests =
(quarterround [0x00000000, 0x00000000, 0x00000000, 0x00000000] == [0x00000000, 0x00000000, 0x00000000, 0x00000000]) /\
(quarterround [0x00000001, 0x00000000, 0x00000000, 0x00000000] == [0x08008145, 0x00000080, 0x00010200, 0x20500000]) /\
(quarterround [0x00000000, 0x00000001, 0x0000000... | property | quarterround_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"/\\",
"==",
"quarterround"
] | null | 20 | 27 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rowround_passes_tests =
(rowround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000] ==
[0x08008145, 0x00000080, 0x00010200, ... | rowround_passes_tests =
(rowround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000] ==
[0x08008145, 0x00000080, 0x00010200, ... | property | rowround_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"/\\",
"==",
"rowround"
] | null | 38 | 54 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rowround_opt_is_rowround ys = rowround ys == rowround_opt ys | rowround_opt_is_rowround ys = rowround ys == rowround_opt ys | property | rowround_opt_is_rowround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"rowround",
"rowround_opt"
] | null | 60 | 60 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
columnround_passes_tests =
(columnround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000] ==
[0x10090288, 0x0000... | columnround_passes_tests =
(columnround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000001, 0x00000000, 0x00000000, 0x00000000] ==
[0x10090288, 0x0000... | property | columnround_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"/\\",
"==",
"columnround"
] | null | 71 | 87 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
columnround_is_transpose_of_rowround ys =
rowround ys == join(transpose(split`{4}(columnround xs)))
where xs = join(transpose(split`{4} ys)) | columnround_is_transpose_of_rowround ys =
rowround ys == join(transpose(split`{4}(columnround xs)))
where xs = join(transpose(split`{4} ys)) | property | columnround_is_transpose_of_rowround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"columnround",
"join",
"rowround",
"transpose",
"xs"
] | null | 95 | 97 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
doubleround_passes_tests =
(doubleround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000] ==
[0x8186a22d, 0x0040... | doubleround_passes_tests =
(doubleround [0x00000001, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000] ==
[0x8186a22d, 0x0040... | property | doubleround_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"/\\",
"==",
"doubleround"
] | null | 102 | 118 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Salsa20_bijective a b = (a == b) || (Salsa20 `{r=20} a != Salsa20 `{r=20} b) | Salsa20_bijective a b = (a == b) || (Salsa20 `{r=20} a != Salsa20 `{r=20} b) | property | Salsa20_bijective | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"!=",
"==",
"Salsa20",
"||"
] | null | 127 | 127 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Salsa20_passes_tests =
(Salsa20 `{r=20}
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
... | Salsa20_passes_tests =
(Salsa20 `{r=20}
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
... | property | Salsa20_passes_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"/\\",
"==",
"Salsa20"
] | null | 128 | 155 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Salsa20_has_no_collisions x1 x2 =
x1 == x2 \/ doubleround x1 != doubleround x2
// if(x1 != x2) then (doubleround x1) != (doubleround x2) else True | Salsa20_has_no_collisions x1 x2 =
x1 == x2 \/ doubleround x1 != doubleround x2
// if(x1 != x2) then (doubleround x1) != (doubleround x2) else True | property | Salsa20_has_no_collisions | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"!=",
"==",
"\\/",
"doubleround"
] | null | 157 | 159 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Salsa20_passes_scrypt_tests =
Salsa20 `{r=8}
[ 0x7e, 0x87, 0x9a, 0x21, 0x4f, 0x3e, 0xc9, 0x86, 0x7c, 0xa9, 0x40, 0xe6, 0x41, 0x71, 0x8f, 0x26
, 0xba, 0xee, 0x55, 0x5b, 0x8c, 0x61, 0xc1, 0xb5, 0x0d, 0xf8, 0x46, 0x11, 0x6d, 0xcd, 0x3b, 0x1d
, 0xee, 0x24, 0xf3, 0x19, 0xdf, 0x9b, 0x3d, 0x85,... | Salsa20_passes_scrypt_tests =
Salsa20 `{r=8}
[ 0x7e, 0x87, 0x9a, 0x21, 0x4f, 0x3e, 0xc9, 0x86, 0x7c, 0xa9, 0x40, 0xe6, 0x41, 0x71, 0x8f, 0x26
, 0xba, 0xee, 0x55, 0x5b, 0x8c, 0x61, 0xc1, 0xb5, 0x0d, 0xf8, 0x46, 0x11, 0x6d, 0xcd, 0x3b, 0x1d
, 0xee, 0x24, 0xf3, 0x19, 0xdf, 0x9b, 0x3d, 0x85,... | property | Salsa20_passes_scrypt_tests | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"Salsa20"
] | null | 161 | 174 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Key = [256/8][8] | Key = [256/8][8] | type | Key | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [] | null | 208 | 208 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Nonce = [192/8][8] | Nonce = [192/8][8] | type | Nonce | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [] | null | 209 | 209 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Counter = [64] | Counter = [64] | type | Counter | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [] | null | 210 | 210 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
test =
ct == [0x00, 0x2d, 0x45, 0x13, 0x84, 0x3f, 0xc2, 0x40, 0xc4, 0x01, 0xe5, 0x41]
where
ct = XSalsa20_encrypt `{r=20} key nonce "Hello world!"
key = "this is 32-byte key for xsalsa20"
nonce = "24-byte nonce for xsalsa" | test =
ct == [0x00, 0x2d, 0x45, 0x13, 0x84, 0x3f, 0xc2, 0x40, 0xc4, 0x01, 0xe5, 0x41]
where
ct = XSalsa20_encrypt `{r=20} key nonce "Hello world!"
key = "this is 32-byte key for xsalsa20"
nonce = "24-byte nonce for xsalsa" | property | test | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"XSalsa20_encrypt"
] | null | 244 | 249 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
theorem1 a = quarterround [a, -a, a, -a] == [a,-a,a,-a] | theorem1 a = quarterround [a, -a, a, -a] == [a,-a,a,-a] | property | theorem1 | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"quarterround"
] | null | 251 | 251 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
theorem2 a b c d = rowround val == val
where val = [a,-a,a,-a
,b,-b,b,-b
,c,-c,c,-c
,d,-d,d,-d] | theorem2 a b c d = rowround val == val
where val = [a,-a,a,-a
,b,-b,b,-b
,c,-c,c,-c
,d,-d,d,-d] | property | theorem2 | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"rowround"
] | null | 252 | 256 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
theorem3 a b c d = columnround val == val
where val = [a,-b,c,-d
,-a,b,-c,d
,a,-b,c,-d
,-a,b,-c,d] | theorem3 a b c d = columnround val == val
where val = [a,-b,c,-d
,-a,b,-c,d
,a,-b,c,-d
,-a,b,-c,d] | property | theorem3 | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"columnround"
] | null | 257 | 261 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
theorem4 a = doubleround val == val
where val = [a,-a,a,-a
,-a,a,-a,a
,a,-a,a,-a
,-a,a,-a,a] | theorem4 a = doubleround val == val
where val = [a,-a,a,-a
,-a,a,-a,a
,a,-a,a,-a
,-a,a,-a,a] | property | theorem4 | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"==",
"doubleround"
] | null | 262 | 266 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
theorem7 a b =
a ^ b != diff \/ Salsa20Words a == Salsa20Words b
where
diff = [ 0x80000000 | _ <- [0..15]:[_][4] ] | theorem7 a b =
a ^ b != diff \/ Salsa20Words a == Salsa20Words b
where
diff = [ 0x80000000 | _ <- [0..15]:[_][4] ] | property | theorem7 | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"!=",
"==",
"Salsa20Words",
"\\/"
] | null | 267 | 270 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
quarterround : [4][32] -> [4][32]
quarterround [y0, y1, y2, y3] = [z0, z1, z2, z3]
where
z1 = y1 ^ ((y0 + y3) <<< 0x7)
z2 = y2 ^ ((z1 + y0) <<< 0x9)
z3 = y3 ^ ((z2 + z1) <<< 0xd)
z0 = y0 ^ ((z3 + z2) <<< 0x12) | quarterround : [4][32] -> [4][32] | quarterround [y0, y1, y2, y3] = [z0, z1, z2, z3]
where
z1 = y1 ^ ((y0 + y3) <<< 0x7)
z2 = y2 ^ ((z1 + y0) <<< 0x9)
z3 = y3 ^ ((z2 + z1) <<< 0xd)
z0 = y0 ^ ((z3 + z2) <<< 0x12) | function | quarterround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"<<<"
] | null | 12 | 12 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
rowround : [16][32] -> [16][32]
rowround [y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15] =
[z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15]
where
[ z0, z1, z2, z3] = quarterround [ y0, y1, y2, y3]
[ z5, z6, z7, z4] = quarterround [ y5, y6, y7, y4]
... | rowround : [16][32] -> [16][32] | rowround [y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15] =
[z0, z1, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11, z12, z13, z14, z15]
where
[ z0, z1, z2, z3] = quarterround [ y0, y1, y2, y3]
[ z5, z6, z7, z4] = quarterround [ y5, y6, y7, y4]
[z10, z11, z8, z9] = quarte... | function | rowround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"quarterround"
] | null | 29 | 29 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
rowround_opt : [16][32] -> [16][32]
rowround_opt ys = join [ (quarterround (yi<<<i))>>>i | yi <- split ys | i <- [0 .. 3] : [_][8] ] | rowround_opt : [16][32] -> [16][32] | rowround_opt ys = join [ (quarterround (yi<<<i))>>>i | yi <- split ys | i <- [0 .. 3] : [_][8] ] | function | rowround_opt | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"join",
"quarterround",
"split"
] | null | 57 | 57 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
columnround : [16][32] -> [16][32]
columnround [x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15] =
[y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15]
where
[ y0, y4, y8, y12] = quarterround [ x0, x4, x8, x12]
[ y5, y9, y13, y1] = quarterround [ x5, x9, x13, ... | columnround : [16][32] -> [16][32] | columnround [x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15] =
[y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15]
where
[ y0, y4, y8, y12] = quarterround [ x0, x4, x8, x12]
[ y5, y9, y13, y1] = quarterround [ x5, x9, x13, x1]
[y10, y14, y2, y6] = qua... | function | columnround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"quarterround"
] | null | 62 | 62 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
columnround_opt : [16][32] -> [16][32]
columnround_opt xs = join (transpose [ (quarterround (xi<<<i))>>>i | xi <- transpose(split xs) | i <- [0 .. 3] : [_][8] ]) | columnround_opt : [16][32] -> [16][32] | columnround_opt xs = join (transpose [ (quarterround (xi<<<i))>>>i | xi <- transpose(split xs) | i <- [0 .. 3] : [_][8] ]) | function | columnround_opt | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"join",
"quarterround",
"split",
"transpose",
"xs"
] | null | 90 | 90 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
doubleround : [16][32] -> [16][32]
doubleround(xs) = rowround(columnround(xs)) | doubleround : [16][32] -> [16][32] | doubleround(xs) = rowround(columnround(xs)) | function | doubleround | examples.MiniLock.prim | examples/MiniLock/prim/Salsa20.cry | [
"LittleEndian"
] | [
"columnround",
"rowround",
"xs"
] | null | 99 | 99 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.