├── .cargo └── config ├── .gitignore ├── .gitmodules ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── bindings.rs ├── build.rs └── src ├── lib.rs └── main.rs /.cargo/config: -------------------------------------------------------------------------------- 1 | [target.x86_64-apple-darwin] 2 | linker = "gcc-8" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | .vscode 4 | 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libSTARK"] 2 | path = libSTARK 3 | url = git@github.com:LayerXcom/libSTARK.git 4 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "aho-corasick" 3 | version = "0.6.9" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "ansi_term" 11 | version = "0.11.0" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 15 | ] 16 | 17 | [[package]] 18 | name = "arrayvec" 19 | version = "0.4.10" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | dependencies = [ 22 | "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 23 | ] 24 | 25 | [[package]] 26 | name = "atty" 27 | version = "0.2.11" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | dependencies = [ 30 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 31 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 32 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 33 | ] 34 | 35 | [[package]] 36 | name = "bindgen" 37 | version = "0.42.3" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | dependencies = [ 40 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 42 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 43 | "clang-sys 0.26.3 (registry+https://github.com/rust-lang/crates.io-index)", 44 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 45 | "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", 46 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 47 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 48 | "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 51 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 52 | "which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 53 | ] 54 | 55 | [[package]] 56 | name = "bitflags" 57 | version = "1.0.4" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | 60 | [[package]] 61 | name = "cc" 62 | version = "1.0.28" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | dependencies = [ 65 | "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 66 | ] 67 | 68 | [[package]] 69 | name = "cexpr" 70 | version = "0.3.3" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | dependencies = [ 73 | "nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 74 | ] 75 | 76 | [[package]] 77 | name = "cfg-if" 78 | version = "0.1.6" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | 81 | [[package]] 82 | name = "clang-sys" 83 | version = "0.26.3" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | dependencies = [ 86 | "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 87 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 89 | ] 90 | 91 | [[package]] 92 | name = "clap" 93 | version = "2.32.0" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | dependencies = [ 96 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 97 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 98 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 100 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 101 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 102 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 103 | ] 104 | 105 | [[package]] 106 | name = "crossbeam-deque" 107 | version = "0.2.0" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | dependencies = [ 110 | "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 111 | "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 112 | ] 113 | 114 | [[package]] 115 | name = "crossbeam-epoch" 116 | version = "0.3.1" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | dependencies = [ 119 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 120 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 121 | "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 122 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 123 | "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 124 | "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 125 | "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 126 | ] 127 | 128 | [[package]] 129 | name = "crossbeam-utils" 130 | version = "0.2.2" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | dependencies = [ 133 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 134 | ] 135 | 136 | [[package]] 137 | name = "either" 138 | version = "1.5.0" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | 141 | [[package]] 142 | name = "env_logger" 143 | version = "0.5.13" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | dependencies = [ 146 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 147 | "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 148 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 149 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 150 | "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 151 | ] 152 | 153 | [[package]] 154 | name = "glob" 155 | version = "0.2.11" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | 158 | [[package]] 159 | name = "heck" 160 | version = "0.3.1" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | dependencies = [ 163 | "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 164 | ] 165 | 166 | [[package]] 167 | name = "humantime" 168 | version = "1.2.0" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | dependencies = [ 171 | "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 172 | ] 173 | 174 | [[package]] 175 | name = "lazy_static" 176 | version = "1.2.0" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | 179 | [[package]] 180 | name = "libc" 181 | version = "0.2.45" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | 184 | [[package]] 185 | name = "libloading" 186 | version = "0.5.0" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | dependencies = [ 189 | "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", 190 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 191 | ] 192 | 193 | [[package]] 194 | name = "libstark_rs" 195 | version = "0.1.0" 196 | dependencies = [ 197 | "bindgen 0.42.3 (registry+https://github.com/rust-lang/crates.io-index)", 198 | "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", 199 | "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 200 | "structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", 201 | ] 202 | 203 | [[package]] 204 | name = "log" 205 | version = "0.4.6" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | dependencies = [ 208 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 209 | ] 210 | 211 | [[package]] 212 | name = "memchr" 213 | version = "2.1.2" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | dependencies = [ 216 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 217 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 218 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 219 | ] 220 | 221 | [[package]] 222 | name = "memoffset" 223 | version = "0.2.1" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | 226 | [[package]] 227 | name = "nodrop" 228 | version = "0.1.13" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | 231 | [[package]] 232 | name = "nom" 233 | version = "4.1.1" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | dependencies = [ 236 | "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 237 | ] 238 | 239 | [[package]] 240 | name = "num_cpus" 241 | version = "1.9.0" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | dependencies = [ 244 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 245 | ] 246 | 247 | [[package]] 248 | name = "peeking_take_while" 249 | version = "0.1.2" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | 252 | [[package]] 253 | name = "proc-macro2" 254 | version = "0.3.5" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | dependencies = [ 257 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 258 | ] 259 | 260 | [[package]] 261 | name = "proc-macro2" 262 | version = "0.4.24" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | dependencies = [ 265 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 266 | ] 267 | 268 | [[package]] 269 | name = "quick-error" 270 | version = "1.2.2" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | 273 | [[package]] 274 | name = "quote" 275 | version = "0.5.2" 276 | source = "registry+https://github.com/rust-lang/crates.io-index" 277 | dependencies = [ 278 | "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 279 | ] 280 | 281 | [[package]] 282 | name = "quote" 283 | version = "0.6.10" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | dependencies = [ 286 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 287 | ] 288 | 289 | [[package]] 290 | name = "rayon" 291 | version = "1.0.3" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | dependencies = [ 294 | "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 295 | "either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 296 | "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", 297 | ] 298 | 299 | [[package]] 300 | name = "rayon-core" 301 | version = "1.4.1" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | dependencies = [ 304 | "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 305 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 306 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 307 | "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 308 | ] 309 | 310 | [[package]] 311 | name = "redox_syscall" 312 | version = "0.1.44" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | 315 | [[package]] 316 | name = "redox_termios" 317 | version = "0.1.1" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | dependencies = [ 320 | "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", 321 | ] 322 | 323 | [[package]] 324 | name = "regex" 325 | version = "1.1.0" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | dependencies = [ 328 | "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 330 | "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 332 | "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 333 | ] 334 | 335 | [[package]] 336 | name = "regex-syntax" 337 | version = "0.6.4" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | dependencies = [ 340 | "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 341 | ] 342 | 343 | [[package]] 344 | name = "scopeguard" 345 | version = "0.3.3" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | 348 | [[package]] 349 | name = "strsim" 350 | version = "0.7.0" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | 353 | [[package]] 354 | name = "structopt" 355 | version = "0.2.14" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | dependencies = [ 358 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 359 | "structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", 360 | ] 361 | 362 | [[package]] 363 | name = "structopt-derive" 364 | version = "0.2.14" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | dependencies = [ 367 | "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 368 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 369 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 370 | "syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)", 371 | ] 372 | 373 | [[package]] 374 | name = "syn" 375 | version = "0.15.23" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | dependencies = [ 378 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 379 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 380 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 381 | ] 382 | 383 | [[package]] 384 | name = "termcolor" 385 | version = "1.0.4" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | dependencies = [ 388 | "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 389 | ] 390 | 391 | [[package]] 392 | name = "termion" 393 | version = "1.5.1" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | dependencies = [ 396 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 397 | "redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", 398 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 399 | ] 400 | 401 | [[package]] 402 | name = "textwrap" 403 | version = "0.10.0" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | dependencies = [ 406 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 407 | ] 408 | 409 | [[package]] 410 | name = "thread_local" 411 | version = "0.3.6" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | dependencies = [ 414 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 415 | ] 416 | 417 | [[package]] 418 | name = "ucd-util" 419 | version = "0.1.3" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | 422 | [[package]] 423 | name = "unicode-segmentation" 424 | version = "1.2.1" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | 427 | [[package]] 428 | name = "unicode-width" 429 | version = "0.1.5" 430 | source = "registry+https://github.com/rust-lang/crates.io-index" 431 | 432 | [[package]] 433 | name = "unicode-xid" 434 | version = "0.1.0" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | 437 | [[package]] 438 | name = "utf8-ranges" 439 | version = "1.0.2" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | 442 | [[package]] 443 | name = "vec_map" 444 | version = "0.8.1" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | 447 | [[package]] 448 | name = "version_check" 449 | version = "0.1.5" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | 452 | [[package]] 453 | name = "which" 454 | version = "1.0.5" 455 | source = "registry+https://github.com/rust-lang/crates.io-index" 456 | dependencies = [ 457 | "libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", 458 | ] 459 | 460 | [[package]] 461 | name = "winapi" 462 | version = "0.3.6" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | dependencies = [ 465 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 466 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 467 | ] 468 | 469 | [[package]] 470 | name = "winapi-i686-pc-windows-gnu" 471 | version = "0.4.0" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | 474 | [[package]] 475 | name = "winapi-util" 476 | version = "0.1.1" 477 | source = "registry+https://github.com/rust-lang/crates.io-index" 478 | dependencies = [ 479 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 480 | ] 481 | 482 | [[package]] 483 | name = "winapi-x86_64-pc-windows-gnu" 484 | version = "0.4.0" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | 487 | [[package]] 488 | name = "wincolor" 489 | version = "1.0.1" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | dependencies = [ 492 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 493 | "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 494 | ] 495 | 496 | [metadata] 497 | "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" 498 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 499 | "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" 500 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 501 | "checksum bindgen 0.42.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e0f199ccbabf5e9f9e13a3096534e80c9ce37aee440789dafaa47190e283245c" 502 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 503 | "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" 504 | "checksum cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b" 505 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 506 | "checksum clang-sys 0.26.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b5ca71038e58142b85c1b4f06a61f3b7a6e3ca035330a249f80164d37ea44de0" 507 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 508 | "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3" 509 | "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150" 510 | "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" 511 | "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" 512 | "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" 513 | "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" 514 | "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 515 | "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" 516 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" 517 | "checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74" 518 | "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" 519 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" 520 | "checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" 521 | "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" 522 | "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" 523 | "checksum nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a" 524 | "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" 525 | "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" 526 | "checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" 527 | "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" 528 | "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" 529 | "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" 530 | "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 531 | "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473" 532 | "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356" 533 | "checksum redox_syscall 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "a84bcd297b87a545980a2d25a0beb72a1f490c31f0a9fde52fca35bfbb1ceb70" 534 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 535 | "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" 536 | "checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" 537 | "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" 538 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 539 | "checksum structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "670ad348dc73012fcf78c71f06f9d942232cdd4c859d4b6975e27836c3efc0c3" 540 | "checksum structopt-derive 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ef98172b1a00b0bec738508d3726540edcbd186d50dfd326f2b1febbb3559f04" 541 | "checksum syn 0.15.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9545a6a093a3f0bd59adb472700acc08cad3776f860f16a897dfce8c88721cbc" 542 | "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" 543 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 544 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 545 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 546 | "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" 547 | "checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" 548 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 549 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 550 | "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" 551 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 552 | "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 553 | "checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2" 554 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 555 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 556 | "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" 557 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 558 | "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" 559 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libstark_rs" 3 | version = "0.1.0" 4 | authors = ["osuke "] 5 | edition = "2018" 6 | links = "libomp" 7 | build = "build.rs" 8 | 9 | [lib] 10 | name = "stark_rs" 11 | 12 | [dependencies] 13 | structopt="0.2" 14 | 15 | [build-dependencies] 16 | bindgen = "0.42.2" 17 | cc = { version = "1.0.28", features = ["parallel"] } 18 | glob = "0.2" 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Osuke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # stark-rust 2 | zk-STARK for fibonacci sequence in Rust 3 | 4 | ## How it works 5 | This library is based on libSTARK developed by [StarkWare Industries Ltd.](https://www.starkware.co/) 6 | On top of it, [the c++ wrapper](https://github.com/LayerXcom/libSTARK/tree/libstark-rs/fsrs) 7 | is implemented for simple FFI with this Rust library. 8 | These make it possible to call functions of STARK execution from Rust. 9 | 10 | More information about zk-STARK and libSTARK is in [here](https://github.com/elibensasson/libSTARK). 11 | 12 | ## Setup on macOS 13 | Before building, you may need to retrieve the source code of the wrapper implementation. 14 | ``` 15 | $ git submodule update --init --recursive 16 | ``` 17 | Install dependencies for compilation 18 | ``` 19 | $ brew install libomp gcc 20 | ``` 21 | Install Rust 22 | ``` 23 | $ curl https://sh.rustup.rs -sSf | sh 24 | $ source ~/.cargo/env 25 | ``` 26 | 27 | ## How to run the code 28 | Arguments format: 29 | ``` 30 | $ cargo run 31 | ``` 32 | 33 | for exmaple: 34 | ``` 35 | $ cargo run 52 9 36 | ``` 37 | The above execution results in execution of STARK simulation over the fibonacchi sequence.The statement is "I know secret numbers A, B such that the 5th element of the Fibonacci sequence is 131. They are A=52, B=9" 38 | 39 | ## References 40 | 1. Scalable, transparent, and post-quantum secure computational integrity. 41 | -------------------------------------------------------------------------------- /bindings.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)] 4 | pub mod root { 5 | #[allow(unused_imports)] 6 | use self::super::root; 7 | extern "C" { 8 | pub fn execute( 9 | a: ::std::os::raw::c_uint, 10 | b: ::std::os::raw::c_uint, 11 | securityParameter: ::std::os::raw::c_uint, 12 | ); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_snake_case)] 2 | 3 | extern crate glob; 4 | extern crate cc; 5 | extern crate bindgen; 6 | 7 | use glob::glob; 8 | use std::env; 9 | use std::path::PathBuf; 10 | 11 | fn main() { 12 | let stark = glob("./libSTARK/libstark/src/**/*.cpp").unwrap().map(|e| e.unwrap()).into_iter(); 13 | let algebralib = glob("./libSTARK/algebra/algebralib/**/*.cpp").unwrap().map(|e| e.unwrap()).into_iter(); 14 | let FFT = glob("./libSTARK/algebra/FFT/**/*.cpp").unwrap().map(|e| e.unwrap()).into_iter(); 15 | let fsrs = glob("./libSTARK/fsrs/**/*.cpp").unwrap().map(|e| e.unwrap()).into_iter(); 16 | 17 | cc::Build::new() 18 | .cpp(true) 19 | .flag("-xc++") 20 | .flag("-std=c++11") 21 | .flag("-O3") 22 | .flag("-g") 23 | .flag("-w") 24 | .flag("-Wall") 25 | .flag("-fmessage-length=0") 26 | .flag("-openmp") 27 | .flag("-maes") 28 | .flag("-msse4") 29 | .flag("-mtune=native") 30 | .flag("-Isrc") 31 | .flag("-Xpreprocessor") 32 | .flag("-pthread") 33 | .flag("-lomp") 34 | .static_flag(true) 35 | .warnings(false) 36 | .extra_warnings(false) 37 | .files(stark) 38 | .include("libSTARK/algebra/algebralib/headers") 39 | .include("libSTARK/algebra/FFT/src") 40 | .include("libSTARK/libstark/src") 41 | .compile("stark"); 42 | 43 | cc::Build::new() 44 | .cpp(true) 45 | .flag("-xc++") 46 | .flag("-std=c++11") 47 | .flag("-O3") 48 | .flag("-g") 49 | .flag("-w") 50 | .flag("-Wall") 51 | .flag("-fmessage-length=0") 52 | .flag("-openmp") 53 | .flag("-maes") 54 | .flag("-msse4") 55 | .flag("-mtune=native") 56 | .flag("-Isrc") 57 | .flag("-Xpreprocessor") 58 | .flag("-pthread") 59 | .flag("-lomp") 60 | .static_flag(true) 61 | .warnings(false) 62 | .extra_warnings(false) 63 | .files(algebralib) 64 | .include("libSTARK/algebra/algebralib/headers") 65 | .include("libSTARK/algebra/FFT/src") 66 | .include("libSTARK/libstark/src") 67 | .compile("algebralib"); 68 | 69 | cc::Build::new() 70 | .cpp(true) 71 | .flag("-xc++") 72 | .flag("-std=c++11") 73 | .flag("-O3") 74 | .flag("-g") 75 | .flag("-w") 76 | .flag("-Wall") 77 | .flag("-fmessage-length=0") 78 | .flag("-openmp") 79 | .flag("-maes") 80 | .flag("-msse4") 81 | .flag("-mtune=native") 82 | .flag("-Isrc") 83 | .flag("-Xpreprocessor") 84 | .flag("-pthread") 85 | .flag("-lomp") 86 | .flag("-mpclmul") 87 | .static_flag(true) 88 | .warnings(false) 89 | .extra_warnings(false) 90 | .files(FFT) 91 | .include("libSTARK/algebra/algebralib/headers") 92 | .include("libSTARK/algebra/FFT/src") 93 | .include("libSTARK/libstark/src") 94 | .compile("FFT"); 95 | 96 | cc::Build::new() 97 | .cpp(true) 98 | .flag("-xc++") 99 | .flag("-std=c++11") 100 | .flag("-O3") 101 | .flag("-g") 102 | .flag("-w") 103 | .flag("-Wall") 104 | .flag("-fmessage-length=0") 105 | .flag("-openmp") 106 | .flag("-maes") 107 | .flag("-msse4") 108 | .flag("-mtune=native") 109 | .flag("-Isrc") 110 | .flag("-Xpreprocessor") 111 | .flag("-pthread") 112 | .flag("-lomp") 113 | .static_flag(true) 114 | .warnings(false) 115 | .extra_warnings(false) 116 | .files(fsrs) 117 | .include("libSTARK/algebra/algebralib/headers") 118 | .include("libSTARK/algebra/FFT/src") 119 | .include("libSTARK/libstark/src") 120 | .compile("fsrs"); 121 | 122 | println!("cargo:rustc-link-lib=gomp"); 123 | 124 | let bindings = bindgen::builder() 125 | .header("libSTARK/fsrs/Fsrs_wrapper.hpp") 126 | .trust_clang_mangling(false) 127 | .rustfmt_bindings(true) 128 | .enable_cxx_namespaces() 129 | .clang_arg(r"-xc++") 130 | .clang_arg(r"-std=c++11") 131 | .clang_arg("-Isrc") 132 | .clang_arg("-IlibSTARK/algebra/algebralib/headers") 133 | .clang_arg("-IlibSTARK/algebra/FFT/src") 134 | .clang_arg("-IlibSTARK/libstark/src") 135 | .whitelist_function("execute") 136 | .derive_copy(false) 137 | .layout_tests(false) 138 | .generate() 139 | .expect("Unable to generte bindings"); 140 | 141 | let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); 142 | 143 | bindings 144 | .write_to_file(out_path.join("bindings.rs")) 145 | .expect("Couldn't write bindings!"); 146 | 147 | } 148 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | #![allow(non_camel_case_types)] 3 | #![allow(non_snake_case)] 4 | 5 | use ::std::os::raw::c_uint; 6 | 7 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); 8 | 9 | pub fn execute_fsrs(a: c_uint, b: c_uint, sec_prams: c_uint) { 10 | unsafe { 11 | root::execute(a, b, sec_prams); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use structopt::StructOpt; 2 | use ::std::os::raw::c_uint; 3 | 4 | #[derive(StructOpt, Debug)] 5 | struct Opt { 6 | #[structopt(name = "A: initial num")] 7 | input_a: c_uint, 8 | #[structopt(name = "B: initial num")] 9 | input_b: c_uint, 10 | } 11 | 12 | 13 | fn main() { 14 | let opt = Opt::from_args(); 15 | let security_parameter: c_uint = 60; 16 | stark_rs::execute_fsrs(opt.input_a, opt.input_b, security_parameter); 17 | } 18 | 19 | --------------------------------------------------------------------------------