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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Node = { message : WorkBlock, state : State }
// Some encryption schemes process multiple blocks at once | Node = { message : WorkBlock, state : State }
// Some encryption schemes process multiple blocks at once | type | Node | examples | examples/AE.cry | [] | [
"State"
] | null | 34 | 36 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
WorkBlock = [p*n] | WorkBlock = [p*n] | type | WorkBlock | examples | examples/AE.cry | [] | [] | null | 37 | 37 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
State = [p*n] // The state for `p` blocks | State = [p*n] // The state for `p` blocks | type | State | examples | examples/AE.cry | [] | [] | null | 39 | 39 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Tweak = { nonce : Nonce, state : A, z : Int } | Tweak = { nonce : Nonce, state : A, z : Int } | type | Tweak | examples | examples/AE.cry | [] | [
"Int"
] | null | 41 | 41 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Nonce = [n]
/*
property
// The tweak in the `i`th query to the tweak_cipher
tweak_prop i { nonce = n, state = a, z = v } =
{ nonce = n, state = a, z = v + i - 1 }
// Property of decrypt
Dec_prop : Tweak -> Node -> Bit
Dec_prop t { message = m, state = x } =
Dec t { message = c, ... | Nonce = [n]
/*
property
// The tweak in the `i`th query to the tweak_cipher
tweak_prop i { nonce = n, state = a, z = v } =
{ nonce = n, state = a, z = v + i - 1 }
// Property of decrypt
Dec_prop : Tweak -> Node -> Bit
Dec_prop t { message = m, state = x } =
Dec t { message = c, ... | type | Nonce | examples | examples/AE.cry | [] | [] | null | 42 | 57 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Int = [64] | Int = [64] | type | Int | examples | examples/AE.cry | [] | [] | null | 59 | 59 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
encrypt :
{m} fin m => K -> Nonce -> A -> [m * (p * n)] -> [m * (p * n) + tagAmount]
encrypt key nonce state inputMsg = encMsg # tag
where
encMsg = join rest.0.message
tag = take (Tag key (tweak (1 - final.1)) final.0.state)
final = steps ! 0
steps = [ ({ message = undefined, state = zero }, 1) ] # rest... | encrypt :
{m} fin m => K -> Nonce -> A -> [m * (p * n)] -> [m * (p * n) + tagAmount] | encrypt key nonce state inputMsg = encMsg # tag
where
encMsg = join rest.0.message
tag = take (Tag key (tweak (1 - final.1)) final.0.state)
final = steps ! 0
steps = [ ({ message = undefined, state = zero }, 1) ] # rest
rest = [ (Enc key (tweak v) { message = m, state = prev.state }, v + Cost)
... | function | encrypt | examples | examples/AE.cry | [] | [
"Int",
"Nonce",
"Tweak",
"fin",
"join",
"split",
"take",
"zero"
] | null | 61 | 62 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AES128 = 4 | AES128 = 4 | type | AES128 | examples | examples/AES.cry | [] | [] | null | 15 | 15 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
AES192 = 6 | AES192 = 6 | type | AES192 | examples | examples/AES.cry | [] | [] | null | 16 | 16 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
AES256 = 8 | AES256 = 8 | type | AES256 | examples | examples/AES.cry | [] | [] | null | 17 | 17 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Nk = AES128
// For Cryptol 2.x | x > 0
// NkValid: `Nk -> Bit
// property NkValid k = (k == `AES128) || (k == `AES192) || (k == `AES256)
// Number of blocks and Number of rounds | Nk = AES128
// For Cryptol 2.x | x > 0
// NkValid: `Nk -> Bit
// property NkValid k = (k == `AES128) || (k == `AES192) || (k == `AES256)
// Number of blocks and Number of rounds | type | Nk | examples | examples/AES.cry | [] | [
"AES128"
] | null | 19 | 25 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Nb = 4 | Nb = 4 | type | Nb | examples | examples/AES.cry | [] | [] | null | 26 | 26 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Nr = 6 + Nk | Nr = 6 + Nk | type | Nr | examples | examples/AES.cry | [] | [
"Nk"
] | null | 27 | 27 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
AESKeySize = (Nk*32)
// Helper type definitions | AESKeySize = (Nk*32)
// Helper type definitions | type | AESKeySize | examples | examples/AES.cry | [] | [] | null | 29 | 31 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
GF28 = [8] | GF28 = [8] | type | GF28 | examples | examples/AES.cry | [] | [] | null | 32 | 32 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
State = [4][Nb]GF28 | State = [4][Nb]GF28 | type | State | examples | examples/AES.cry | [] | [] | null | 33 | 33 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
RoundKey = State | RoundKey = State | type | RoundKey | examples | examples/AES.cry | [] | [
"State"
] | null | 34 | 34 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
KeySchedule = (RoundKey, [Nr-1]RoundKey, RoundKey)
// GF28 operations | KeySchedule = (RoundKey, [Nr-1]RoundKey, RoundKey)
// GF28 operations | type | KeySchedule | examples | examples/AES.cry | [] | [
"RoundKey"
] | null | 35 | 36 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
AESCorrect msg key = aesDecrypt (aesEncrypt (msg, key), key) == msg | AESCorrect msg key = aesDecrypt (aesEncrypt (msg, key), key) == msg | property | AESCorrect | examples | examples/AES.cry | [] | [
"==",
"aesDecrypt",
"aesEncrypt"
] | null | 236 | 236 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
gf28Add : {n} (fin n) => [n]GF28 -> GF28
gf28Add ps = sums ! 0
where sums = [zero] # [ p ^ s | p <- ps | s <- sums ] | gf28Add : {n} (fin n) => [n]GF28 -> GF28 | gf28Add ps = sums ! 0
where sums = [zero] # [ p ^ s | p <- ps | s <- sums ] | function | gf28Add | examples | examples/AES.cry | [] | [
"GF28",
"fin",
"sums"
] | null | 37 | 37 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28Mult : (GF28, GF28) -> GF28
gf28Mult (x, y) = pmod(pmult x y) irreducible | gf28Mult : (GF28, GF28) -> GF28 | gf28Mult (x, y) = pmod(pmult x y) irreducible | function | gf28Mult | examples | examples/AES.cry | [] | [
"GF28",
"irreducible",
"pmod",
"pmult"
] | null | 43 | 43 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28Pow : (GF28, [8]) -> GF28
gf28Pow (n, k) = pow k
where sq x = gf28Mult (x, x)
odd x = x ! 0
pow i = if i == 0 then 1
else if odd i
then gf28Mult(n, sq (pow (i >> 1)))
else sq (pow (i >> 1)) | gf28Pow : (GF28, [8]) -> GF28 | gf28Pow (n, k) = pow k
where sq x = gf28Mult (x, x)
odd x = x ! 0
pow i = if i == 0 then 1
else if odd i
then gf28Mult(n, sq (pow (i >> 1)))
else sq (pow (i >> 1)) | function | gf28Pow | examples | examples/AES.cry | [] | [
"==",
">>",
"GF28",
"gf28Mult"
] | null | 46 | 46 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28Inverse : GF28 -> GF28
gf28Inverse x = gf28Pow (x, 254) | gf28Inverse : GF28 -> GF28 | gf28Inverse x = gf28Pow (x, 254) | function | gf28Inverse | examples | examples/AES.cry | [] | [
"GF28",
"gf28Pow"
] | null | 55 | 55 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28DotProduct : {n} (fin n) => ([n]GF28, [n]GF28) -> GF28
gf28DotProduct (xs, ys) = gf28Add [ gf28Mult (x, y) | x <- xs
| y <- ys ] | gf28DotProduct : {n} (fin n) => ([n]GF28, [n]GF28) -> GF28 | gf28DotProduct (xs, ys) = gf28Add [ gf28Mult (x, y) | x <- xs
| y <- ys ] | function | gf28DotProduct | examples | examples/AES.cry | [] | [
"GF28",
"fin",
"gf28Add",
"gf28Mult",
"xs"
] | null | 58 | 58 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28VectorMult : {n, m} (fin n) => ([n]GF28, [m][n]GF28) -> [m]GF28
gf28VectorMult (v, ms) = [ gf28DotProduct(v, m) | m <- ms ] | gf28VectorMult : {n, m} (fin n) => ([n]GF28, [m][n]GF28) -> [m]GF28 | gf28VectorMult (v, ms) = [ gf28DotProduct(v, m) | m <- ms ] | function | gf28VectorMult | examples | examples/AES.cry | [] | [
"fin",
"gf28DotProduct"
] | null | 62 | 62 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
gf28MatrixMult : {n, m, k} (fin m) => ([n][m]GF28, [m][k]GF28) -> [n][k]GF28
gf28MatrixMult (xss, yss) = [ gf28VectorMult(xs, yss') | xs <- xss ]
where yss' = transpose yss
// The affine transform and its inverse | gf28MatrixMult : {n, m, k} (fin m) => ([n][m]GF28, [m][k]GF28) -> [n][k]GF28 | gf28MatrixMult (xss, yss) = [ gf28VectorMult(xs, yss') | xs <- xss ]
where yss' = transpose yss
// The affine transform and its inverse | function | gf28MatrixMult | examples | examples/AES.cry | [] | [
"fin",
"gf28VectorMult",
"transpose",
"xs"
] | null | 65 | 65 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
xformByte : GF28 -> GF28
xformByte b = gf28Add [b, (b >>> 4), (b >>> 5), (b >>> 6), (b >>> 7), c]
where c = 0x63 | xformByte : GF28 -> GF28 | xformByte b = gf28Add [b, (b >>> 4), (b >>> 5), (b >>> 6), (b >>> 7), c]
where c = 0x63 | function | xformByte | examples | examples/AES.cry | [] | [
">>>",
"GF28",
"gf28Add"
] | null | 70 | 70 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
xformByte' : GF28 -> GF28
xformByte' b = gf28Add [(b >>> 2), (b >>> 5), (b >>> 7), d] where d = 0x05
// The SubBytes transform and its inverse | xformByte' : GF28 -> GF28 | xformByte' b = gf28Add [(b >>> 2), (b >>> 5), (b >>> 7), d] where d = 0x05
// The SubBytes transform and its inverse | function | xformByte' | examples | examples/AES.cry | [] | [
">>>",
"GF28",
"gf28Add"
] | null | 74 | 74 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
SubByte : GF28 -> GF28
SubByte b = xformByte (gf28Inverse b) | SubByte : GF28 -> GF28 | SubByte b = xformByte (gf28Inverse b) | function | SubByte | examples | examples/AES.cry | [] | [
"GF28",
"gf28Inverse",
"xformByte"
] | null | 77 | 77 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
SubByte' : GF28 -> GF28
SubByte' b = sbox@b | SubByte' : GF28 -> GF28 | SubByte' b = sbox@b | function | SubByte' | examples | examples/AES.cry | [] | [
"GF28",
"sbox"
] | null | 80 | 80 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
SubBytes : State -> State
SubBytes state = [ [ SubByte' b | b <- row ] | row <- state ] | SubBytes : State -> State | SubBytes state = [ [ SubByte' b | b <- row ] | row <- state ] | function | SubBytes | examples | examples/AES.cry | [] | [
"State",
"SubByte'"
] | null | 83 | 83 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
InvSubByte : GF28 -> GF28
InvSubByte b = gf28Inverse (xformByte' b) | InvSubByte : GF28 -> GF28 | InvSubByte b = gf28Inverse (xformByte' b) | function | InvSubByte | examples | examples/AES.cry | [] | [
"GF28",
"gf28Inverse",
"xformByte'"
] | null | 87 | 87 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
InvSubBytes : State -> State
InvSubBytes state = [ [ InvSubByte b | b <- row ] | row <- state ]
// The ShiftRows transform and its inverse | InvSubBytes : State -> State | InvSubBytes state = [ [ InvSubByte b | b <- row ] | row <- state ]
// The ShiftRows transform and its inverse | function | InvSubBytes | examples | examples/AES.cry | [] | [
"InvSubByte",
"State"
] | null | 90 | 90 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ShiftRows : State -> State
ShiftRows state = [ row <<< shiftAmount | row <- state
| shiftAmount <- [0 .. 3]
] | ShiftRows : State -> State | ShiftRows state = [ row <<< shiftAmount | row <- state
| shiftAmount <- [0 .. 3]
] | function | ShiftRows | examples | examples/AES.cry | [] | [
"<<<",
"State"
] | null | 94 | 94 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
InvShiftRows : State -> State
InvShiftRows state = [ row >>> shiftAmount | row <- state
| shiftAmount <- [0 .. 3]
]
// The MixColumns transform and its inverse | InvShiftRows : State -> State | InvShiftRows state = [ row >>> shiftAmount | row <- state
| shiftAmount <- [0 .. 3]
]
// The MixColumns transform and its inverse | function | InvShiftRows | examples | examples/AES.cry | [] | [
">>>",
"State"
] | null | 99 | 99 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
MixColumns : State -> State
MixColumns state = gf28MatrixMult (m, state)
where m = [[2, 3, 1, 1],
[1, 2, 3, 1],
[1, 1, 2, 3],
[3, 1, 1, 2]] | MixColumns : State -> State | MixColumns state = gf28MatrixMult (m, state)
where m = [[2, 3, 1, 1],
[1, 2, 3, 1],
[1, 1, 2, 3],
[3, 1, 1, 2]] | function | MixColumns | examples | examples/AES.cry | [] | [
"State",
"gf28MatrixMult"
] | null | 105 | 105 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
InvMixColumns : State -> State
InvMixColumns state = gf28MatrixMult (m, state)
where m = [[0x0e, 0x0b, 0x0d, 0x09],
[0x09, 0x0e, 0x0b, 0x0d],
[0x0d, 0x09, 0x0e, 0x0b],
[0x0b, 0x0d, 0x09, 0x0e]]
// The AddRoundKey transform | InvMixColumns : State -> State | InvMixColumns state = gf28MatrixMult (m, state)
where m = [[0x0e, 0x0b, 0x0d, 0x09],
[0x09, 0x0e, 0x0b, 0x0d],
[0x0d, 0x09, 0x0e, 0x0b],
[0x0b, 0x0d, 0x09, 0x0e]]
// The AddRoundKey transform | function | InvMixColumns | examples | examples/AES.cry | [] | [
"State",
"gf28MatrixMult"
] | null | 112 | 112 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AddRoundKey : (RoundKey, State) -> State
AddRoundKey (rk, s) = rk ^ s
// Key expansion | AddRoundKey : (RoundKey, State) -> State | AddRoundKey (rk, s) = rk ^ s
// Key expansion | function | AddRoundKey | examples | examples/AES.cry | [] | [
"State"
] | null | 120 | 120 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
Rcon : [8] -> [4]GF28
Rcon i = [(gf28Pow (<| x |>, i-1)), 0, 0, 0] | Rcon : [8] -> [4]GF28 | Rcon i = [(gf28Pow (<| x |>, i-1)), 0, 0, 0] | function | Rcon | examples | examples/AES.cry | [] | [
"gf28Pow"
] | null | 123 | 123 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
SubWord : [4]GF28 -> [4]GF28
SubWord bs = [ SubByte' b | b <- bs ] | SubWord : [4]GF28 -> [4]GF28 | SubWord bs = [ SubByte' b | b <- bs ] | function | SubWord | examples | examples/AES.cry | [] | [
"SubByte'"
] | null | 126 | 126 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
RotWord : [4]GF28 -> [4]GF28
RotWord [a0, a1, a2, a3] = [a1, a2, a3, a0] | RotWord : [4]GF28 -> [4]GF28 | RotWord [a0, a1, a2, a3] = [a1, a2, a3, a0] | function | RotWord | examples | examples/AES.cry | [] | [] | null | 129 | 129 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
NextWord : ([8],[4][8],[4][8]) -> [4][8]
NextWord(i, prev, old) = old ^ mask
where mask = if i % `Nk == 0
then SubWord(RotWord(prev)) ^ Rcon (i / `Nk)
else if (`Nk > 6) && (i % `Nk == 4)
then SubWord(prev)
else prev | NextWord : ([8],[4][8],[4][8]) -> [4][8] | NextWord(i, prev, old) = old ^ mask
where mask = if i % `Nk == 0
then SubWord(RotWord(prev)) ^ Rcon (i / `Nk)
else if (`Nk > 6) && (i % `Nk == 4)
then SubWord(prev)
else prev | function | NextWord | examples | examples/AES.cry | [] | [
"&&",
"==",
"Rcon",
"RotWord",
"SubWord"
] | null | 132 | 132 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ExpandKeyForever : [Nk][4][8] -> [inf]RoundKey
ExpandKeyForever seed = [ transpose g | g <- groupBy`{4} (keyWS seed) ] | ExpandKeyForever : [Nk][4][8] -> [inf]RoundKey | ExpandKeyForever seed = [ transpose g | g <- groupBy`{4} (keyWS seed) ] | function | ExpandKeyForever | examples | examples/AES.cry | [] | [
"keyWS",
"transpose"
] | null | 141 | 141 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
keyWS : [Nk][4][8] -> [inf][4][8]
keyWS seed = xs
where xs = seed # [ NextWord(i, prev, old)
| i <- [ `Nk ... ]
| prev <- drop`{Nk-1} xs
| old <- xs
] | keyWS : [Nk][4][8] -> [inf][4][8] | keyWS seed = xs
where xs = seed # [ NextWord(i, prev, old)
| i <- [ `Nk ... ]
| prev <- drop`{Nk-1} xs
| old <- xs
] | function | keyWS | examples | examples/AES.cry | [] | [
"NextWord",
"xs"
] | null | 144 | 144 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ExpandKey : [AESKeySize] -> KeySchedule
ExpandKey key = (keys @ 0, keys @@ [1 .. (Nr - 1)], keys @ `Nr)
where seed : [Nk][4][8]
seed = split (split key)
keys = ExpandKeyForever seed | ExpandKey : [AESKeySize] -> KeySchedule | ExpandKey key = (keys @ 0, keys @@ [1 .. (Nr - 1)], keys @ `Nr)
where seed : [Nk][4][8]
seed = split (split key)
keys = ExpandKeyForever seed | function | ExpandKey | examples | examples/AES.cry | [] | [
"ExpandKeyForever",
"KeySchedule",
"Nr",
"split"
] | null | 152 | 152 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
fromKS : KeySchedule -> [Nr+1][4][32]
fromKS (f, ms, l) = [ formKeyWords (transpose k) | k <- [f] # ms # [l] ]
where formKeyWords bbs = [ join bs | bs <- bbs ]
// AES rounds and inverses | fromKS : KeySchedule -> [Nr+1][4][32] | fromKS (f, ms, l) = [ formKeyWords (transpose k) | k <- [f] # ms # [l] ]
where formKeyWords bbs = [ join bs | bs <- bbs ]
// AES rounds and inverses | function | fromKS | examples | examples/AES.cry | [] | [
"KeySchedule",
"join",
"transpose"
] | null | 158 | 158 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AESRound : (RoundKey, State) -> State
AESRound (rk, s) = AddRoundKey (rk, MixColumns (ShiftRows (SubBytes s))) | AESRound : (RoundKey, State) -> State | AESRound (rk, s) = AddRoundKey (rk, MixColumns (ShiftRows (SubBytes s))) | function | AESRound | examples | examples/AES.cry | [] | [
"AddRoundKey",
"MixColumns",
"ShiftRows",
"State",
"SubBytes"
] | null | 163 | 163 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AESFinalRound : (RoundKey, State) -> State
AESFinalRound (rk, s) = AddRoundKey (rk, ShiftRows (SubBytes s)) | AESFinalRound : (RoundKey, State) -> State | AESFinalRound (rk, s) = AddRoundKey (rk, ShiftRows (SubBytes s)) | function | AESFinalRound | examples | examples/AES.cry | [] | [
"AddRoundKey",
"ShiftRows",
"State",
"SubBytes"
] | null | 166 | 166 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AESInvRound : (RoundKey, State) -> State
AESInvRound (rk, s) =
InvMixColumns (AddRoundKey (rk, InvSubBytes (InvShiftRows s))) | AESInvRound : (RoundKey, State) -> State | AESInvRound (rk, s) =
InvMixColumns (AddRoundKey (rk, InvSubBytes (InvShiftRows s))) | function | AESInvRound | examples | examples/AES.cry | [] | [
"AddRoundKey",
"InvMixColumns",
"InvShiftRows",
"InvSubBytes",
"State"
] | null | 169 | 169 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
AESFinalInvRound : (RoundKey, State) -> State
AESFinalInvRound (rk, s) = AddRoundKey (rk, InvSubBytes (InvShiftRows s))
// Converting a 128 bit message to a State and back | AESFinalInvRound : (RoundKey, State) -> State | AESFinalInvRound (rk, s) = AddRoundKey (rk, InvSubBytes (InvShiftRows s))
// Converting a 128 bit message to a State and back | function | AESFinalInvRound | examples | examples/AES.cry | [] | [
"AddRoundKey",
"InvShiftRows",
"InvSubBytes",
"State"
] | null | 172 | 172 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
msgToState : [128] -> State
msgToState msg = transpose (split (split msg)) | msgToState : [128] -> State | msgToState msg = transpose (split (split msg)) | function | msgToState | examples | examples/AES.cry | [] | [
"State",
"split",
"transpose"
] | null | 176 | 176 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
stateToMsg : State -> [128]
stateToMsg st = join (join (transpose st))
// AES Encryption | stateToMsg : State -> [128] | stateToMsg st = join (join (transpose st))
// AES Encryption | function | stateToMsg | examples | examples/AES.cry | [] | [
"State",
"join",
"transpose"
] | null | 179 | 179 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
aesEncrypt : ([128], [AESKeySize]) -> [128]
aesEncrypt (pt, key) = stateToMsg (AESFinalRound (kFinal, rounds ! 0))
where (kInit, ks, kFinal) = ExpandKey key
state0 = AddRoundKey(kInit, msgToState pt)
rounds = [state0] # [ AESRound (rk, s) | rk <- ks
... | aesEncrypt : ([128], [AESKeySize]) -> [128] | aesEncrypt (pt, key) = stateToMsg (AESFinalRound (kFinal, rounds ! 0))
where (kInit, ks, kFinal) = ExpandKey key
state0 = AddRoundKey(kInit, msgToState pt)
rounds = [state0] # [ AESRound (rk, s) | rk <- ks
| s <- rounds
... | function | aesEncrypt | examples | examples/AES.cry | [] | [
"AESFinalRound",
"AESRound",
"AddRoundKey",
"ExpandKey",
"ks",
"msgToState",
"stateToMsg"
] | null | 183 | 183 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
aesDecrypt : ([128], [AESKeySize]) -> [128]
aesDecrypt (ct, key) = stateToMsg (AESFinalInvRound (kFinal, rounds ! 0))
where (kFinal, ks, kInit) = ExpandKey key
state0 = AddRoundKey(kInit, msgToState ct)
rounds = [state0] # [ AESInvRound (rk, s)
| rk <- reverse ks
... | aesDecrypt : ([128], [AESKeySize]) -> [128] | aesDecrypt (ct, key) = stateToMsg (AESFinalInvRound (kFinal, rounds ! 0))
where (kFinal, ks, kInit) = ExpandKey key
state0 = AddRoundKey(kInit, msgToState ct)
rounds = [state0] # [ AESInvRound (rk, s)
| rk <- reverse ks
| s <- rounds
... | function | aesDecrypt | examples | examples/AES.cry | [] | [
"AESFinalInvRound",
"AESInvRound",
"AddRoundKey",
"ExpandKey",
"ks",
"msgToState",
"reverse",
"stateToMsg"
] | null | 192 | 192 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sbox : [256]GF28
sbox = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67,
0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59,
0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7,
0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1,
0x71, 0xd8, 0x31, 0x15, 0... | sbox : [256]GF28 | sbox = [
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67,
0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59,
0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7,
0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1,
0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, ... | function | sbox | examples | examples/AES.cry | [] | [] | null | 201 | 201 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
irreducible = <| x^^8 + x^^4 + x^^3 + x + 1 |> | irreducible = <| x^^8 + x^^4 + x^^3 + x + 1 |> | function | irreducible | examples | examples/AES.cry | [] | [] | null | 41 | 41 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
x : [_][8]
x = [1,2,3,4,5,19,12,38,5,3] | x : [_][8] | x = [1,2,3,4,5,19,12,38,5,3] | function | x | examples | examples/append.cry | [] | [] | null | 1 | 1 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
y : [_][8]
y = [19,3,27,5,12] | y : [_][8] | y = [19,3,27,5,12] | function | y | examples | examples/append.cry | [] | [] | null | 4 | 4 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
z = x # y | z = x # y | function | z | examples | examples/append.cry | [] | [] | null | 7 | 7 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
m = z @ (0 : [1]) //1 | m = z @ (0 : [1]) //1 | function | m | examples | examples/append.cry | [] | [] | null | 9 | 9 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
w = z @ 2 //3 | w = z @ 2 //3 | function | w | examples | examples/append.cry | [] | [] | null | 10 | 10 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t = z @ 10 //19 (0x13) | t = z @ 10 //19 (0x13) | function | t | examples | examples/append.cry | [] | [] | null | 12 | 12 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
v = z @ 11 //3 | v = z @ 11 //3 | function | v | examples | examples/append.cry | [] | [] | null | 13 | 13 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t : [8]
t = if True then 5 else 4 //5 | t : [8] | t = if True then 5 else 4 //5 | function | t | examples | examples/builtins.cry | [] | [
"True"
] | null | 4 | 4 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
f : [8]
f = if False then 3 else 5 //5 | f : [8] | f = if False then 3 else 5 //5 | function | f | examples | examples/builtins.cry | [] | [
"False"
] | null | 7 | 7 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
times : [8]
times = 5 * 1 * 2 * 3 //30 | times : [8] | times = 5 * 1 * 2 * 3 //30 | function | times | examples | examples/builtins.cry | [] | [] | null | 10 | 10 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
div : [8]
div = (((30/1)/2)/3) //5 | div : [8] | div = (((30/1)/2)/3) //5 | function | div | examples | examples/builtins.cry | [] | [] | null | 13 | 13 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mod : [8]
mod = 205%10 //5 | mod : [8] | mod = 205%10 //5 | function | mod | examples | examples/builtins.cry | [] | [] | null | 16 | 16 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
exp : [8]
exp = 2^^7 //128 | exp : [8] | exp = 2^^7 //128 | function | exp | examples | examples/builtins.cry | [] | [] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
lgtest : [8]
lgtest = lg2 128 //7 | lgtest : [8] | lgtest = lg2 128 //7 | function | lgtest | examples | examples/builtins.cry | [] | [
"lg2"
] | null | 22 | 22 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
p : [8]
p = 3+2 //5 | p : [8] | p = 3+2 //5 | function | p | examples | examples/builtins.cry | [] | [] | null | 25 | 25 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
m : [8]
m = 8-3 //5 | m : [8] | m = 8-3 //5 | function | m | examples | examples/builtins.cry | [] | [] | null | 28 | 28 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
neg : [8]
neg = -(-5) //5 | neg : [8] | neg = -(-5) //5 | function | neg | examples | examples/builtins.cry | [] | [] | null | 31 | 31 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
comp : [8]
comp = ~250 //5 | comp : [8] | comp = ~250 //5 | function | comp | examples | examples/builtins.cry | [] | [] | null | 34 | 34 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
p1 = x == (2 : [2])
//same thing written 2 different ways | p1 = x == (2 : [2])
//same thing written 2 different ways | property | p1 | examples | examples/builtin_lifting.cry | [] | [
"=="
] | null | 10 | 12 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p2 = x + y == 3 | p2 = x + y == 3 | property | p2 | examples | examples/builtin_lifting.cry | [] | [
"=="
] | null | 13 | 13 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p3 = x + y == [True,True] | p3 = x + y == [True,True] | property | p3 | examples | examples/builtin_lifting.cry | [] | [
"=="
] | null | 14 | 14 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p4 = xx + yy == [3]
//negation is a unary operator that also lifts over sequences | p4 = xx + yy == [3]
//negation is a unary operator that also lifts over sequences | property | p4 | examples | examples/builtin_lifting.cry | [] | [
"==",
"xx",
"yy"
] | null | 21 | 23 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p5 = ~ xx == yy | p5 = ~ xx == yy | property | p5 | examples | examples/builtin_lifting.cry | [] | [
"==",
"xx",
"yy"
] | null | 24 | 24 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p6 = (xinf + yinf) @ (0 : [0]) == (1 : [2])
//negation lifts pointwise over an infinite list | p6 = (xinf + yinf) @ (0 : [0]) == (1 : [2])
//negation lifts pointwise over an infinite list | property | p6 | examples | examples/builtin_lifting.cry | [] | [
"==",
"xinf",
"yinf"
] | null | 31 | 33 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p7 = (~ xinf) @ (0 : [0]) == (1 : [2]) | p7 = (~ xinf) @ (0 : [0]) == (1 : [2]) | property | p7 | examples | examples/builtin_lifting.cry | [] | [
"==",
"xinf"
] | null | 34 | 34 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p8 = xrec + xrec + xrec == xrec
//lift over tuples and records at the same time | p8 = xrec + xrec + xrec == xrec
//lift over tuples and records at the same time | property | p8 | examples | examples/builtin_lifting.cry | [] | [
"==",
"xrec"
] | null | 38 | 40 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p9 = (2,2,xrec) + (2,2,xrec) + (2,2,xrec) == (2:[2],2:[2],xrec)
//lift unary over tuples and lists | p9 = (2,2,xrec) + (2,2,xrec) + (2,2,xrec) == (2:[2],2:[2],xrec)
//lift unary over tuples and lists | property | p9 | examples | examples/builtin_lifting.cry | [] | [
"=="
] | null | 41 | 43 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
p10 = (~ { x = (1,2), y = [3,4,5] }) == {x = (0:[1],1:[2]), y = [4, 3, 2] : [3][3] } | p10 = (~ { x = (1,2), y = [3,4,5] }) == {x = (0:[1],1:[2]), y = [4, 3, 2] : [3][3] } | property | p10 | examples | examples/builtin_lifting.cry | [] | [
"=="
] | null | 44 | 44 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
x = [True,False] | x = [True,False] | function | x | examples | examples/builtin_lifting.cry | [] | [] | null | 6 | 6 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
y = [False,True]
//make sure bitvectors are numbers | y = [False,True]
//make sure bitvectors are numbers | function | y | examples | examples/builtin_lifting.cry | [] | [] | null | 7 | 9 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
xx = [[True,False]] | xx = [[True,False]] | function | xx | examples | examples/builtin_lifting.cry | [] | [] | null | 17 | 17 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
yy = [[False,True]]
//addition lifts pointwise over sequences | yy = [[False,True]]
//addition lifts pointwise over sequences | function | yy | examples | examples/builtin_lifting.cry | [] | [] | null | 18 | 20 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
xinf = [2 ... ] | xinf = [2 ... ] | function | xinf | examples | examples/builtin_lifting.cry | [] | [] | null | 27 | 27 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
yinf = [3 ... ]
//addition lifts pointwise over infinite lists | yinf = [3 ... ]
//addition lifts pointwise over infinite lists | function | yinf | examples | examples/builtin_lifting.cry | [] | [] | null | 28 | 30 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
xrec = { x = 2 : [2], y = 2 : [2] } : {x : [2], y : [2]} | xrec = { x = 2 : [2], y = 2 : [2] } : {x : [2], y : [2]} | function | xrec | examples | examples/builtin_lifting.cry | [] | [] | null | 36 | 36 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Cipher KeySize BlockSize =
{ encrypt : [KeySize] -> [BlockSize] -> [BlockSize]
, decrypt : [KeySize] -> [BlockSize] -> [BlockSize]
} | Cipher KeySize BlockSize =
{ encrypt : [KeySize] -> [BlockSize] -> [BlockSize]
, decrypt : [KeySize] -> [BlockSize] -> [BlockSize]
} | type | Cipher | examples | examples/Cipher.cry | [] | [
"decrypt",
"encrypt"
] | null | 8 | 11 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t1 = x @ 0 == (1,3,5,7) | t1 = x @ 0 == (1,3,5,7) | property | t1 | examples | examples/comp.cry | [] | [
"=="
] | null | 4 | 4 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t2 = x @ 2 == (2,3,5,9) | t2 = x @ 2 == (2,3,5,9) | property | t2 | examples | examples/comp.cry | [] | [
"=="
] | null | 5 | 5 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t3 = x @ 3 == (2,4,6,7) | t3 = x @ 3 == (2,4,6,7) | property | t3 | examples | examples/comp.cry | [] | [
"=="
] | null | 6 | 6 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
t4 = y @ 3 == (2,2,0) | t4 = y @ 3 == (2,2,0) | property | t4 | examples | examples/comp.cry | [] | [
"=="
] | null | 10 | 10 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
x : [_]([2],[3],[3],[4])
x = [(a,b,c,d) | a <- [1,2], b <- [3,4] | c <- [5,6], d <- [7,8,9] ] | x : [_]([2],[3],[3],[4]) | x = [(a,b,c,d) | a <- [1,2], b <- [3,4] | c <- [5,6], d <- [7,8,9] ] | function | x | examples | examples/comp.cry | [] | [] | null | 1 | 1 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
y = [(a,b,c) | a <- [1,2,3], b <- [1,2] | c <- [1 ... ] ] | y = [(a,b,c) | a <- [1,2,3], b <- [1,2] | c <- [1 ... ] ] | function | y | examples | examples/comp.cry | [] | [] | null | 8 | 8 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
x : {a}(fin a) => [a] -> [(a*2)+3]
x v = 0 + 1 | x : {a}(fin a) => [a] -> [(a*2)+3] | x v = 0 + 1 | function | x | examples | examples/demote.cry | [] | [
"fin"
] | null | 1 | 1 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
y = x (2 : [3]) | y = x (2 : [3]) | function | y | examples | examples/demote.cry | [] | [] | null | 4 | 4 | false | 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.