franklin_crypto/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#![allow(dead_code, unused_imports, unused_macros)]
#![allow(macro_expanded_macro_exports_accessed_by_absolute_paths)]
#![warn(unused_assignments)]
#![feature(array_chunks)]

pub extern crate bellman;
extern crate blake2;
extern crate blake2_rfc_bellman_edition as blake2_rfc;
pub extern crate boojum;
extern crate byteorder;
extern crate core;
extern crate derivative;
extern crate digest;
extern crate indexmap;
extern crate itertools;
extern crate num_bigint;
extern crate num_derive;
extern crate num_integer;
extern crate num_traits;
extern crate rand;
extern crate serde;
extern crate sha2;
extern crate sha3;
extern crate splitmut;
extern crate tiny_keccak;

use bellman::pairing;
use bellman::pairing::ff;

#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate arr_macro;

#[cfg(test)]
extern crate hex;

pub mod alt_babyjubjub;
pub mod as_waksman;
pub mod constants;
pub mod generic_twisted_edwards;
pub mod group_hash;
pub mod interpolation;
pub mod jubjub;
pub mod pedersen_hash;
pub mod plonk;
pub mod primitives;
pub mod redjubjub;
pub mod rescue;
pub mod util;

pub fn log2_floor(num: usize) -> u32 {
    assert!(num > 0);

    let mut pow = 0;

    while (1 << (pow + 1)) <= num {
        pow += 1;
    }

    pow
}