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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
test2 = take (ks "Wiki") == [0x60,0x44,0xDB,0x6D,0x41,0xB7] | test2 = take (ks "Wiki") == [0x60,0x44,0xDB,0x6D,0x41,0xB7] | property | test2 | examples.contrib | examples/contrib/RC4.cry | [] | [
"==",
"ks",
"take"
] | null | 39 | 39 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
test3 = take (ks "Secret") == [0x04,0xD4,0x6B,0x05,0x3C,0xA8,0x7B,0x59] | test3 = take (ks "Secret") == [0x04,0xD4,0x6B,0x05,0x3C,0xA8,0x7B,0x59] | property | test3 | examples.contrib | examples/contrib/RC4.cry | [] | [
"==",
"ks",
"take"
] | null | 40 | 40 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
swap : [256][8] -> [8] -> [8] -> [256][8]
swap s i j = [ s @ (if n == i then j else
if n == j then i else
n)
| n <- [0..255]
] | swap : [256][8] -> [8] -> [8] -> [256][8] | swap s i j = [ s @ (if n == i then j else
if n == j then i else
n)
| n <- [0..255]
] | function | swap | examples.contrib | examples/contrib/RC4.cry | [] | [
"=="
] | null | 3 | 3 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ksa_step : [inf][8] -> [8] -> [8] -> [256][8] -> ([8],[256][8])
ksa_step key i j s = (j', swap s i j')
where j' = j + s@i + key@i | ksa_step : [inf][8] -> [8] -> [8] -> [256][8] -> ([8],[256][8]) | ksa_step key i j s = (j', swap s i j')
where j' = j + s@i + key@i | function | ksa_step | examples.contrib | examples/contrib/RC4.cry | [] | [
"swap"
] | null | 10 | 10 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ksa : [inf][8] -> [256][8]
ksa key = (go ! 0).1 where
go : [257]([8],[256][8])
go = [(0,[0..255])] # [ ksa_step key i j s
| i <- [0..255]
| (j,s) <- go
] | ksa : [inf][8] -> [256][8] | ksa key = (go ! 0).1 where
go : [257]([8],[256][8])
go = [(0,[0..255])] # [ ksa_step key i j s
| i <- [0..255]
| (j,s) <- go
] | function | ksa | examples.contrib | examples/contrib/RC4.cry | [] | [
"ksa_step"
] | null | 14 | 14 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ks_step : [8] -> [8] -> [256][8] -> ([8],[256][8],[8])
ks_step i j s = (j',s',s@(s@i + s@j'))
where j' = j + s@i
s' = swap s i j' | ks_step : [8] -> [8] -> [256][8] -> ([8],[256][8],[8]) | ks_step i j s = (j',s',s@(s@i + s@j'))
where j' = j + s@i
s' = swap s i j' | function | ks_step | examples.contrib | examples/contrib/RC4.cry | [] | [
"swap"
] | null | 22 | 22 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ks key = [ k | (_,_,k) <- drop`{1} go ] where
go = [(0,ksa key',0)] # [ ks_step i j s
| i <- loop
| (j,s,k) <- go
]
key' = key # key'
loop = [1..255] # [0] # loop
///////
// "Test vectors" from wikipedia | ks key = [ k | (_,_,k) <- drop`{1} go ] where
go = [(0,ksa key',0)] # [ ks_step i j s
| i <- loop
| (j,s,k) <- go
]
key' = key # key'
loop = [1..255] # [0] # loop
///////
// "Test vectors" from wikipedia | function | ks | examples.contrib | examples/contrib/RC4.cry | [] | [
"ks_step"
] | null | 27 | 36 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
coinPuzzle : [10] -> [10] -> [10] -> [10] -> Bit
coinPuzzle a b c d = (coinCount a b c d 30) /\ (coinSum a b c d 109) | coinPuzzle : [10] -> [10] -> [10] -> [10] -> Bit | coinPuzzle a b c d = (coinCount a b c d 30) /\ (coinSum a b c d 109) | function | coinPuzzle | examples.funstuff | examples/funstuff/Coins.cry | [] | [
"/\\",
"Bit",
"coinCount",
"coinSum"
] | null | 5 | 5 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
coinSum : [10] -> [10] -> [10] -> [10] -> [10] -> Bit
coinSum a b c d s = (a + 5 * b + 10 * c + 25 * d) == s | coinSum : [10] -> [10] -> [10] -> [10] -> [10] -> Bit | coinSum a b c d s = (a + 5 * b + 10 * c + 25 * d) == s | function | coinSum | examples.funstuff | examples/funstuff/Coins.cry | [] | [
"==",
"Bit"
] | null | 8 | 8 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
coinCount : [10] -> [10] -> [10] -> [10] -> [10] -> Bit
coinCount a b c d s = (((a + b + c + d) == s) /\ // the coin count adds up
(a <= s /\ b <= s /\ c <= s /\ d <= s)) // and we don't wrap
// run it like this:
// :set satNum = all
// :sat coinPuzzle
// coinPuzzle 19 7 3 1 = True
// coinPuzzle... | coinCount : [10] -> [10] -> [10] -> [10] -> [10] -> Bit | coinCount a b c d s = (((a + b + c + d) == s) /\ // the coin count adds up
(a <= s /\ b <= s /\ c <= s /\ d <= s)) // and we don't wrap
// run it like this:
// :set satNum = all
// :sat coinPuzzle
// coinPuzzle 19 7 3 1 = True
// coinPuzzle 24 1 3 2 = True
// coinPuzzle 14 13 3 0 = True
// coinP... | function | coinCount | examples.funstuff | examples/funstuff/Coins.cry | [] | [
"/\\",
"<=",
"==",
"Bit"
] | null | 11 | 11 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
OneBank = [4] | OneBank = [4] | type | OneBank | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 8 | 8 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
BankState =
{left : OneBank
,right: OneBank
} | BankState =
{left : OneBank
,right: OneBank
} | type | BankState | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"OneBank"
] | null | 9 | 12 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
solutionInNmoves states = validMoveSequence ([startState] # states # [doneState]) | solutionInNmoves states = validMoveSequence ([startState] # states # [doneState]) | property | solutionInNmoves | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"validMoveSequence"
] | null | 26 | 26 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
StringRep = [7][8] | StringRep = [7][8] | type | StringRep | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 81 | 81 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
DirRep = [5][8] | DirRep = [5][8] | type | DirRep | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 82 | 82 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
solutionInNmoves : {n} (fin n) => [n] BankState -> Bit | solutionInNmoves : {n} (fin n) => [n] BankState -> Bit | function | solutionInNmoves | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"BankState",
"Bit",
"fin"
] | null | 25 | 25 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
validMoveSequence : {n} (fin n, n >= 1) => [n] BankState -> Bit
validMoveSequence states = all [validMove a b
| a <- states
| b <- drop`{1} states]
// Two states represent a valid move if they are both valid states (no carnage)
// and that whatever moved fo... | validMoveSequence : {n} (fin n, n >= 1) => [n] BankState -> Bit | validMoveSequence states = all [validMove a b
| a <- states
| b <- drop`{1} states]
// Two states represent a valid move if they are both valid states (no carnage)
// and that whatever moved followed the rules | function | validMoveSequence | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
">=",
"BankState",
"Bit",
"all",
"fin"
] | null | 28 | 28 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validMove : BankState -> BankState -> Bit
validMove b b' = validState b && validState b'
&& stuffOnlyMovedWithFarmer b b' | validMove : BankState -> BankState -> Bit | validMove b b' = validState b && validState b'
&& stuffOnlyMovedWithFarmer b b' | function | validMove | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"BankState",
"Bit",
"stuffOnlyMovedWithFarmer",
"validState"
] | null | 35 | 35 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
stuffOnlyMovedWithFarmer : BankState -> BankState -> Bit
stuffOnlyMovedWithFarmer b b' =
if farmerHere b.left
then farmerHere b'.right && moveFollowsRules b.left b'.right (b'.right - b.right)
else farmerHere b'.left && moveFollowsRules b.right b'.left (b'.left - b.left)
// things can't move without the fa... | stuffOnlyMovedWithFarmer : BankState -> BankState -> Bit | stuffOnlyMovedWithFarmer b b' =
if farmerHere b.left
then farmerHere b'.right && moveFollowsRules b.left b'.right (b'.right - b.right)
else farmerHere b'.left && moveFollowsRules b.right b'.left (b'.left - b.left)
// things can't move without the farmer, and the farmer can carry at most one thing | function | stuffOnlyMovedWithFarmer | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"BankState",
"Bit",
"farmerHere",
"moveFollowsRules"
] | null | 39 | 39 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
completeState : BankState -> Bit
completeState b = (b.left ^ b.right) == 0xf
// both banks are "carnage-free" | completeState : BankState -> Bit | completeState b = (b.left ^ b.right) == 0xf
// both banks are "carnage-free" | function | completeState | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"==",
"BankState",
"Bit"
] | null | 51 | 51 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validState : BankState -> Bit
validState bs = completeState bs && validBank bs.left
&& validBank bs.right && completeState bs | validState : BankState -> Bit | validState bs = completeState bs && validBank bs.left
&& validBank bs.right && completeState bs | function | validState | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"BankState",
"Bit",
"completeState",
"validBank"
] | null | 55 | 55 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validBank : OneBank -> Bit
validBank b = farmerHere b || (~(foxWithChicken b) && ~(chickenWithCorn b)) | validBank : OneBank -> Bit | validBank b = farmerHere b || (~(foxWithChicken b) && ~(chickenWithCorn b)) | function | validBank | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"Bit",
"OneBank",
"chickenWithCorn",
"farmerHere",
"foxWithChicken",
"||"
] | null | 59 | 59 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
farmerHere : OneBank -> Bit
farmerHere b = (b && farmer) > 0 | farmerHere : OneBank -> Bit | farmerHere b = (b && farmer) > 0 | function | farmerHere | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"Bit",
"OneBank",
"farmer"
] | null | 62 | 62 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
chickenWithCorn : OneBank -> Bit
chickenWithCorn b = (b && (corn || chicken)) == (corn || chicken) | chickenWithCorn : OneBank -> Bit | chickenWithCorn b = (b && (corn || chicken)) == (corn || chicken) | function | chickenWithCorn | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"==",
"Bit",
"OneBank",
"chicken",
"corn",
"||"
] | null | 65 | 65 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
foxWithChicken : OneBank -> Bit
foxWithChicken b = (b && (fox || chicken)) == (fox || chicken)
// utilities | foxWithChicken : OneBank -> Bit | foxWithChicken b = (b && (fox || chicken)) == (fox || chicken)
// utilities | function | foxWithChicken | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"==",
"Bit",
"OneBank",
"chicken",
"fox",
"||"
] | null | 68 | 68 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
all : {n} (fin n) => [n] -> Bit
all xs = xs == ~zero
// "population count" - how many bits are on | all : {n} (fin n) => [n] -> Bit | all xs = xs == ~zero
// "population count" - how many bits are on | function | all | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"==",
"Bit",
"fin",
"xs"
] | null | 72 | 72 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
popCount : {a} (fin a, a >= 1) => [a] -> [width a]
popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic]
// pretty printing | popCount : {a} (fin a, a >= 1) => [a] -> [width a] | popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic]
// pretty printing | function | popCount | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
">=",
"fin"
] | null | 76 | 76 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ppBits : [4] -> [4]StringRep
ppBits s = [ if b then ppArray!i else noString
| b <- s
| i <- [0 ...]:[_][4] ]
// takes a sequence of states and derives what moved, and in which direction for each transition | ppBits : [4] -> [4]StringRep | ppBits s = [ if b then ppArray!i else noString
| b <- s
| i <- [0 ...]:[_][4] ]
// takes a sequence of states and derives what moved, and in which direction for each transition | function | ppBits | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"noString"
] | null | 91 | 91 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
extractMoves : {a} [a+1]BankState -> [a](DirRep, [4]StringRep)
extractMoves bankStates = [ getMove b b' | b <- bankStates | b' <- drop`{1} bankStates ] where
getMove start end = ( dirString, thingsString thingsMoved ) where
dirString = if farmerHere start.left then " --> " else " <-- "
thingsMoved =... | extractMoves : {a} [a+1]BankState -> [a](DirRep, [4]StringRep) | extractMoves bankStates = [ getMove b b' | b <- bankStates | b' <- drop`{1} bankStates ] where
getMove start end = ( dirString, thingsString thingsMoved ) where
dirString = if farmerHere start.left then " --> " else " <-- "
thingsMoved = if farmerHere start.left
then end.right ... | function | extractMoves | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"farmerHere",
"ppBits",
"start"
] | null | 97 | 97 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
startState = { left = farmer || chicken || corn || fox, right = 0x0} | startState = { left = farmer || chicken || corn || fox, right = 0x0} | function | startState | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"chicken",
"corn",
"farmer",
"||"
] | null | 14 | 14 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
doneState = { left = 0x0, right = farmer || chicken || corn || fox} | doneState = { left = 0x0, right = farmer || chicken || corn || fox} | function | doneState | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"chicken",
"corn",
"farmer",
"fox",
"||"
] | null | 15 | 15 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
farmer = 0x1 | farmer = 0x1 | function | farmer | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 17 | 17 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
chicken = 0x2 | chicken = 0x2 | function | chicken | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 18 | 18 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
corn = 0x4 | corn = 0x4 | function | corn | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 19 | 19 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fox = 0x8
// To see this work, try:
// :sat solutionInNmoves : [6]BankState -> Bit | fox = 0x8
// To see this work, try:
// :sat solutionInNmoves : [6]BankState -> Bit | function | fox | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 20 | 23 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
moveFollowsRules fromBank toBank whatMoved = farmerMoved && atMostOneObjectMoved where
farmerMoved = (whatMoved && farmer) == farmer
atMostOneObjectMoved = popCount (whatMoved && ~farmer) <= 1
// "conservation of items" rule - nothing spontaneously disappears | moveFollowsRules fromBank toBank whatMoved = farmerMoved && atMostOneObjectMoved where
farmerMoved = (whatMoved && farmer) == farmer
atMostOneObjectMoved = popCount (whatMoved && ~farmer) <= 1
// "conservation of items" rule - nothing spontaneously disappears | function | moveFollowsRules | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [
"&&",
"<=",
"==",
"farmer",
"popCount"
] | null | 46 | 50 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
farmerString = "farmer " | farmerString = "farmer " | function | farmerString | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 83 | 83 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
chickenString = "chicken" | chickenString = "chicken" | function | chickenString | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 84 | 84 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
cornString = "corn " | cornString = "corn " | function | cornString | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 85 | 85 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
foxString = "fox " | foxString = "fox " | function | foxString | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 86 | 86 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
noString = " " | noString = " " | function | noString | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 87 | 87 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ppArray = [farmerString, chickenString, cornString, foxString] | ppArray = [farmerString, chickenString, cornString, foxString] | function | ppArray | examples.funstuff | examples/funstuff/FoxChickenCorn.cry | [] | [] | null | 89 | 89 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Board = [7][7]Bit | Board = [7][7]Bit | type | Board | examples.funstuff | examples/funstuff/marble.cry | [] | [] | null | 10 | 10 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
solutionInNmoves ms = validMoveSequence ([start] # ms # [second]) | solutionInNmoves ms = validMoveSequence ([start] # ms # [second]) | property | solutionInNmoves | examples.funstuff | examples/funstuff/marble.cry | [] | [
"validMoveSequence"
] | null | 107 | 107 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
all : {n} (fin n) => [n] -> Bit
all xs = xs == ~zero | all : {n} (fin n) => [n] -> Bit | all xs = xs == ~zero | function | all | examples.funstuff | examples/funstuff/marble.cry | [] | [
"==",
"Bit",
"fin",
"xs"
] | null | 12 | 12 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
popCount : {a} (fin a, a >= 1) => [a] -> [width a]
popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic] | popCount : {a} (fin a, a >= 1) => [a] -> [width a] | popCount bs = ic ! 0 where
ic = [0] # [ if elt then prev + 1 else prev | elt <- bs | prev <- ic] | function | popCount | examples.funstuff | examples/funstuff/marble.cry | [] | [
">=",
"fin"
] | null | 15 | 15 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
posns : Board
posns = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,True,True,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[False,... | posns : Board | posns = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,True,True,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[False,False,True,Tru... | function | posns | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Board"
] | null | 19 | 19 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
start : Board
start = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,False,True,True,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[False... | start : Board | start = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,False,True,True,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[False,False,True,Tr... | function | start | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Board"
] | null | 28 | 28 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
first : Board
first = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,False,False,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[Fals... | first : Board | first = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,False,False,True],
[True,True,True,True,True,True,True],
[False,True,True,True,True,True,False],
[False,False,True,T... | function | first | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Board"
] | null | 38 | 38 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
second : Board
second = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,True,False,True],
[True,True,True,True,False,True,True],
[False,True,True,True,False,True,False],
[F... | second : Board | second = [[False,False,True,True,True,False,False],
[False,True,True,True,True,True,False],
[True,True,True,True,True,True,True],
[True,True,True,True,True,False,True],
[True,True,True,True,False,True,True],
[False,True,True,True,False,True,False],
[False,False,True... | function | second | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Board"
] | null | 47 | 47 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
goal : Board
goal = [[False,False,False,False,False,False,False],
[False,False,False,True,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,Fals... | goal : Board | goal = [[False,False,False,False,False,False,False],
[False,False,False,True,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,False,False],
[False,False,False,False,False,False,False],
... | function | goal | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Board"
] | null | 56 | 56 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validBoard : Board -> Bit
validBoard b = join (b && ~posns) == zero | validBoard : Board -> Bit | validBoard b = join (b && ~posns) == zero | function | validBoard | examples.funstuff | examples/funstuff/marble.cry | [] | [
"&&",
"==",
"Bit",
"Board",
"join",
"zero"
] | null | 65 | 65 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validRowJump : Board -> Board -> Bit
validRowJump a a' = validBoard a
/\ validBoard a'
/\ validRowMove (differentRow a a') | validRowJump : Board -> Board -> Bit | validRowJump a a' = validBoard a
/\ validBoard a'
/\ validRowMove (differentRow a a') | function | validRowJump | examples.funstuff | examples/funstuff/marble.cry | [] | [
"/\\",
"Bit",
"Board",
"differentRow",
"validBoard",
"validRowMove"
] | null | 68 | 68 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
differentRow : Board -> Board -> ([7], [7])
differentRow a a' = rows ! 0
where rows = [(0b0000000,0b0000000)]
# [ if row != row' then (row,row') else old
| row <- a
| row' <- a'
| old <- rows ] | differentRow : Board -> Board -> ([7], [7]) | differentRow a a' = rows ! 0
where rows = [(0b0000000,0b0000000)]
# [ if row != row' then (row,row') else old
| row <- a
| row' <- a'
| old <- rows ] | function | differentRow | examples.funstuff | examples/funstuff/marble.cry | [] | [
"!=",
"Board"
] | null | 73 | 73 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validRowMove : ([7], [7]) -> Bit
validRowMove (r, r') = (xors == 0b0000111 \/
xors == 0b0001110 \/
xors == 0b0011100 \/
xors == 0b0111000 \/
xors == 0b1110000)
/\ (
rxors == 0b00... | validRowMove : ([7], [7]) -> Bit | validRowMove (r, r') = (xors == 0b0000111 \/
xors == 0b0001110 \/
xors == 0b0011100 \/
xors == 0b0111000 \/
xors == 0b1110000)
/\ (
rxors == 0b0000011 \/
... | function | validRowMove | examples.funstuff | examples/funstuff/marble.cry | [] | [
"&&",
"/\\",
"==",
"Bit",
"\\/"
] | null | 81 | 81 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validColJump : Board -> Board -> Bit
validColJump a a' = validRowJump (transpose a) (transpose a') | validColJump : Board -> Board -> Bit | validColJump a a' = validRowJump (transpose a) (transpose a') | function | validColJump | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Bit",
"Board",
"transpose",
"validRowJump"
] | null | 97 | 97 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validMove : Board -> Board -> Bit
validMove a a' = validRowJump a a' \/ validColJump a a' | validMove : Board -> Board -> Bit | validMove a a' = validRowJump a a' \/ validColJump a a' | function | validMove | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Bit",
"Board",
"\\/",
"validColJump",
"validRowJump"
] | null | 100 | 100 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
validMoveSequence : {n} (fin n, n >= 1) => [n] Board -> Bit
validMoveSequence moves = all [validMove a b | a <- moves | b <- drop`{1} moves] | validMoveSequence : {n} (fin n, n >= 1) => [n] Board -> Bit | validMoveSequence moves = all [validMove a b | a <- moves | b <- drop`{1} moves] | function | validMoveSequence | examples.funstuff | examples/funstuff/marble.cry | [] | [
">=",
"Bit",
"Board",
"all",
"fin"
] | null | 103 | 103 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
solutionInNmoves : {n} (fin n) => [n] Board -> Bit | solutionInNmoves : {n} (fin n) => [n] Board -> Bit | function | solutionInNmoves | examples.funstuff | examples/funstuff/marble.cry | [] | [
"Bit",
"Board",
"fin"
] | null | 106 | 106 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Position n = [width (n - 1)] | Position n = [width (n - 1)] | type | Position | examples.funstuff | examples/funstuff/NQueens.cry | [] | [] | null | 34 | 34 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Board n = [n](Position n) | Board n = [n](Position n) | type | Board | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"Position"
] | null | 36 | 36 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Solution n = Board n -> Bit | Solution n = Board n -> Bit | type | Solution | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"Bit",
"Board"
] | null | 38 | 38 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
nQueensProve x = (nQueens x) == False | nQueensProve x = (nQueens x) == False | property | nQueensProve | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"==",
"False",
"nQueens"
] | null | 56 | 56 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
all : {n, a} (fin n) => (a -> Bit, [n]a) -> Bit
all (f, xs) = [ f x | x <- xs ] == ~zero | all : {n, a} (fin n) => (a -> Bit, [n]a) -> Bit | all (f, xs) = [ f x | x <- xs ] == ~zero | function | all | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"==",
"Bit",
"fin",
"xs"
] | null | 21 | 21 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
distinct : {n,a} (fin n, Cmp a) => [n]a -> Bit
distinct xs =
[ if n1 < n2 then x != y else True
| (x,n1) <- numXs , (y,n2) <- numXs
] == ~zero
where
numXs = [ (x,n) | x <- xs | n <- [ (0:[width n]) ... ] ] | distinct : {n,a} (fin n, Cmp a) => [n]a -> Bit | distinct xs =
[ if n1 < n2 then x != y else True
| (x,n1) <- numXs , (y,n2) <- numXs
] == ~zero
where
numXs = [ (x,n) | x <- xs | n <- [ (0:[width n]) ... ] ] | function | distinct | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"!=",
"==",
"Bit",
"Cmp",
"True",
"fin",
"xs"
] | null | 26 | 26 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
checkDiag : {n} (fin n, n >= 1) => Board n -> (Position n, Position n) -> Bit
checkDiag qs (i, j) = (i >= j) || (diffR != diffC)
where qi = qs @ i
qj = qs @ j
diffR = if qi >= qj then qi-qj else qj-qi
diffC = j - i // we know i < j | checkDiag : {n} (fin n, n >= 1) => Board n -> (Position n, Position n) -> Bit | checkDiag qs (i, j) = (i >= j) || (diffR != diffC)
where qi = qs @ i
qj = qs @ j
diffR = if qi >= qj then qi-qj else qj-qi
diffC = j - i // we know i < j | function | checkDiag | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"!=",
">=",
"Bit",
"Board",
"Position",
"fin",
"||"
] | null | 40 | 40 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
nQueens : {n} (fin n, n >= 1) => Solution n
nQueens qs = all (inRange qs, qs) /\ all (checkDiag qs, ijs `{n}) /\ distinct qs | nQueens : {n} (fin n, n >= 1) => Solution n | nQueens qs = all (inRange qs, qs) /\ all (checkDiag qs, ijs `{n}) /\ distinct qs | function | nQueens | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"/\\",
">=",
"Solution",
"all",
"checkDiag",
"distinct",
"fin",
"ijs",
"inRange"
] | null | 47 | 47 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ijs : {n}(fin n, n>= 1)=> [_](Position n, Position n)
ijs = [ (i, j) | i <- [0 .. (n-1)], j <- [0 .. (n-1)]] | ijs : {n}(fin n, n>= 1)=> [_](Position n, Position n) | ijs = [ (i, j) | i <- [0 .. (n-1)], j <- [0 .. (n-1)]] | function | ijs | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"Position",
"fin"
] | null | 50 | 50 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
inRange : {n} (fin n, n >= 1) => Board n -> Position n -> Bit
inRange _qs x = x <= `(n - 1) | inRange : {n} (fin n, n >= 1) => Board n -> Position n -> Bit | inRange _qs x = x <= `(n - 1) | function | inRange | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"<=",
">=",
"Bit",
"Board",
"Position",
"fin"
] | null | 53 | 53 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
contains xs e = [ x == e | x <- xs ] != zero | contains xs e = [ x == e | x <- xs ] != zero | function | contains | examples.funstuff | examples/funstuff/NQueens.cry | [] | [
"!=",
"==",
"xs",
"zero"
] | null | 24 | 24 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
malicious_sha1_collision1 = eve1 != eve2 /\ bad_sha_eve1 == bad_sha_eve2
//hexdump malicious/eve1.sh | malicious_sha1_collision1 = eve1 != eve2 /\ bad_sha_eve1 == bad_sha_eve2
//hexdump malicious/eve1.sh | property | malicious_sha1_collision1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"!=",
"/\\",
"==",
"bad_sha_eve1",
"bad_sha_eve2",
"eve1",
"eve2"
] | null | 81 | 83 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
malicious_sha1_collision2 = eve1_galois != eve2_galois /\ bad_sha_eve_galois1 == bad_sha_eve_galois2 | malicious_sha1_collision2 = eve1_galois != eve2_galois /\ bad_sha_eve_galois1 == bad_sha_eve_galois2 | property | malicious_sha1_collision2 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"!=",
"/\\",
"==",
"bad_sha_eve_galois1",
"bad_sha_eve_galois2",
"eve1_galois",
"eve2_galois"
] | null | 114 | 114 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
all_same_hashes = bad_sha_eve_galois1 == bad_sha_eve1 /\ malicious_sha1_collision1 && malicious_sha1_collision2
/*
As a summary, a "1" followed by m "0"s followed by a 64-
bit integer are appended to the end of the message to produce a
padded message of length 512 * n. The 64-bit integer is the length
of the... | all_same_hashes = bad_sha_eve_galois1 == bad_sha_eve1 /\ malicious_sha1_collision1 && malicious_sha1_collision2
/*
As a summary, a "1" followed by m "0"s followed by a 64-
bit integer are appended to the end of the message to produce a
padded message of length 512 * n. The 64-bit integer is the length
of the... | property | all_same_hashes | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"&&",
"/\\",
"==",
"bad_sha_eve1",
"bad_sha_eve_galois1",
"malicious_sha1_collision1",
"malicious_sha1_collision2"
] | null | 116 | 124 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
malicious_sha1' : {chunks} (fin chunks) => [chunks][512] -> [4][32] -> [160]
malicious_sha1' pmsg k = join (Hs!0)
where
Hs = [[0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]] #
[ malicious_block (H, split(M)) k
| H <- Hs
| M <- pmsg
]
//hexdump of file available a... | malicious_sha1' : {chunks} (fin chunks) => [chunks][512] -> [4][32] -> [160] | malicious_sha1' pmsg k = join (Hs!0)
where
Hs = [[0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]] #
[ malicious_block (H, split(M)) k
| H <- Hs
| M <- pmsg
]
//hexdump of file available at http://malicioussha1.github.io/pocs/eve1.sh
//when executed will print an a... | function | malicious_sha1' | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"fin",
"join",
"malicious_block",
"split"
] | null | 25 | 25 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
pad : {msgLen}
( fin msgLen
, 64 >= width msgLen // message width fits in a word
)
=> [msgLen] -> [(msgLen + 65) /^ 512][512]
pad msg = split (msg # [True] # (zero:[(msgLen + 65) %^ 512]) # (`msgLen:[64])) | pad : {msgLen}
( fin msgLen
, 64 >= width msgLen // message width fits in a word
)
=> [msgLen] -> [(msgLen + 65) /^ 512][512] | pad msg = split (msg # [True] # (zero:[(msgLen + 65) %^ 512]) # (`msgLen:[64])) | function | pad | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
">=",
"fin",
"split",
"width"
] | null | 126 | 130 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
f : ([8], [32], [32], [32]) -> [32]
f (t, x, y, z) =
if (0 <= t) && (t <= 19) then (x && y) ^ (~x && z)
| (20 <= t) && (t <= 39) then x ^ y ^ z
| (40 <= t) && (t <= 59) then (x && y) ^ (x && z) ^ (y && z)
| (60 <= t) && (t <= 79) then x ^ y ^ z
else error "f: t out of range" | f : ([8], [32], [32], [32]) -> [32] | f (t, x, y, z) =
if (0 <= t) && (t <= 19) then (x && y) ^ (~x && z)
| (20 <= t) && (t <= 39) then x ^ y ^ z
| (40 <= t) && (t <= 59) then (x && y) ^ (x && z) ^ (y && z)
| (60 <= t) && (t <= 79) then x ^ y ^ z
else error "f: t out of range" | function | f | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"&&",
"<=",
"error"
] | null | 133 | 133 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
Ks : [4][32] -> [80][32]
Ks k = [ k@0 | t <- [0..19] ]
# [ k@1 | t <- [20..39] ]
# [ k@2 | t <- [40..59] ]
# [ k@3 | t <- [60..79] ] | Ks : [4][32] -> [80][32] | Ks k = [ k@0 | t <- [0..19] ]
# [ k@1 | t <- [20..39] ]
# [ k@2 | t <- [40..59] ]
# [ k@3 | t <- [60..79] ] | function | Ks | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 142 | 142 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
malicious_block : ([5][32], [16][32]) -> [4][32]-> [5][32]
malicious_block ([H0, H1, H2, H3, H4], M) k =
[(H0+As@80), (H1+Bs@80), (H2+Cs@80), (H3+Ds@80), (H4+Es@80)]
where
Ws : [80][32]
Ws = M # [ (W3 ^ W8 ^ W14 ^ W16) <<< 1
| W16 <- drop`{16 - 16} Ws
| W14 <- drop`{16 - 14} Ws
... | malicious_block : ([5][32], [16][32]) -> [4][32]-> [5][32] | malicious_block ([H0, H1, H2, H3, H4], M) k =
[(H0+As@80), (H1+Bs@80), (H2+Cs@80), (H3+Ds@80), (H4+Es@80)]
where
Ws : [80][32]
Ws = M # [ (W3 ^ W8 ^ W14 ^ W16) <<< 1
| W16 <- drop`{16 - 16} Ws
| W14 <- drop`{16 - 14} Ws
| W8 <- drop`{16 - 8} Ws
| W3 <- d... | function | malicious_block | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"<<<",
"Ks"
] | null | 148 | 148 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
malicious_sha1 msg k = malicious_sha1' rmsg k
where
rmsg = pad(join(reverse (groupBy`{8} (join (reverse eve1))))) | malicious_sha1 msg k = malicious_sha1' rmsg k
where
rmsg = pad(join(reverse (groupBy`{8} (join (reverse eve1))))) | function | malicious_sha1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"eve1",
"join",
"malicious_sha1'",
"pad",
"reverse"
] | null | 21 | 23 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
eve1 = [
0x1d23, 0x911b, 0x4034, 0xd809, 0x4d10, 0xd3a6, 0xe154, 0x2b10,
0x85b8, 0x5b12, 0x7847, 0xbd26, 0x37fd, 0xee2b, 0x50e6, 0x2c08,
0x4b75, 0x5716, 0x1138, 0xd8bf, 0xe0a5, 0x44b2, 0x941a, 0x2a51,
0x36cd, 0x04a2, 0xe2fe, 0x9f8a, 0x5532, 0xaa99, 0x7ab4, 0x82ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2d20, 0x... | eve1 = [
0x1d23, 0x911b, 0x4034, 0xd809, 0x4d10, 0xd3a6, 0xe154, 0x2b10,
0x85b8, 0x5b12, 0x7847, 0xbd26, 0x37fd, 0xee2b, 0x50e6, 0x2c08,
0x4b75, 0x5716, 0x1138, 0xd8bf, 0xe0a5, 0x44b2, 0x941a, 0x2a51,
0x36cd, 0x04a2, 0xe2fe, 0x9f8a, 0x5532, 0xaa99, 0x7ab4, 0x82ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2d20, 0x... | function | eve1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 36 | 57 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
eve2 = [
0x1d23, 0x921b, 0x4014, 0xac09, 0x4d98, 0xd3a6, 0xe1bc, 0x4910,
0x8570, 0x1812, 0x786f, 0xb926, 0x37bd, 0xac2b, 0x50ae, 0x6a08,
0x4bfd, 0x5516, 0x1138, 0xccbf, 0xe0ad, 0x46b2, 0x94ba, 0x7e51,
0x3645, 0x06a2, 0xe27e, 0x9f8a, 0x559a, 0xa999, 0x7a1c, 0xe2ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2d20, 0x... | eve2 = [
0x1d23, 0x921b, 0x4014, 0xac09, 0x4d98, 0xd3a6, 0xe1bc, 0x4910,
0x8570, 0x1812, 0x786f, 0xb926, 0x37bd, 0xac2b, 0x50ae, 0x6a08,
0x4bfd, 0x5516, 0x1138, 0xccbf, 0xe0ad, 0x46b2, 0x94ba, 0x7e51,
0x3645, 0x06a2, 0xe27e, 0x9f8a, 0x559a, 0xa999, 0x7a1c, 0xe2ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2d20, 0x... | function | eve2 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 58 | 76 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
malicious_k1 = [0x5a827999, 0x88e8ea68, 0x578059de, 0x54324a39] | malicious_k1 = [0x5a827999, 0x88e8ea68, 0x578059de, 0x54324a39] | function | malicious_k1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 77 | 77 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bad_sha_eve1 = malicious_sha1 eve1 malicious_k1 | bad_sha_eve1 = malicious_sha1 eve1 malicious_k1 | function | bad_sha_eve1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"eve1",
"malicious_k1",
"malicious_sha1"
] | null | 79 | 79 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bad_sha_eve2 = malicious_sha1 eve2 malicious_k1 | bad_sha_eve2 = malicious_sha1 eve2 malicious_k1 | function | bad_sha_eve2 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"eve2",
"malicious_k1",
"malicious_sha1"
] | null | 80 | 80 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
eve1_galois = [
0x1d23, 0x911b, 0x4034, 0xd809, 0x4d10, 0xd3a6, 0xe154, 0x2b10,
0x85b8, 0x5b12, 0x7847, 0xbd26, 0x37fd, 0xee2b, 0x50e6, 0x2c08,
0x4b75, 0x5716, 0x1138, 0xd8bf, 0xe0a5, 0x44b2, 0x941a, 0x2a51,
0x36cd, 0x04a2, 0xe2fe, 0x9f8a, 0x5532, 0xaa99, 0x7ab4, 0x82ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2... | eve1_galois = [
0x1d23, 0x911b, 0x4034, 0xd809, 0x4d10, 0xd3a6, 0xe154, 0x2b10,
0x85b8, 0x5b12, 0x7847, 0xbd26, 0x37fd, 0xee2b, 0x50e6, 0x2c08,
0x4b75, 0x5716, 0x1138, 0xd8bf, 0xe0a5, 0x44b2, 0x941a, 0x2a51,
0x36cd, 0x04a2, 0xe2fe, 0x9f8a, 0x5532, 0xaa99, 0x7ab4, 0x82ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2... | function | eve1_galois | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 84 | 97 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
eve2_galois = [
0x1d23, 0x921b, 0x4014, 0xac09, 0x4d98, 0xd3a6, 0xe1bc, 0x4910,
0x8570, 0x1812, 0x786f, 0xb926, 0x37bd, 0xac2b, 0x50ae, 0x6a08,
0x4bfd, 0x5516, 0x1138, 0xccbf, 0xe0ad, 0x46b2, 0x94ba, 0x7e51,
0x3645, 0x06a2, 0xe27e, 0x9f8a, 0x559a, 0xa999, 0x7a1c, 0xe2ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2... | eve2_galois = [
0x1d23, 0x921b, 0x4014, 0xac09, 0x4d98, 0xd3a6, 0xe1bc, 0x4910,
0x8570, 0x1812, 0x786f, 0xb926, 0x37bd, 0xac2b, 0x50ae, 0x6a08,
0x4bfd, 0x5516, 0x1138, 0xccbf, 0xe0ad, 0x46b2, 0x94ba, 0x7e51,
0x3645, 0x06a2, 0xe27e, 0x9f8a, 0x559a, 0xa999, 0x7a1c, 0xe2ed,
0x0a0a, 0x6669, 0x5b20, 0x6020, 0x646f, 0x2... | function | eve2_galois | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [] | null | 98 | 109 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bad_sha_eve_galois1 = malicious_sha1 eve1_galois malicious_k1 | bad_sha_eve_galois1 = malicious_sha1 eve1_galois malicious_k1 | function | bad_sha_eve_galois1 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"eve1_galois",
"malicious_k1",
"malicious_sha1"
] | null | 111 | 111 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
bad_sha_eve_galois2 = malicious_sha1 eve2_galois malicious_k1 | bad_sha_eve_galois2 = malicious_sha1 eve2_galois malicious_k1 | function | bad_sha_eve_galois2 | examples.maliciousSHA | examples/maliciousSHA/malicious_SHA1.cry | [] | [
"eve2_galois",
"malicious_k1",
"malicious_sha1"
] | null | 112 | 112 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
MinilockID = [46][8]
// Given a public key compute the ASCII ID | MinilockID = [46][8]
// Given a public key compute the ASCII ID | type | MinilockID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 12 | 14 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
kat_pub_id_eq = testPub == (decodeID testID).1 /\ encodeID testPub == testID /\ testID == testID_computed /\ testPriv == testPriv_computed | kat_pub_id_eq = testPub == (decodeID testID).1 /\ encodeID testPub == testID /\ testID == testID_computed /\ testPriv == testPriv_computed | property | kat_pub_id_eq | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
"/\\",
"==",
"decodeID",
"encodeID",
"testID",
"testID_computed",
"testPriv",
"testPriv_computed",
"testPub"
] | null | 75 | 75 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
encodeID : Public25519 -> MinilockID
encodeID pub = base58enc (join (pub # [h]))
where
h = blake2s `{nn=1} pub : [8] | encodeID : Public25519 -> MinilockID | encodeID pub = base58enc (join (pub # [h]))
where
h = blake2s `{nn=1} pub : [8] | function | encodeID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
"MinilockID",
"base58enc",
"blake2s",
"join"
] | null | 15 | 15 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
decodeID : MinilockID -> (Bit,Public25519)
decodeID ident = (hComp == hRecv, key)
where
bs = split (base58dec ident) : [33][8]
hRecv = bs ! 0
hComp = blake2s `{nn=1} key : [8]
key = take bs : [32][8]
// Accept a possibly-short key (base58 is value dependent encoding)
// and expand ... | decodeID : MinilockID -> (Bit,Public25519) | decodeID ident = (hComp == hRecv, key)
where
bs = split (base58dec ident) : [33][8]
hRecv = bs ! 0
hComp = blake2s `{nn=1} key : [8]
key = take bs : [32][8]
// Accept a possibly-short key (base58 is value dependent encoding)
// and expand it to the full, fixed, size. | function | decodeID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
"==",
"MinilockID",
"base58dec",
"blake2s",
"split",
"take"
] | null | 20 | 20 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mkFullLengthID : {n} (46 >= n, n>= 1) => [n][8] -> MinilockID
mkFullLengthID n = drop (['1' | _ <- [0..45] : [_][8]] # n) | mkFullLengthID : {n} (46 >= n, n>= 1) => [n][8] -> MinilockID | mkFullLengthID n = drop (['1' | _ <- [0..45] : [_][8]] # n) | function | mkFullLengthID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
">=",
"MinilockID",
"drop"
] | null | 30 | 30 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
mkID : {passBytes, saltBytes}
( fin passBytes, fin saltBytes
, 64 >= width passBytes
, 32 >= width (4*saltBytes)
)
=> [passBytes][8] -> [saltBytes][8] -> (MinilockID,Private25519)
mkID pw email = (encodeID pub,priv)
where
// XXX wait for cryptol 2.3: priv = SCrypt `{N=2^^17,r=8} (spl... | mkID : {passBytes, saltBytes}
( fin passBytes, fin saltBytes
, 64 >= width passBytes
, 32 >= width (4*saltBytes)
)
=> [passBytes][8] -> [saltBytes][8] -> (MinilockID,Private25519) | mkID pw email = (encodeID pub,priv)
where
// XXX wait for cryptol 2.3: priv = SCrypt `{N=2^^17,r=8} (split (blake2s `{nn=32} pw)) email
priv : Private25519
priv = SCrypt `{N=2^^1,r=8} (split (blake2s `{nn=32} pw)) email
// XXX we can't interpret N=2^^17 so this N value is a place holder...
pub = Curve25519... | function | mkID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
">=",
"SCrypt",
"blake2s",
"encodeID",
"fin",
"split",
"width"
] | null | 33 | 38 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
testID : MinilockID
testID = mkFullLengthID "28ZvW9rqRqvqpFTtHnusUntRqrxb4qqZAaNAd3QsqjSsXq" | testID : MinilockID | testID = mkFullLengthID "28ZvW9rqRqvqpFTtHnusUntRqrxb4qqZAaNAd3QsqjSsXq" | function | testID | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [
"MinilockID",
"mkFullLengthID"
] | null | 51 | 51 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
testPass = "some bears eat all the honey in the jar" | testPass = "some bears eat all the honey in the jar" | function | testPass | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 48 | 48 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
testEmail = "example@example.com" | testEmail = "example@example.com" | function | testEmail | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 49 | 49 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
testID_computed = "28ZvW9rqRqvqpFTtHnusUntRqrxb4qqZAaNAd3QsqjSsXq" // Computed on deathstar | testID_computed = "28ZvW9rqRqvqpFTtHnusUntRqrxb4qqZAaNAd3QsqjSsXq" // Computed on deathstar | function | testID_computed | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 54 | 54 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
testPriv_computed =
[0x12, 0x86, 0xe0, 0x18, 0xc6, 0x68, 0x34, 0x96, 0x09, 0x2e, 0x53,
0x32, 0x37, 0x76, 0x80, 0x3c, 0x30, 0xb4, 0x75, 0x2d, 0xd7, 0x70,
0xea, 0xa9, 0x6f, 0x0d, 0xda, 0x25, 0xc7, 0xfe, 0x28, 0x1f]
// Deathstar results:
// ([0x32, 0x38, 0x5a, 0x76, 0x57, 0x39, 0x72, 0x71, 0x52, 0x71, 0x76,
// ... | testPriv_computed =
[0x12, 0x86, 0xe0, 0x18, 0xc6, 0x68, 0x34, 0x96, 0x09, 0x2e, 0x53,
0x32, 0x37, 0x76, 0x80, 0x3c, 0x30, 0xb4, 0x75, 0x2d, 0xd7, 0x70,
0xea, 0xa9, 0x6f, 0x0d, 0xda, 0x25, 0xc7, 0xfe, 0x28, 0x1f]
// Deathstar results:
// ([0x32, 0x38, 0x5a, 0x76, 0x57, 0x39, 0x72, 0x71, 0x52, 0x71, 0x76,
// ... | function | testPriv_computed | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 55 | 71 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
testPriv = [0x12, 0x86, 0xe0, 0x18, 0xc6, 0x68, 0x34, 0x96, 0x09, 0x2e, 0x53, 0x32, 0x37, 0x76, 0x80, 0x3c, 0x30, 0xb4, 0x75, 0x2d, 0xd7, 0x70,0xea, 0xa9, 0x6f, 0x0d, 0xda, 0x25, 0xc7, 0xfe, 0x28, 0x1f] | testPriv = [0x12, 0x86, 0xe0, 0x18, 0xc6, 0x68, 0x34, 0x96, 0x09, 0x2e, 0x53, 0x32, 0x37, 0x76, 0x80, 0x3c, 0x30, 0xb4, 0x75, 0x2d, 0xd7, 0x70,0xea, 0xa9, 0x6f, 0x0d, 0xda, 0x25, 0xc7, 0xfe, 0x28, 0x1f] | function | testPriv | examples.MiniLock | examples/MiniLock/Keys.cry | [
"CfrgCurves",
"Blake2s",
"SCrypt",
"Base58"
] | [] | null | 72 | 72 | 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.