You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by km...@apache.org on 2019/08/08 05:53:24 UTC

[incubator-milagro-crypto-rust] 05/09: Formatting of some comments and BIG -> Big

This is an automated email from the ASF dual-hosted git repository.

kmccusker pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-rust.git

commit a3d3ebdcce80b5db73ac494ff092ac253595e0db
Author: Kirk Baird <ba...@outlook.com>
AuthorDate: Wed Aug 7 16:44:25 2019 +1000

    Formatting of some comments and BIG -> Big
---
 src/aes.rs     |  44 +++----
 src/big.rs     | 357 +++++++++++++++++++++++++++++----------------------------
 src/bls.rs     |  29 +++--
 src/bls192.rs  |  29 +++--
 src/bls256.rs  |  29 +++--
 src/dbig.rs    |  80 ++++++-------
 src/ecdh.rs    |  62 +++++-----
 src/ecp.rs     |  66 +++++------
 src/ecp2.rs    |  50 ++++----
 src/ecp4.rs    |  76 ++++++------
 src/ecp8.rs    | 124 ++++++++++----------
 src/ff.rs      |  74 ++++++------
 src/fp.rs      |  80 ++++++-------
 src/fp12.rs    |  78 ++++++-------
 src/fp16.rs    |  28 ++---
 src/fp2.rs     |  28 ++---
 src/fp24.rs    | 110 +++++++++---------
 src/fp4.rs     |  30 ++---
 src/fp48.rs    | 174 ++++++++++++++--------------
 src/fp8.rs     |  28 ++---
 src/mpin.rs    |  70 +++++------
 src/mpin192.rs |  70 +++++------
 src/mpin256.rs |  70 +++++------
 src/pair.rs    | 120 +++++++++----------
 src/pair192.rs | 100 ++++++++--------
 src/pair256.rs | 124 ++++++++++----------
 26 files changed, 1062 insertions(+), 1068 deletions(-)

diff --git a/src/aes.rs b/src/aes.rs
index eedea79..32a0f86 100644
--- a/src/aes.rs
+++ b/src/aes.rs
@@ -33,7 +33,7 @@ pub const CTR4: usize = 33;
 pub const CTR8: usize = 37;
 pub const CTR16: usize = 45;
 
-const INCO: [u8; 4] = [0xB, 0xD, 0x9, 0xE]; /* Inverse Coefficients */
+const INCO: [u8; 4] = [0xB, 0xD, 0x9, 0xE]; // Inverse Coefficients
 
 const PTAB: [u8; 256] = [
     1, 3, 5, 15, 17, 51, 85, 255, 26, 46, 114, 150, 161, 248, 19, 53, 95, 225, 56, 72, 216, 115,
@@ -196,7 +196,7 @@ impl AES {
     }
 
     fn pack(b: [u8; 4]) -> u32 {
-        /* pack bytes into a 32-bit Word */
+        // pack bytes into a 32-bit Word
         return ((((b[3]) & 0xff) as u32) << 24)
             | ((((b[2]) & 0xff) as u32) << 16)
             | ((((b[1]) & 0xff) as u32) << 8)
@@ -204,7 +204,7 @@ impl AES {
     }
 
     fn unpack(a: u32) -> [u8; 4] {
-        /* unpack bytes from a word */
+        // unpack bytes from a word
         let b: [u8; 4] = [
             (a & 0xff) as u8,
             ((a >> 8) & 0xff) as u8,
@@ -215,7 +215,7 @@ impl AES {
     }
 
     fn bmul(x: u8, y: u8) -> u8 {
-        /* x.y= AntiLog(Log(x) + Log(y)) */
+        // x.y= AntiLog(Log(x) + Log(y))
         let ix = (x as usize) & 0xff;
         let iy = (y as usize) & 0xff;
         let lx = (LTAB[ix] as usize) & 0xff;
@@ -238,7 +238,7 @@ impl AES {
     }
 
     fn product(x: u32, y: u32) -> u8 {
-        /* dot product of two 4-byte arrays */
+        // dot product of two 4-byte arrays
         let xb = AES::unpack(x);
         let yb = AES::unpack(y);
 
@@ -249,7 +249,7 @@ impl AES {
     }
 
     fn invmixcol(x: u32) -> u32 {
-        /* matrix Multiplication */
+        // matrix Multiplication
         let mut b: [u8; 4] = [0; 4];
         let mut m = AES::pack(INCO);
         b[3] = AES::product(m, x);
@@ -283,9 +283,9 @@ impl AES {
         }
     }
 
-    /* reset cipher */
+    // reset cipher
     pub fn reset(&mut self, m: usize, iv: Option<[u8; 16]>) {
-        /* reset mode, or reset iv */
+        // reset mode, or reset iv
         self.mode = m;
         for i in 0..16 {
             self.f[i] = 0
@@ -300,7 +300,7 @@ impl AES {
     }
 
     pub fn init(&mut self, m: usize, nkey: usize, key: &[u8], iv: Option<[u8; 16]>) -> bool {
-        /* Key Scheduler. Create expanded encryption key */
+        // Key Scheduler. Create expanded encryption key
         let mut cipherkey: [u32; 8] = [0; 8];
         let mut b: [u8; 4] = [0; 4];
         let nk = nkey / 4;
@@ -331,7 +331,7 @@ impl AES {
         while j < n {
             self.fkey[j] =
                 self.fkey[j - nk] ^ AES::subbyte(AES::rotl24(self.fkey[j - 1])) ^ (RCO[k] as u32);
-            if nk<=6 { 
+            if nk<=6 {
 		for i in 1..nk {
 			if (i + j) >= n {
 				break;
@@ -345,7 +345,7 @@ impl AES {
 			}
 			self.fkey[i + j] = self.fkey[i + j - nk] ^ self.fkey[i + j - 1];
 		}
-		
+
 		if (j + 4) < n {
 			self.fkey[j + 4] = self.fkey[j + 4 - nk] ^ AES::subbyte(self.fkey[j + 3]);
 		}
@@ -354,13 +354,13 @@ impl AES {
 				break;
 			}
 			self.fkey[i + j] = self.fkey[i + j - nk] ^ self.fkey[i + j - 1];
-		}	        
+		}
 	    }
             j += nk;
             k += 1;
         }
 
-        /* now for the expanded decrypt key in reverse order */
+        // now for the expanded decrypt key in reverse order
 
         for j in 0..4 {
             self.rkey[j + n - 4] = self.fkey[j]
@@ -387,7 +387,7 @@ impl AES {
         return ir;
     }
 
-    /* Encrypt a single block */
+    // Encrypt a single block
     pub fn ecb_encrypt(&mut self, buff: &mut [u8; 16]) {
         let mut b: [u8; 4] = [0; 4];
         let mut p: [u32; 4] = [0; 4];
@@ -405,7 +405,7 @@ impl AES {
 
         let mut k = 4;
 
-        /* State alternates between p and q */
+        // State alternates between p and q
         for _ in 1..self.nr {
             q[0] = self.fkey[k]
                 ^ FTABLE[(p[0] & 0xff) as usize]
@@ -439,7 +439,7 @@ impl AES {
             }
         }
 
-        /* Last Round */
+        // Last Round
 
         q[0] = self.fkey[k]
             ^ (FBSUB[(p[0] & 0xff) as usize] as u32)
@@ -475,7 +475,7 @@ impl AES {
         }
     }
 
-    /* Decrypt a single block */
+    // Decrypt a single block
     pub fn ecb_decrypt(&mut self, buff: &mut [u8; 16]) {
         let mut b: [u8; 4] = [0; 4];
         let mut p: [u32; 4] = [0; 4];
@@ -493,7 +493,7 @@ impl AES {
 
         let mut k = 4;
 
-        /* State alternates between p and q */
+        // State alternates between p and q
         for _ in 1..self.nr {
             q[0] = self.rkey[k]
                 ^ RTABLE[(p[0] & 0xff) as usize]
@@ -527,7 +527,7 @@ impl AES {
             }
         }
 
-        /* Last Round */
+        // Last Round
 
         q[0] = self.rkey[k]
             ^ (RBSUB[(p[0] & 0xff) as usize] as u32)
@@ -563,7 +563,7 @@ impl AES {
         }
     }
 
-    /* Encrypt using selected mode of operation */
+    // Encrypt using selected mode of operation
     pub fn encrypt(&mut self, buff: &mut [u8; 16]) -> u32 {
         let mut st: [u8; 16] = [0; 16];
 
@@ -643,7 +643,7 @@ impl AES {
         }
     }
 
-    /* Decrypt using selected mode of operation */
+    // Decrypt using selected mode of operation
     pub fn decrypt(&mut self, buff: &mut [u8; 16]) -> u32 {
         let mut st: [u8; 16] = [0; 16];
 
@@ -722,7 +722,7 @@ impl AES {
         }
     }
 
-    /* Clean up and delete left-overs */
+    // Clean up and delete left-overs
     pub fn end(&mut self) {
         // clean up
         for i in 0..4 * (self.nr + 1) {
diff --git a/src/big.rs b/src/big.rs
index 7267ad4..99342f4 100644
--- a/src/big.rs
+++ b/src/big.rs
@@ -22,7 +22,7 @@ use super::super::arch::Chunk;
 
 use super::super::arch::DChunk;
 
-use super::dbig::DBIG;
+use super::dbig::DBig;
 use rand::RAND;
 
 pub use super::rom::MODBYTES;
@@ -39,31 +39,31 @@ pub const NEXCESS: isize = (1 << ((arch::CHUNK) - BASEBITS - 1));
 pub const BIGBITS: usize = (MODBYTES * 8);
 
 #[derive(Copy)]
-pub struct BIG {
+pub struct Big {
     pub w: [Chunk; NLEN],
 }
 
-impl Clone for BIG {
-    fn clone(&self) -> BIG { *self }
+impl Clone for Big {
+    fn clone(&self) -> Big { *self }
 }
 
-impl fmt::Display for BIG {
+impl fmt::Display for Big {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let mut big = self.clone();
-        write!(f, "BIG: [ {} ]", big.tostring())
+        write!(f, "Big: [ {} ]", big.tostring())
     }
 }
 
-impl fmt::Debug for BIG {
+impl fmt::Debug for Big {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let mut big = self.clone();
-        write!(f, "BIG: [ {} ]", big.tostring())
+        write!(f, "Big: [ {} ]", big.tostring())
     }
 }
 
-impl PartialEq for BIG {
-    fn eq(&self, other: &BIG) -> bool {
-        if BIG::comp(self,other)==0 {
+impl PartialEq for Big {
+    fn eq(&self, other: &Big) -> bool {
+        if Big::comp(self,other)==0 {
             return true;
         } else {
             return false;
@@ -71,9 +71,9 @@ impl PartialEq for BIG {
     }
 }
 
-impl Ord for BIG {
-    fn cmp(&self, other: &BIG) -> Ordering {
-        let r = BIG::comp(self, other);
+impl Ord for Big {
+    fn cmp(&self, other: &Big) -> Ordering {
+        let r = Big::comp(self, other);
         if r > 0 {
             return Ordering::Greater;
         }
@@ -84,51 +84,51 @@ impl Ord for BIG {
     }
 }
 
-impl Eq for BIG { }
+impl Eq for Big { }
 
-impl PartialOrd for BIG {
-    fn partial_cmp(&self, other: &BIG) -> Option<Ordering> {
+impl PartialOrd for Big {
+    fn partial_cmp(&self, other: &Big) -> Option<Ordering> {
         Some(self.cmp(other))
     }
 }
 
-impl BIG {
-    pub fn new() -> BIG {
-        BIG { w: [0; NLEN] }
+impl Big {
+    pub fn new() -> Big {
+        Big { w: [0; NLEN] }
     }
 
-    pub fn new_int(x: isize) -> BIG {
-        let mut s = BIG::new();
+    pub fn new_int(x: isize) -> Big {
+        let mut s = Big::new();
         s.w[0] = x as Chunk;
         return s;
     }
 
-    pub fn new_ints(a: &[Chunk]) -> BIG {
-        let mut s = BIG::new();
+    pub fn new_ints(a: &[Chunk]) -> Big {
+        let mut s = Big::new();
         for i in 0..NLEN {
             s.w[i] = a[i]
         }
         return s;
     }
 
-    pub fn new_copy(y: &BIG) -> BIG {
-        let mut s = BIG::new();
+    pub fn new_copy(y: &Big) -> Big {
+        let mut s = Big::new();
         for i in 0..NLEN {
             s.w[i] = y.w[i]
         }
         return s;
     }
 
-    pub fn new_big(y: &BIG) -> BIG {
-        let mut s = BIG::new();
+    pub fn new_big(y: &Big) -> Big {
+        let mut s = Big::new();
         for i in 0..NLEN {
             s.w[i] = y.w[i]
         }
         return s;
     }
 
-    pub fn new_dcopy(y: &DBIG) -> BIG {
-        let mut s = BIG::new();
+    pub fn new_dcopy(y: &DBig) -> Big {
+        let mut s = Big::new();
         for i in 0..NLEN {
             s.w[i] = y.w[i]
         }
@@ -151,7 +151,7 @@ impl BIG {
         self.w[NLEN - 1] |= x;
     }
 
-    /* test for zero */
+    // test for zero
     pub fn iszilch(&self) -> bool {
         for i in 0..NLEN {
             if self.w[i] != 0 {
@@ -161,14 +161,14 @@ impl BIG {
         return true;
     }
 
-    /* set to zero */
+    // set to zero
     pub fn zero(&mut self) {
         for i in 0..NLEN {
             self.w[i] = 0
         }
     }
 
-    /* Test for equal to one */
+    // Test for equal to one
     pub fn isunity(&self) -> bool {
         for i in 1..NLEN {
             if self.w[i] != 0 {
@@ -181,7 +181,7 @@ impl BIG {
         return true;
     }
 
-    /* set to one */
+    /// Set to one
     pub fn one(&mut self) {
         self.w[0] = 1;
         for i in 1..NLEN {
@@ -189,20 +189,21 @@ impl BIG {
         }
     }
 
-    /* Copy from another BIG */
-    pub fn copy(&mut self, x: &BIG) {
+    /// Copy from another Big
+    pub fn copy(&mut self, x: &Big) {
         for i in 0..NLEN {
             self.w[i] = x.w[i]
         }
     }
 
-    pub fn dcopy(&mut self, x: &DBIG) {
+    /// Copy from a DBig
+    pub fn dcopy(&mut self, x: &DBig) {
         for i in 0..NLEN {
             self.w[i] = x.w[i]
         }
     }
 
-    /* Get top and bottom half of =x*y+c+r */
+    /// Get top and bottom half of =x*y+c+r
     pub fn muladd(a: Chunk, b: Chunk, c: Chunk, r: Chunk) -> (Chunk, Chunk) {
         let prod: DChunk = (a as DChunk) * (b as DChunk) + (c as DChunk) + (r as DChunk);
         let bot = (prod & (BMASK as DChunk)) as Chunk;
@@ -210,7 +211,7 @@ impl BIG {
         return (top, bot);
     }
 
-    /* normalise BIG - force all digits < 2^BASEBITS */
+    /// normalise Big - force all digits < 2^BASEBITS
     pub fn norm(&mut self) -> Chunk {
         let mut carry = 0 as Chunk;
         for i in 0..NLEN - 1 {
@@ -222,8 +223,8 @@ impl BIG {
         return (self.w[NLEN - 1] >> ((8 * MODBYTES) % BASEBITS)) as Chunk;
     }
 
-    /* Conditional swap of two bigs depending on d using XOR - no branches */
-    pub fn cswap(&mut self, b: &mut BIG, d: isize) {
+    /// Conditional swap of two bigs depending on d using XOR - no branches
+    pub fn cswap(&mut self, b: &mut Big, d: isize) {
         let mut c = d as Chunk;
         c = !(c - 1);
         for i in 0..NLEN {
@@ -233,17 +234,17 @@ impl BIG {
         }
     }
 
-    pub fn cmove(&mut self, g: &BIG, d: isize) {
+    pub fn cmove(&mut self, g: &Big, d: isize) {
         let b = -d as Chunk;
         for i in 0..NLEN {
             self.w[i] ^= (self.w[i] ^ g.w[i]) & b;
         }
     }
 
-    /* Shift right by less than a word */
+    /// Shift right by less than a word
     pub fn fshr(&mut self, k: usize) -> isize {
         let n = k;
-        let w = self.w[0] & ((1 << n) - 1); /* shifted out part */
+        let w = self.w[0] & ((1 << n) - 1); // shifted out part
         for i in 0..NLEN - 1 {
             self.w[i] = (self.w[i] >> k) | ((self.w[i + 1] << (BASEBITS - n)) & BMASK);
         }
@@ -251,7 +252,7 @@ impl BIG {
         return w as isize;
     }
 
-    /* general shift right */
+    /// general shift right
     pub fn shr(&mut self, k: usize) {
         let n = k % BASEBITS;
         let m = k / BASEBITS;
@@ -264,7 +265,7 @@ impl BIG {
         }
     }
 
-    /* Shift right by less than a word */
+    /// Shift right by less than a word
     pub fn fshl(&mut self, k: usize) -> isize {
         let n = k;
         self.w[NLEN - 1] = (self.w[NLEN - 1] << n) | (self.w[NLEN - 2] >> (BASEBITS - n));
@@ -272,10 +273,10 @@ impl BIG {
             self.w[i] = ((self.w[i] << k) & BMASK) | (self.w[i - 1] >> (BASEBITS - n));
         }
         self.w[0] = (self.w[0] << n) & BMASK;
-        return (self.w[NLEN - 1] >> ((8 * MODBYTES) % BASEBITS)) as isize; /* return excess - only used in ff.c */
+        return (self.w[NLEN - 1] >> ((8 * MODBYTES) % BASEBITS)) as isize; // return excess - only used in ff.c
     }
 
-    /* general shift left */
+    /// general shift left
     pub fn shl(&mut self, k: usize) {
         let n = k % BASEBITS;
         let m = k / BASEBITS;
@@ -293,10 +294,10 @@ impl BIG {
         }
     }
 
-    /* return number of bits */
+    // return number of bits
     pub fn nbits(&self) -> usize {
         let mut k = NLEN - 1;
-        let mut s = BIG::new_copy(&self);
+        let mut s = Big::new_copy(&self);
         s.norm();
         while (k as isize) >= 0 && s.w[k] == 0 {
             k = k.wrapping_sub(1)
@@ -313,7 +314,7 @@ impl BIG {
         return bts;
     }
 
-    /* Convert to Hex String */
+    // Convert to Hex String
     pub fn tostring(&mut self) -> String {
         let mut s = String::new();
         let mut len = self.nbits();
@@ -330,15 +331,15 @@ impl BIG {
         }
 
         for i in (0..len).rev() {
-            let mut b = BIG::new_copy(&self);
+            let mut b = Big::new_copy(&self);
             b.shr(i * 4);
             s = s + &format!("{:X}", b.w[0] & 15);
         }
         return s;
     }
 
-    pub fn fromstring(val: String) -> BIG {
-        let mut res = BIG::new();
+    pub fn fromstring(val: String) -> Big {
+        let mut res = Big::new();
         let len = val.len();
         let op = &val[0..1];
         let n = u8::from_str_radix(op, 16).unwrap();
@@ -352,21 +353,21 @@ impl BIG {
         return res;
     }
 
-    pub fn from_hex(val: String) -> BIG {
-        BIG::fromstring(val)
+    pub fn from_hex(val: String) -> Big {
+        Big::fromstring(val)
     }
-    
+
     pub fn to_hex(&mut self) -> String {
         self.tostring()
     }
 
-    pub fn add(&mut self, r: &BIG) {
+    pub fn add(&mut self, r: &Big) {
         for i in 0..NLEN {
             self.w[i] += r.w[i]
         }
     }
 
-    pub fn or(&mut self, r: &BIG) {
+    pub fn or(&mut self, r: &Big) {
         for i in 0..NLEN {
             self.w[i] |= r.w[i]
         }
@@ -378,9 +379,9 @@ impl BIG {
         }
     }
 
-    /* return this+x */
-    pub fn plus(&self, x: &BIG) -> BIG {
-        let mut s = BIG::new();
+    // return this+x
+    pub fn plus(&self, x: &Big) -> Big {
+        let mut s = Big::new();
         for i in 0..NLEN {
             s.w[i] = self.w[i] + x.w[i];
         }
@@ -392,46 +393,46 @@ impl BIG {
         self.w[0] += x as Chunk;
     }
 
-    /* return self-x */
-    pub fn minus(&self, x: &BIG) -> BIG {
-        let mut d = BIG::new();
+    // return self-x
+    pub fn minus(&self, x: &Big) -> Big {
+        let mut d = Big::new();
         for i in 0..NLEN {
             d.w[i] = self.w[i] - x.w[i];
         }
         return d;
     }
 
-    /* self-=x */
-    pub fn sub(&mut self, x: &BIG) {
+    // self-=x
+    pub fn sub(&mut self, x: &Big) {
         for i in 0..NLEN {
             self.w[i] -= x.w[i];
         }
     }
 
-    /* reverse subtract this=x-this */
+    // reverse subtract this=x-this
 
-    pub fn rsub(&mut self, x: &BIG) {
+    pub fn rsub(&mut self, x: &Big) {
         for i in 0..NLEN {
             self.w[i] = x.w[i] - self.w[i]
         }
     }
 
-    /* self-=x, where x is int */
+    // self-=x, where x is int
     pub fn dec(&mut self, x: isize) {
         self.norm();
         self.w[0] -= x as Chunk;
     }
 
-    /* self*=x, where x is small int<NEXCESS */
+    // self*=x, where x is small int<NEXCESS
     pub fn imul(&mut self, c: isize) {
         for i in 0..NLEN {
             self.w[i] *= c as Chunk;
         }
     }
 
-    /* convert this BIG to byte array */
+    // convert this Big to byte array
     pub fn tobytearray(&mut self, b: &mut [u8], n: usize) {
-        let mut c = BIG::new_copy(self);
+        let mut c = Big::new_copy(self);
         c.norm();
 
         for i in (0..(MODBYTES as usize)).rev() {
@@ -440,9 +441,9 @@ impl BIG {
         }
     }
 
-    /* convert from byte array to BIG */
-    pub fn frombytearray(b: &[u8], n: usize) -> BIG {
-        let mut m = BIG::new();
+    // convert from byte array to Big
+    pub fn frombytearray(b: &[u8], n: usize) -> Big {
+        let mut m = Big::new();
         for i in 0..(MODBYTES as usize) {
             m.fshl(8);
             m.w[0] += (b[i + n] & 0xff) as Chunk;
@@ -454,28 +455,28 @@ impl BIG {
         self.tobytearray(b, 0)
     }
 
-    pub fn frombytes(b: &[u8]) -> BIG {
-        return BIG::frombytearray(b, 0);
+    pub fn frombytes(b: &[u8]) -> Big {
+        return Big::frombytearray(b, 0);
     }
 
-    /* self*=x, where x is >NEXCESS */
+    // self*=x, where x is >NEXCESS
     pub fn pmul(&mut self, c: isize) -> Chunk {
         let mut carry = 0 as Chunk;
         for i in 0..NLEN {
             let ak = self.w[i];
-            let tuple = BIG::muladd(ak, c as Chunk, carry, 0 as Chunk);
+            let tuple = Big::muladd(ak, c as Chunk, carry, 0 as Chunk);
             carry = tuple.0;
             self.w[i] = tuple.1;
         }
         return carry;
     }
 
-    /* self*=c and catch overflow in DBIG */
-    pub fn pxmul(&mut self, c: isize) -> DBIG {
-        let mut m = DBIG::new();
+    // self*=c and catch overflow in DBig
+    pub fn pxmul(&mut self, c: isize) -> DBig {
+        let mut m = DBig::new();
         let mut carry = 0 as Chunk;
         for j in 0..NLEN {
-            let tuple = BIG::muladd(self.w[j], c as Chunk, carry, m.w[j]);
+            let tuple = Big::muladd(self.w[j], c as Chunk, carry, m.w[j]);
             carry = tuple.0;
             m.w[j] = tuple.1;
         }
@@ -483,7 +484,7 @@ impl BIG {
         return m;
     }
 
-    /* divide by 3 */
+    // divide by 3
     pub fn div3(&mut self) -> Chunk {
         let mut carry = 0 as Chunk;
         self.norm();
@@ -496,14 +497,14 @@ impl BIG {
         return carry;
     }
 
-    /* return a*b where result fits in a BIG */
-    pub fn smul(a: &BIG, b: &BIG) -> BIG {
-        let mut c = BIG::new();
+    // return a*b where result fits in a Big
+    pub fn smul(a: &Big, b: &Big) -> Big {
+        let mut c = Big::new();
         for i in 0..NLEN {
             let mut carry = 0 as Chunk;
             for j in 0..NLEN {
                 if i + j < NLEN {
-                    let tuple = BIG::muladd(a.w[i], b.w[j], carry, c.w[i + j]);
+                    let tuple = Big::muladd(a.w[i], b.w[j], carry, c.w[i + j]);
                     carry = tuple.0;
                     c.w[i + j] = tuple.1;
                 }
@@ -512,8 +513,8 @@ impl BIG {
         return c;
     }
 
-    /* Compare a and b, return 0 if a==b, -1 if a<b, +1 if a>b. Inputs must be normalised */
-    pub fn comp(a: &BIG, b: &BIG) -> isize {
+    // Compare a and b, return 0 if a==b, -1 if a<b, +1 if a>b. Inputs must be normalised
+    pub fn comp(a: &Big, b: &Big) -> isize {
         for i in (0..NLEN).rev() {
             if a.w[i] == b.w[i] {
                 continue;
@@ -527,7 +528,7 @@ impl BIG {
         return 0;
     }
 
-    /* set x = x mod 2^m */
+    // set x = x mod 2^m
     pub fn mod2m(&mut self, m: usize) {
         let wd = m / BASEBITS;
         let bt = m % BASEBITS;
@@ -538,7 +539,7 @@ impl BIG {
         }
     }
 
-    /* Arazi and Qi inversion mod 256 */
+    // Arazi and Qi inversion mod 256
     pub fn invmod256(a: isize) -> isize {
         let mut t1: isize = 0;
         let mut c = (a >> 1) & 1;
@@ -577,12 +578,12 @@ impl BIG {
         return u;
     }
 
-    /* return parity */
+    // return parity
     pub fn parity(&self) -> isize {
         return (self.w[0] % 2) as isize;
     }
 
-    /* return n-th bit */
+    // return n-th bit
     pub fn bit(&self, n: usize) -> isize {
         if (self.w[n / (BASEBITS as usize)] & (1 << (n % BASEBITS))) > 0 {
             return 1;
@@ -591,37 +592,37 @@ impl BIG {
         }
     }
 
-    /* return n last bits */
+    // return n last bits
     pub fn lastbits(&mut self, n: usize) -> isize {
         let msk = ((1 << n) - 1) as Chunk;
         self.norm();
         return (self.w[0] & msk) as isize;
     }
 
-    /* a=1/a mod 2^256. This is very fast! */
+    // a=1/a mod 2^256. This is very fast!
     pub fn invmod2m(&mut self) {
-        let mut u = BIG::new();
-        let mut b = BIG::new();
-        let mut c = BIG::new();
+        let mut u = Big::new();
+        let mut b = Big::new();
+        let mut c = Big::new();
 
-        u.inc(BIG::invmod256(self.lastbits(8)));
+        u.inc(Big::invmod256(self.lastbits(8)));
 
         let mut i = 8;
         while i < BIGBITS {
             u.norm();
             b.copy(self);
             b.mod2m(i);
-            let mut t1 = BIG::smul(&u, &b);
+            let mut t1 = Big::smul(&u, &b);
             t1.shr(i);
             c.copy(self);
             c.shr(i);
             c.mod2m(i);
 
-            let mut t2 = BIG::smul(&u, &c);
+            let mut t2 = Big::smul(&u, &c);
             t2.mod2m(i);
             t1.add(&t2);
             t1.norm();
-            b = BIG::smul(&t1, &u);
+            b = Big::smul(&t1, &u);
             t1.copy(&b);
             t1.mod2m(i);
 
@@ -638,19 +639,19 @@ impl BIG {
         self.norm();
     }
 
-    /* reduce self mod m */
-    pub fn rmod(&mut self, n: &BIG) {
+    // reduce self mod m
+    pub fn rmod(&mut self, n: &Big) {
         let mut k = 0;
-        let mut m = BIG::new_copy(n);
-        let mut r = BIG::new();
+        let mut m = Big::new_copy(n);
+        let mut r = Big::new();
         self.norm();
-        if BIG::comp(self, &m) < 0 {
+        if Big::comp(self, &m) < 0 {
             return;
         }
         loop {
             m.fshl(1);
             k += 1;
-            if BIG::comp(self, &m) < 0 {
+            if Big::comp(self, &m) < 0 {
                 break;
             }
         }
@@ -669,17 +670,17 @@ impl BIG {
         }
     }
 
-    /* divide self by m */
-    pub fn div(&mut self, n: &BIG) {
+    // divide self by m
+    pub fn div(&mut self, n: &Big) {
         let mut k = 0;
         self.norm();
-        let mut e = BIG::new_int(1);
-        let mut b = BIG::new_copy(self);
-        let mut m = BIG::new_copy(n);
-        let mut r = BIG::new();
+        let mut e = Big::new_int(1);
+        let mut b = Big::new_copy(self);
+        let mut m = Big::new_copy(n);
+        let mut r = Big::new();
         self.zero();
 
-        while BIG::comp(&b, &m) >= 0 {
+        while Big::comp(&b, &m) >= 0 {
             e.fshl(1);
             m.fshl(1);
             k += 1;
@@ -702,12 +703,12 @@ impl BIG {
         }
     }
 
-    /* get 8*MODBYTES size random number */
-    pub fn random(rng: &mut RAND) -> BIG {
-        let mut m = BIG::new();
+    // get 8*MODBYTES size random number
+    pub fn random(rng: &mut RAND) -> Big {
+        let mut m = Big::new();
         let mut j = 0;
         let mut r: u8 = 0;
-        /* generate random BIG */
+        // generate random Big
 
         for _ in 0..8 * (MODBYTES as usize) {
             if j == 0 {
@@ -725,12 +726,12 @@ impl BIG {
         return m;
     }
 
-    /* Create random BIG in portable way, one bit at a time */
-    pub fn randomnum(q: &BIG, rng: &mut RAND) -> BIG {
-        let mut d = DBIG::new();
+    // Create random Big in portable way, one bit at a time
+    pub fn randomnum(q: &Big, rng: &mut RAND) -> Big {
+        let mut d = DBig::new();
         let mut j = 0;
         let mut r: u8 = 0;
-        let t = BIG::new_copy(q);
+        let t = Big::new_copy(q);
         for _ in 0..2 * t.nbits() {
             if j == 0 {
                 r = rng.getbyte();
@@ -748,15 +749,15 @@ impl BIG {
         return m;
     }
 
-    /* Jacobi Symbol (this/p). Returns 0, 1 or -1 */
-    pub fn jacobi(&mut self, p: &BIG) -> isize {
+    // Jacobi Symbol (this/p). Returns 0, 1 or -1
+    pub fn jacobi(&mut self, p: &Big) -> isize {
         let mut m: usize = 0;
-        let mut t = BIG::new();
-        let mut x = BIG::new();
-        let mut n = BIG::new();
-        let zilch = BIG::new();
-        let one = BIG::new_int(1);
-        if p.parity() == 0 || BIG::comp(self, &zilch) == 0 || BIG::comp(p, &one) <= 0 {
+        let mut t = Big::new();
+        let mut x = Big::new();
+        let mut n = Big::new();
+        let zilch = Big::new();
+        let one = Big::new_int(1);
+        if p.parity() == 0 || Big::comp(self, &zilch) == 0 || Big::comp(p, &one) <= 0 {
             return 0;
         }
         self.norm();
@@ -765,8 +766,8 @@ impl BIG {
         n.copy(p);
         x.rmod(p);
 
-        while BIG::comp(&n, &one) > 0 {
-            if BIG::comp(&x, &zilch) == 0 {
+        while Big::comp(&n, &one) > 0 {
+            if Big::comp(&x, &zilch) == 0 {
                 return 0;
             }
             let n8 = n.lastbits(3) as usize;
@@ -792,17 +793,17 @@ impl BIG {
         }
     }
 
-    /* self=1/self mod p. Binary method */
-    pub fn invmodp(&mut self, p: &BIG) {
+    // self=1/self mod p. Binary method
+    pub fn invmodp(&mut self, p: &Big) {
         self.rmod(p);
-        let mut u = BIG::new_copy(self);
-        let mut v = BIG::new_copy(p);
-        let mut x1 = BIG::new_int(1);
-        let mut x2 = BIG::new();
-        let mut t = BIG::new();
-        let one = BIG::new_int(1);
-
-        while (BIG::comp(&u, &one) != 0) && (BIG::comp(&v, &one) != 0) {
+        let mut u = Big::new_copy(self);
+        let mut v = Big::new_copy(p);
+        let mut x1 = Big::new_int(1);
+        let mut x2 = Big::new();
+        let mut t = Big::new();
+        let one = Big::new_int(1);
+
+        while (Big::comp(&u, &one) != 0) && (Big::comp(&v, &one) != 0) {
             while u.parity() == 0 {
                 u.fshr(1);
                 if x1.parity() != 0 {
@@ -819,10 +820,10 @@ impl BIG {
                 }
                 x2.fshr(1);
             }
-            if BIG::comp(&u, &v) >= 0 {
+            if Big::comp(&u, &v) >= 0 {
                 u.sub(&v);
                 u.norm();
-                if BIG::comp(&x1, &x2) >= 0 {
+                if Big::comp(&x1, &x2) >= 0 {
                     x1.sub(&x2)
                 } else {
                     t.copy(p);
@@ -833,7 +834,7 @@ impl BIG {
             } else {
                 v.sub(&u);
                 v.norm();
-                if BIG::comp(&x2, &x1) >= 0 {
+                if Big::comp(&x2, &x1) >= 0 {
                     x2.sub(&x1)
                 } else {
                     t.copy(p);
@@ -843,17 +844,17 @@ impl BIG {
                 x2.norm();
             }
         }
-        if BIG::comp(&u, &one) == 0 {
+        if Big::comp(&u, &one) == 0 {
             self.copy(&x1)
         } else {
             self.copy(&x2)
         }
     }
 
-    /* return a*b as DBIG */
+    // return a*b as DBig
 
-    pub fn mul(a: &BIG, b: &BIG) -> DBIG {
-        let mut c = DBIG::new();
+    pub fn mul(a: &Big, b: &Big) -> DBig {
+        let mut c = DBig::new();
         let rm = BMASK as DChunk;
         let rb = BASEBITS;
 
@@ -890,9 +891,9 @@ impl BIG {
         return c;
     }
 
-    /* return a^2 as DBIG */
-    pub fn sqr(a: &BIG) -> DBIG {
-        let mut c = DBIG::new();
+    // return a^2 as DBig
+    pub fn sqr(a: &Big) -> DBig {
+        let mut c = DBig::new();
         let rm = BMASK as DChunk;
         let rb = BASEBITS;
 
@@ -960,8 +961,8 @@ impl BIG {
         return c;
     }
 
-    pub fn monty(md: &BIG, mc: Chunk, d: &mut DBIG) -> BIG {
-        let mut b = BIG::new();
+    pub fn monty(md: &Big, mc: Chunk, d: &mut DBig) -> Big {
+        let mut b = Big::new();
         let rm = BMASK as DChunk;
         let rb = BASEBITS;
 
@@ -1004,7 +1005,7 @@ impl BIG {
         return b;
     }
 
-    pub fn ssn(r: &mut BIG, a: &BIG, m: &mut BIG) -> isize {
+    pub fn ssn(r: &mut Big, a: &Big, m: &mut Big) -> isize {
         let n = NLEN - 1;
         m.w[0] = (m.w[0] >> 1) | ((m.w[1] << (BASEBITS - 1)) & BMASK);
         r.w[0] = a.w[0] - m.w[0];
@@ -1021,49 +1022,49 @@ impl BIG {
         return ((r.w[n] >> (arch::CHUNK - 1)) & 1) as isize;
     }
 
-    /* return a*b mod m */
-    pub fn modmul(a1: &BIG, b1: &BIG, m: &BIG) -> BIG {
-        let mut a = BIG::new_copy(a1);
-        let mut b = BIG::new_copy(b1);
+    // return a*b mod m
+    pub fn modmul(a1: &Big, b1: &Big, m: &Big) -> Big {
+        let mut a = Big::new_copy(a1);
+        let mut b = Big::new_copy(b1);
         a.rmod(m);
         b.rmod(m);
-        let mut d = BIG::mul(&a, &b);
+        let mut d = Big::mul(&a, &b);
         return d.dmod(m);
     }
 
-    /* return a^2 mod m */
-    pub fn modsqr(a1: &BIG, m: &BIG) -> BIG {
-        let mut a = BIG::new_copy(a1);
+    // return a^2 mod m
+    pub fn modsqr(a1: &Big, m: &Big) -> Big {
+        let mut a = Big::new_copy(a1);
         a.rmod(m);
-        let mut d = BIG::sqr(&a);
+        let mut d = Big::sqr(&a);
         return d.dmod(m);
     }
 
-    /* return -a mod m */
-    pub fn modneg(a1: &BIG, m: &BIG) -> BIG {
-        let mut a = BIG::new_copy(a1);
+    // return -a mod m
+    pub fn modneg(a1: &Big, m: &Big) -> Big {
+        let mut a = Big::new_copy(a1);
         a.rmod(m);
         return m.minus(&a);
     }
 
-    /* return this^e mod m */
-    pub fn powmod(&mut self, e1: &BIG, m: &BIG) -> BIG {
+    // return this^e mod m
+    pub fn powmod(&mut self, e1: &Big, m: &Big) -> Big {
         self.norm();
-        let mut e = BIG::new_copy(e1);
+        let mut e = Big::new_copy(e1);
         e.norm();
-        let mut a = BIG::new_int(1);
-        let mut z = BIG::new_copy(&e);
-        let mut s = BIG::new_copy(self);
+        let mut a = Big::new_int(1);
+        let mut z = Big::new_copy(&e);
+        let mut s = Big::new_copy(self);
         loop {
             let bt = z.parity();
             z.fshr(1);
             if bt == 1 {
-                a = BIG::modmul(&a, &s, m)
+                a = Big::modmul(&a, &s, m)
             }
             if z.iszilch() {
                 break;
             }
-            s = BIG::modsqr(&mut s, m);
+            s = Big::modsqr(&mut s, m);
         }
         return a;
     }
diff --git a/src/bls.rs b/src/bls.rs
index 7e7fd7a..2ef80a4 100644
--- a/src/bls.rs
+++ b/src/bls.rs
@@ -16,11 +16,12 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
+
 use std::str;
 use super::ecp::ECP;
 use super::ecp2::ECP2;
 //use super::fp12::FP12;
-use super::big::BIG;
+use super::big::Big;
 use super::pair;
 use super::big;
 use super::rom;
@@ -29,15 +30,13 @@ use rand::RAND;
 use sha3::SHA3;
 use sha3::SHAKE256;
 
-/* BLS API Functions */
-
+// BLS API Functions
 pub const BFS: usize = big::MODBYTES as usize;
 pub const BGS: usize = big::MODBYTES as usize;
 pub const BLS_OK: isize = 0;
 pub const BLS_FAIL: isize = -1;
 
-/* hash a message to an ECP point, using SHA3 */
-
+// hash a message to an ECP point, using SHA3
 #[allow(non_snake_case)]
 fn bls_hashit(m: &str) -> ECP {
     let mut sh = SHA3::new(SHAKE256);
@@ -51,27 +50,25 @@ fn bls_hashit(m: &str) -> ECP {
     return P;
 }
 
-/* generate key pair, private key s, public key w */
+// generate key pair, private key s, public key w
 pub fn key_pair_generate(mut rng: &mut RAND, s: &mut [u8], w: &mut [u8]) -> isize {
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
+    let q = Big::new_ints(&rom::CURVE_ORDER);
     let g = ECP2::generator();
-    let mut sc = BIG::randomnum(&q, &mut rng);
+    let mut sc = Big::randomnum(&q, &mut rng);
     sc.tobytes(s);
     pair::g2mul(&g, &mut sc).tobytes(w);
     return BLS_OK;
 }
 
-/* Sign message m using private key s to produce signature sig */
-
+// Sign message m using private key s to produce signature sig
 pub fn sign(sig: &mut [u8], m: &str, s: &[u8]) -> isize {
     let d = bls_hashit(m);
-    let mut sc = BIG::frombytes(&s);
+    let mut sc = Big::frombytes(&s);
     pair::g1mul(&d, &mut sc).tobytes(sig, true);
     return BLS_OK;
 }
 
-/* Verify signature given message m, the signature sig, and the public key w */
-
+// Verify signature given message m, the signature sig, and the public key w
 pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let hm = bls_hashit(m);
     let mut d = ECP::frombytes(&sig);
@@ -79,14 +76,14 @@ pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let pk = ECP2::frombytes(&w);
     d.neg();
 
-// Use new multi-pairing mechanism 
+    // Use new multi-pairing mechanism
     let mut r=pair::initmp();
     pair::another(&mut r,&g,&d);
     pair::another(&mut r,&pk,&hm);
     let mut v=pair::miller(&r);
 
-//.. or alternatively
-//    let mut v = pair::ate2(&g, &d, &pk, &hm);
+    //.. or alternatively
+    //    let mut v = pair::ate2(&g, &d, &pk, &hm);
 
     v = pair::fexp(&v);
     if v.isunity() {
diff --git a/src/bls192.rs b/src/bls192.rs
index 20ee92e..b2c7e97 100644
--- a/src/bls192.rs
+++ b/src/bls192.rs
@@ -16,11 +16,12 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
+
 use std::str;
 use super::ecp::ECP;
 use super::ecp4::ECP4;
 //use super::fp24::FP24;
-use super::big::BIG;
+use super::big::Big;
 use super::pair192;
 use super::big;
 use super::rom;
@@ -29,14 +30,14 @@ use rand::RAND;
 use sha3::SHA3;
 use sha3::SHAKE256;
 
-/* BLS API Functions */
+// BLS API Functions
 
 pub const BFS: usize = big::MODBYTES as usize;
 pub const BGS: usize = big::MODBYTES as usize;
 pub const BLS_OK: isize = 0;
 pub const BLS_FAIL: isize = -1;
 
-/* hash a message to an ECP point, using SHA3 */
+// hash a message to an ECP point, using SHA3
 
 #[allow(non_snake_case)]
 fn bls_hashit(m: &str) -> ECP {
@@ -51,27 +52,25 @@ fn bls_hashit(m: &str) -> ECP {
     return P;
 }
 
-/* generate key pair, private key s, public key w */
+// generate key pair, private key s, public key w
 pub fn key_pair_generate(mut rng: &mut RAND, s: &mut [u8], w: &mut [u8]) -> isize {
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
+    let q = Big::new_ints(&rom::CURVE_ORDER);
     let g = ECP4::generator();
-    let mut sc = BIG::randomnum(&q, &mut rng);
+    let mut sc = Big::randomnum(&q, &mut rng);
     sc.tobytes(s);
     pair192::g2mul(&g, &mut sc).tobytes(w);
     return BLS_OK;
 }
 
-/* Sign message m using private key s to produce signature sig */
-
+// Sign message m using private key s to produce signature sig
 pub fn sign(sig: &mut [u8], m: &str, s: &[u8]) -> isize {
     let d = bls_hashit(m);
-    let mut sc = BIG::frombytes(&s);
+    let mut sc = Big::frombytes(&s);
     pair192::g1mul(&d, &mut sc).tobytes(sig, true);
     return BLS_OK;
 }
 
-/* Verify signature given message m, the signature sig, and the public key w */
-
+// Verify signature given message m, the signature sig, and the public key w
 pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let hm = bls_hashit(m);
     let mut d = ECP::frombytes(&sig);
@@ -79,15 +78,15 @@ pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let pk = ECP4::frombytes(&w);
     d.neg();
 
-// Use new multi-pairing mechanism 
+    // Use new multi-pairing mechanism
     let mut r=pair192::initmp();
     pair192::another(&mut r,&g,&d);
     pair192::another(&mut r,&pk,&hm);
     let mut v=pair192::miller(&r);
 
-//.. or alternatively
-//    let mut v = pair192::ate2(&g, &d, &pk, &hm);
-    
+    //.. or alternatively
+    //    let mut v = pair192::ate2(&g, &d, &pk, &hm);
+
     v = pair192::fexp(&v);
     if v.isunity() {
         return BLS_OK;
diff --git a/src/bls256.rs b/src/bls256.rs
index cdb553d..a0ac094 100644
--- a/src/bls256.rs
+++ b/src/bls256.rs
@@ -16,11 +16,12 @@ KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
+
 use std::str;
 use super::ecp::ECP;
 use super::ecp8::ECP8;
 //use super::fp48::FP48;
-use super::big::BIG;
+use super::big::Big;
 use super::pair256;
 use super::big;
 use super::rom;
@@ -29,15 +30,13 @@ use rand::RAND;
 use sha3::SHA3;
 use sha3::SHAKE256;
 
-/* BLS API Functions */
-
+// BLS API Functions
 pub const BFS: usize = big::MODBYTES as usize;
 pub const BGS: usize = big::MODBYTES as usize;
 pub const BLS_OK: isize = 0;
 pub const BLS_FAIL: isize = -1;
 
-/* hash a message to an ECP point, using SHA3 */
-
+// hash a message to an ECP point, using SHA3
 #[allow(non_snake_case)]
 fn bls_hashit(m: &str) -> ECP {
     let mut sh = SHA3::new(SHAKE256);
@@ -51,27 +50,25 @@ fn bls_hashit(m: &str) -> ECP {
     return P;
 }
 
-/* generate key pair, private key s, public key w */
+// generate key pair, private key s, public key w
 pub fn key_pair_generate(mut rng: &mut RAND, s: &mut [u8], w: &mut [u8]) -> isize {
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
+    let q = Big::new_ints(&rom::CURVE_ORDER);
     let g = ECP8::generator();
-    let mut sc = BIG::randomnum(&q, &mut rng);
+    let mut sc = Big::randomnum(&q, &mut rng);
     sc.tobytes(s);
     pair256::g2mul(&g, &mut sc).tobytes(w);
     return BLS_OK;
 }
 
-/* Sign message m using private key s to produce signature sig */
-
+// Sign message m using private key s to produce signature sig
 pub fn sign(sig: &mut [u8], m: &str, s: &[u8]) -> isize {
     let d = bls_hashit(m);
-    let mut sc = BIG::frombytes(&s);
+    let mut sc = Big::frombytes(&s);
     pair256::g1mul(&d, &mut sc).tobytes(sig, true);
     return BLS_OK;
 }
 
-/* Verify signature given message m, the signature sig, and the public key w */
-
+// Verify signature given message m, the signature sig, and the public key w
 pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let hm = bls_hashit(m);
     let mut d = ECP::frombytes(&sig);
@@ -79,14 +76,14 @@ pub fn verify(sig: &[u8], m: &str, w: &[u8]) -> isize {
     let pk = ECP8::frombytes(&w);
     d.neg();
 
-// Use new multi-pairing mechanism 
+    // Use new multi-pairing mechanism
     let mut r=pair256::initmp();
     pair256::another(&mut r,&g,&d);
     pair256::another(&mut r,&pk,&hm);
     let mut v=pair256::miller(&r);
 
-//.. or alternatively
-//    let mut v = pair256::ate2(&g, &d, &pk, &hm);
+    //.. or alternatively
+    //    let mut v = pair256::ate2(&g, &d, &pk, &hm);
 
     v = pair256::fexp(&v);
     if v.isunity() {
diff --git a/src/dbig.rs b/src/dbig.rs
index 353443a..31cf402 100644
--- a/src/dbig.rs
+++ b/src/dbig.rs
@@ -19,35 +19,35 @@ under the License.
 
 use super::super::arch;
 use super::big;
-use super::big::BIG;
+use super::big::Big;
 use super::super::arch::Chunk;
 
 #[derive(Copy)]
-pub struct DBIG {
+pub struct DBig {
     pub w: [Chunk; big::DNLEN],
 }
 
-impl Clone for DBIG {
-    fn clone(&self) -> DBIG { *self }
+impl Clone for DBig {
+    fn clone(&self) -> DBig { *self }
 }
 
-impl DBIG {
-    pub fn new() -> DBIG {
-        DBIG {
+impl DBig {
+    pub fn new() -> DBig {
+        DBig {
             w: [0; big::DNLEN as usize],
         }
     }
 
-    pub fn new_copy(y: &DBIG) -> DBIG {
-        let mut s = DBIG::new();
+    pub fn new_copy(y: &DBig) -> DBig {
+        let mut s = DBig::new();
         for i in 0..big::DNLEN {
             s.w[i] = y.w[i]
         }
         return s;
     }
 
-    pub fn new_scopy(x: &BIG) -> DBIG {
-        let mut b = DBIG::new();
+    pub fn new_scopy(x: &Big) -> DBig {
+        let mut b = DBig::new();
         for i in 0..big::NLEN {
             b.w[i] = x.w[i];
         }
@@ -60,9 +60,9 @@ impl DBIG {
         return b;
     }
 
-    /* split DBIG at position n, return higher half, keep lower half */
-    pub fn split(&mut self, n: usize) -> BIG {
-        let mut t = BIG::new();
+    /* split DBig at position n, return higher half, keep lower half */
+    pub fn split(&mut self, n: usize) -> Big {
+        let mut t = Big::new();
         let m = n % big::BASEBITS;
         let mut carry = self.w[big::DNLEN - 1] << (big::BASEBITS - m);
 
@@ -106,14 +106,14 @@ impl DBIG {
         }
     }
 
-    /* Copy from another DBIG */
-    pub fn copy(&mut self, x: &DBIG) {
+    /* Copy from another DBig */
+    pub fn copy(&mut self, x: &DBig) {
         for i in 0..big::DNLEN {
             self.w[i] = x.w[i];
         }
     }
 
-    pub fn ucopy(&mut self, x: &BIG) {
+    pub fn ucopy(&mut self, x: &Big) {
         for i in 0..big::NLEN {
             self.w[i] = 0;
         }
@@ -122,7 +122,7 @@ impl DBIG {
         }
     }
 
-    pub fn cmove(&mut self, g: &DBIG, d: isize) {
+    pub fn cmove(&mut self, g: &DBig, d: isize) {
         let b = -d as Chunk;
         for i in 0..big::DNLEN {
             self.w[i] ^= (self.w[i] ^ g.w[i]) & b;
@@ -130,28 +130,28 @@ impl DBIG {
     }
 
     /* self+=x */
-    pub fn add(&mut self, x: &DBIG) {
+    pub fn add(&mut self, x: &DBig) {
         for i in 0..big::DNLEN {
             self.w[i] += x.w[i];
         }
     }
 
     /* self-=x */
-    pub fn sub(&mut self, x: &DBIG) {
+    pub fn sub(&mut self, x: &DBig) {
         for i in 0..big::DNLEN {
             self.w[i] -= x.w[i];
         }
     }
 
     /* self=x-self */
-    pub fn rsub(&mut self, x: &DBIG) {
+    pub fn rsub(&mut self, x: &DBig) {
         for i in 0..big::DNLEN {
             self.w[i] = x.w[i] - self.w[i];
         }
     }
 
     /* Compare a and b, return 0 if a==b, -1 if a<b, +1 if a>b. Inputs must be normalised */
-    pub fn comp(a: &DBIG, b: &DBIG) -> isize {
+    pub fn comp(a: &DBig, b: &DBig) -> isize {
         for i in (0..big::DNLEN).rev() {
             if a.w[i] == b.w[i] {
                 continue;
@@ -165,7 +165,7 @@ impl DBIG {
         return 0;
     }
 
-    /* normalise BIG - force all digits < 2^big::BASEBITS */
+    /* normalise Big - force all digits < 2^big::BASEBITS */
     pub fn norm(&mut self) {
         let mut carry = 0 as Chunk;
         for i in 0..big::DNLEN - 1 {
@@ -176,22 +176,22 @@ impl DBIG {
         self.w[big::DNLEN - 1] += carry
     }
 
-    /* reduces self DBIG mod a BIG, and returns the BIG */
-    pub fn dmod(&mut self, c: &BIG) -> BIG {
+    /* reduces self DBig mod a Big, and returns the Big */
+    pub fn dmod(&mut self, c: &Big) -> Big {
         let mut k = 0;
         self.norm();
-        let mut m = DBIG::new_scopy(c);
-        let mut dr = DBIG::new();
+        let mut m = DBig::new_scopy(c);
+        let mut dr = DBig::new();
 
-        if DBIG::comp(self, &m) < 0 {
-            let r = BIG::new_dcopy(self);
+        if DBig::comp(self, &m) < 0 {
+            let r = Big::new_dcopy(self);
             return r;
         }
 
         loop {
             m.shl(1);
             k += 1;
-            if DBIG::comp(self, &m) < 0 {
+            if DBig::comp(self, &m) < 0 {
                 break;
             }
         }
@@ -209,21 +209,21 @@ impl DBIG {
 
             k -= 1;
         }
-        let r = BIG::new_dcopy(self);
+        let r = Big::new_dcopy(self);
         return r;
     }
 
     /* return this/c */
-    pub fn div(&mut self, c: &BIG) -> BIG {
+    pub fn div(&mut self, c: &Big) -> Big {
         let mut k = 0;
-        let mut m = DBIG::new_scopy(c);
-        let mut a = BIG::new();
-        let mut e = BIG::new_int(1);
-        let mut dr = DBIG::new();
-        let mut r = BIG::new();
+        let mut m = DBig::new_scopy(c);
+        let mut a = Big::new();
+        let mut e = Big::new_int(1);
+        let mut dr = DBig::new();
+        let mut r = Big::new();
         self.norm();
 
-        while DBIG::comp(self, &m) >= 0 {
+        while DBig::comp(self, &m) >= 0 {
             e.fshl(1);
             m.shl(1);
             k += 1;
@@ -262,7 +262,7 @@ impl DBIG {
     /* return number of bits */
     pub fn nbits(&mut self) -> usize {
         let mut k = big::DNLEN - 1;
-        let mut s = DBIG::new_copy(&self);
+        let mut s = DBig::new_copy(&self);
         s.norm();
         while (k as isize) >= 0 && s.w[k] == 0 {
             k = k.wrapping_sub(1)
@@ -292,7 +292,7 @@ impl DBIG {
         }
 
         for i in (0..len).rev() {
-            let mut b = DBIG::new_copy(&self);
+            let mut b = DBig::new_copy(&self);
             b.shr(i * 4);
             s = s + &format!("{:X}", b.w[0] & 15);
         }
diff --git a/src/ecdh.rs b/src/ecdh.rs
index 9b49e18..1df8446 100644
--- a/src/ecdh.rs
+++ b/src/ecdh.rs
@@ -19,7 +19,7 @@ under the License.
 
 use super::ecp;
 use super::ecp::ECP;
-use super::big::BIG;
+use super::big::Big;
 use super::rom;
 use super::big;
 
@@ -393,15 +393,15 @@ pub fn cbc_iv0_decrypt(k: &[u8], c: &[u8]) -> Option<Vec<u8>> {
 #[allow(non_snake_case)]
 pub fn key_pair_generate(rng: Option<&mut RAND>, s: &mut [u8], w: &mut [u8]) -> isize {
     let res = 0;
-    let mut sc: BIG;
+    let mut sc: Big;
     let G = ECP::generator();
 
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
     if let Some(mut x) = rng {
-        sc = BIG::randomnum(&r, &mut x);
+        sc = Big::randomnum(&r, &mut x);
     } else {
-        sc = BIG::frombytes(&s);
+        sc = Big::frombytes(&s);
         sc.rmod(&r);
     }
 
@@ -420,15 +420,15 @@ pub fn public_key_validate(w: &[u8]) -> isize {
     let mut WP = ECP::frombytes(w);
     let mut res = 0;
 
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
     if WP.is_infinity() {
         res = INVALID_PUBLIC_KEY
     }
     if res == 0 {
-        let q = BIG::new_ints(&rom::MODULUS);
+        let q = Big::new_ints(&rom::MODULUS);
         let nb = q.nbits();
-        let mut k = BIG::new();
+        let mut k = Big::new();
         k.one();
         k.shl((nb + 4) / 2);
         k.add(&q);
@@ -455,7 +455,7 @@ pub fn ecpsvdp_dh(s: &[u8], wd: &[u8], z: &mut [u8]) -> isize {
     let mut res = 0;
     let mut t: [u8; EFS] = [0; EFS];
 
-    let mut sc = BIG::frombytes(&s);
+    let mut sc = Big::frombytes(&s);
 
     let mut W = ECP::frombytes(&wd);
     if W.is_infinity() {
@@ -463,7 +463,7 @@ pub fn ecpsvdp_dh(s: &[u8], wd: &[u8], z: &mut [u8]) -> isize {
     }
 
     if res == 0 {
-        let r = BIG::new_ints(&rom::CURVE_ORDER);
+        let r = Big::new_ints(&rom::CURVE_ORDER);
         sc.rmod(&r);
         W = W.mul(&mut sc);
         if W.is_infinity() {
@@ -495,19 +495,19 @@ pub fn ecpsp_dsa(
 
     let G = ECP::generator();
 
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
-    let mut sc = BIG::frombytes(s); /* s or &s? */
-    let fb = BIG::frombytes(&b);
+    let mut sc = Big::frombytes(s); /* s or &s? */
+    let fb = Big::frombytes(&b);
 
-    let mut cb = BIG::new();
-    let mut db = BIG::new();
-    let mut tb = BIG::new();
+    let mut cb = Big::new();
+    let mut db = Big::new();
+    let mut tb = Big::new();
     let mut V = ECP::new();
 
     while db.iszilch() {
-        let mut u = BIG::randomnum(&r, rng);
-        let mut w = BIG::randomnum(&r, rng); /* side channel masking */
+        let mut u = Big::randomnum(&r, rng);
+        let mut w = Big::randomnum(&r, rng); /* side channel masking */
 
         V.copy(&G);
         V = V.mul(&mut u);
@@ -518,17 +518,17 @@ pub fn ecpsp_dsa(
             continue;
         }
 
-        tb.copy(&BIG::modmul(&mut u, &mut w, &r));
+        tb.copy(&Big::modmul(&mut u, &mut w, &r));
         u.copy(&tb);
 
         u.invmodp(&r);
-        db.copy(&BIG::modmul(&mut sc, &mut cb, &r));
+        db.copy(&Big::modmul(&mut sc, &mut cb, &r));
         db.add(&fb);
 
-        tb.copy(&BIG::modmul(&mut db, &mut w, &r));
+        tb.copy(&Big::modmul(&mut db, &mut w, &r));
         db.copy(&tb);
 
-        tb.copy(&BIG::modmul(&mut u, &mut db, &r));
+        tb.copy(&Big::modmul(&mut u, &mut db, &r));
         db.copy(&tb);
     }
 
@@ -554,22 +554,22 @@ pub fn ecpvp_dsa(sha: usize, w: &[u8], f: &[u8], c: &[u8], d: &[u8]) -> isize {
 
     let mut G = ECP::generator();
 
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
-    let mut cb = BIG::frombytes(c); /* c or &c ? */
-    let mut db = BIG::frombytes(d); /* d or &d ? */
-    let mut fb = BIG::frombytes(&b);
-    let mut tb = BIG::new();
+    let mut cb = Big::frombytes(c); /* c or &c ? */
+    let mut db = Big::frombytes(d); /* d or &d ? */
+    let mut fb = Big::frombytes(&b);
+    let mut tb = Big::new();
 
-    if cb.iszilch() || BIG::comp(&cb, &r) >= 0 || db.iszilch() || BIG::comp(&db, &r) >= 0 {
+    if cb.iszilch() || Big::comp(&cb, &r) >= 0 || db.iszilch() || Big::comp(&db, &r) >= 0 {
         res = INVALID;
     }
 
     if res == 0 {
         db.invmodp(&r);
-        tb.copy(&BIG::modmul(&mut fb, &mut db, &r));
+        tb.copy(&Big::modmul(&mut fb, &mut db, &r));
         fb.copy(&tb);
-        let h2 = BIG::modmul(&mut cb, &mut db, &r);
+        let h2 = Big::modmul(&mut cb, &mut db, &r);
 
         let WP = ECP::frombytes(&w);
         if WP.is_infinity() {
@@ -586,7 +586,7 @@ pub fn ecpvp_dsa(sha: usize, w: &[u8], f: &[u8], c: &[u8], d: &[u8]) -> isize {
                 db = P.getx();
                 db.rmod(&r);
 
-                if BIG::comp(&db, &cb) != 0 {
+                if Big::comp(&db, &cb) != 0 {
                     res = INVALID
                 }
             }
diff --git a/src/ecp.rs b/src/ecp.rs
index 9e7b29c..0e27f32 100644
--- a/src/ecp.rs
+++ b/src/ecp.rs
@@ -18,7 +18,7 @@ under the License.
 */
 
 use super::fp::FP;
-use super::big::BIG;
+use super::big::Big;
 use super::big;
 use super::rom;
 
@@ -70,8 +70,8 @@ impl ECP {
         return E;
     }
 
-    /* set (x,y) from two BIGs */
-    pub fn new_bigs(ix: &BIG, iy: &BIG) -> ECP {
+    /* set (x,y) from two Bigs */
+    pub fn new_bigs(ix: &Big, iy: &Big) -> ECP {
         let mut E = ECP::new();
         E.x.bcopy(ix);
         E.y.bcopy(iy);
@@ -92,8 +92,8 @@ impl ECP {
         return E;
     }
 
-    /* set (x,y) from BIG and a bit */
-    pub fn new_bigint(ix: &BIG, s: isize) -> ECP {
+    /* set (x,y) from Big and a bit */
+    pub fn new_bigint(ix: &Big, s: isize) -> ECP {
         let mut E = ECP::new();
         E.x.bcopy(ix);
         E.x.norm();
@@ -115,7 +115,7 @@ impl ECP {
 
     #[allow(non_snake_case)]
     /* set from x - calculate y from curve equation */
-    pub fn new_big(ix: &BIG) -> ECP {
+    pub fn new_big(ix: &Big) -> ECP {
         let mut E = ECP::new();
         E.x.bcopy(ix);
         E.x.norm();
@@ -151,7 +151,7 @@ impl ECP {
 
         if CURVETYPE == CurveType::WEIERSTRASS {
             // x^3+Ax+B
-            let b = FP::new_big(&BIG::new_ints(&rom::CURVE_B));
+            let b = FP::new_big(&Big::new_ints(&rom::CURVE_B));
             r.mul(x);
             if rom::CURVE_A == -3 {
                 let mut cx = FP::new_copy(x);
@@ -164,7 +164,7 @@ impl ECP {
         }
         if CURVETYPE == CurveType::EDWARDS {
             // (Ax^2-1)/(Bx^2-1)
-            let mut b = FP::new_big(&BIG::new_ints(&rom::CURVE_B));
+            let mut b = FP::new_big(&Big::new_ints(&rom::CURVE_B));
             let one = FP::new_int(1);
             b.mul(&r);
             b.sub(&one);
@@ -316,16 +316,16 @@ impl ECP {
         self.z.copy(&one);
     }
 
-    /* extract x as a BIG */
-    pub fn getx(&self) -> BIG {
+    /* extract x as a Big */
+    pub fn getx(&self) -> Big {
         let mut W = ECP::new();
         W.copy(self);
         W.affine();
         return W.x.redc();
     }
 
-    /* extract y as a BIG */
-    pub fn gety(&self) -> BIG {
+    /* extract y as a Big */
+    pub fn gety(&self) -> Big {
         let mut W = ECP::new();
         W.copy(self);
         W.affine();
@@ -393,13 +393,13 @@ impl ECP {
     pub fn frombytes(b: &[u8]) -> ECP {
         let mut t: [u8; big::MODBYTES as usize] = [0; big::MODBYTES as usize];
         let mb = big::MODBYTES as usize;
-        let p = BIG::new_ints(&rom::MODULUS);
+        let p = Big::new_ints(&rom::MODULUS);
 
         for i in 0..mb {
             t[i] = b[i + 1]
         }
-        let px = BIG::frombytes(&t);
-        if BIG::comp(&px, &p) >= 0 {
+        let px = Big::frombytes(&t);
+        if Big::comp(&px, &p) >= 0 {
             return ECP::new();
         }
 
@@ -411,8 +411,8 @@ impl ECP {
             for i in 0..mb {
                 t[i] = b[i + mb + 1]
             }
-            let py = BIG::frombytes(&t);
-            if BIG::comp(&py, &p) >= 0 {
+            let py = Big::frombytes(&t);
+            if Big::comp(&py, &p) >= 0 {
                 return ECP::new();
             }
             return ECP::new_bigs(&px, &py);
@@ -509,7 +509,7 @@ impl ECP {
                 let mut b = FP::new();
 
                 if rom::CURVE_B_I == 0 {
-                    b.copy(&FP::new_big(&BIG::new_ints(&rom::CURVE_B)));
+                    b.copy(&FP::new_big(&Big::new_ints(&rom::CURVE_B)));
                 }
 
                 t0.sqr(); //1    x^2
@@ -742,7 +742,7 @@ impl ECP {
                 let mut b = FP::new();
 
                 if rom::CURVE_B_I == 0 {
-                    b.copy(&FP::new_big(&BIG::new_ints(&rom::CURVE_B)));
+                    b.copy(&FP::new_big(&Big::new_ints(&rom::CURVE_B)));
                 }
 
                 t0.mul(&Q.x); //1
@@ -848,7 +848,7 @@ impl ECP {
             }
         }
         if CURVETYPE == CurveType::EDWARDS {
-            let bb = FP::new_big(&BIG::new_ints(&rom::CURVE_B));
+            let bb = FP::new_big(&Big::new_ints(&rom::CURVE_B));
             let mut a = FP::new_copy(&self.z);
             let mut b = FP::new();
             let mut c = FP::new_copy(&self.x);
@@ -960,7 +960,7 @@ impl ECP {
     /* constant time multiply by small integer of length bts - use ladder */
     pub fn pinmul(&self, e: i32, bts: i32) -> ECP {
         if CURVETYPE == CurveType::MONTGOMERY {
-            return self.mul(&mut BIG::new_int(e as isize));
+            return self.mul(&mut Big::new_int(e as isize));
         } else {
             let mut P = ECP::new();
             let mut R0 = ECP::new();
@@ -984,7 +984,7 @@ impl ECP {
 
     /* return e.self */
 
-    pub fn mul(&self, e: &BIG) -> ECP {
+    pub fn mul(&self, e: &Big) -> ECP {
         if e.iszilch() || self.is_infinity() {
             return ECP::new();
         }
@@ -1013,8 +1013,8 @@ impl ECP {
             P.copy(&R0)
         } else {
             // fixed size windows
-            let mut mt = BIG::new();
-            let mut t = BIG::new();
+            let mut mt = Big::new();
+            let mut t = Big::new();
             let mut Q = ECP::new();
             let mut C = ECP::new();
 
@@ -1084,10 +1084,10 @@ impl ECP {
 
     /* Return e.this+f.Q */
 
-    pub fn mul2(&self, e: &BIG, Q: &ECP, f: &BIG) -> ECP {
-        let mut te = BIG::new();
-        let mut tf = BIG::new();
-        let mut mt = BIG::new();
+    pub fn mul2(&self, e: &Big, Q: &ECP, f: &Big) -> ECP {
+        let mut te = Big::new();
+        let mut tf = Big::new();
+        let mut mt = Big::new();
         let mut S = ECP::new();
         let mut T = ECP::new();
         let mut C = ECP::new();
@@ -1210,7 +1210,7 @@ impl ECP {
             self.dbl();
             return;
         }
-        let c = BIG::new_ints(&rom::CURVE_COF);
+        let c = Big::new_ints(&rom::CURVE_COF);
         let P = self.mul(&c);
         self.copy(&P);
     }
@@ -1218,8 +1218,8 @@ impl ECP {
     // Map a given byte slice to a point on the curve. The byte slice should be atleast the size of the modulus
     #[allow(non_snake_case)]
     pub fn mapit(h: &[u8]) -> ECP {
-        let mut q = BIG::new_ints(&rom::MODULUS);
-        let mut x = BIG::frombytes(h);
+        let mut q = Big::new_ints(&rom::MODULUS);
+        let mut x = Big::frombytes(h);
         x.rmod(&mut q);
         let mut P: ECP;
 
@@ -1248,10 +1248,10 @@ impl ECP {
     pub fn generator() -> ECP {
         let G: ECP;
 
-        let gx = BIG::new_ints(&rom::CURVE_GX);
+        let gx = Big::new_ints(&rom::CURVE_GX);
 
         if CURVETYPE != CurveType::MONTGOMERY {
-            let gy = BIG::new_ints(&rom::CURVE_GY);
+            let gy = Big::new_ints(&rom::CURVE_GY);
             G = ECP::new_bigs(&gx, &gy);
         } else {
             G = ECP::new_big(&gx);
diff --git a/src/ecp2.rs b/src/ecp2.rs
index afd9376..c705863 100644
--- a/src/ecp2.rs
+++ b/src/ecp2.rs
@@ -21,7 +21,7 @@ use super::rom;
 use super::big;
 use super::ecp;
 use super::fp2::FP2;
-use super::big::BIG;
+use super::big::Big;
 use types::{SexticTwist, CurvePairingType, SignOfX};
 use std::str::SplitWhitespace;
 use std::fmt;
@@ -259,21 +259,21 @@ impl ECP2 {
         for i in 0..mb {
             t[i] = b[i]
         }
-        let mut ra = BIG::frombytes(&t);
+        let mut ra = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = b[i + mb]
         }
-        let mut rb = BIG::frombytes(&t);
+        let mut rb = Big::frombytes(&t);
         let rx = FP2::new_bigs(&ra, &rb);
 
         for i in 0..mb {
             t[i] = b[i + 2 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 3 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
         let ry = FP2::new_bigs(&ra, &rb);
 
         return ECP2::new_fp2s(&rx, &ry);
@@ -311,7 +311,7 @@ impl ECP2 {
     pub fn rhs(x: &FP2) -> FP2 {
         let mut r = FP2::new_copy(x);
         r.sqr();
-        let mut b = FP2::new_big(&BIG::new_ints(&rom::CURVE_B));
+        let mut b = FP2::new_big(&Big::new_ints(&rom::CURVE_B));
         if ecp::SEXTIC_TWIST == SexticTwist::D_TYPE {
             b.div_ip();
         }
@@ -513,10 +513,10 @@ impl ECP2 {
     }
 
     /* self*=e */
-    pub fn mul(&self, e: &BIG) -> ECP2 {
+    pub fn mul(&self, e: &Big) -> ECP2 {
         /* fixed size windows */
-        let mut mt = BIG::new();
-        let mut t = BIG::new();
+        let mut mt = Big::new();
+        let mut t = Big::new();
         let mut P = ECP2::new();
         let mut Q = ECP2::new();
         let mut C = ECP2::new();
@@ -594,7 +594,7 @@ impl ECP2 {
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
 
-    pub fn mul4(Q: &mut [ECP2], u: &[BIG]) -> ECP2 {
+    pub fn mul4(Q: &mut [ECP2], u: &[Big]) -> ECP2 {
         let mut W = ECP2::new();
         let mut P = ECP2::new();
 
@@ -609,13 +609,13 @@ impl ECP2 {
             ECP2::new(),
         ];
 
-        let mut mt = BIG::new();
+        let mut mt = Big::new();
 
-        let mut t: [BIG; 4] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
+        let mut t: [Big; 4] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
         ];
 
         const CT: usize = 1 + big::NLEN * (big::BASEBITS as usize);
@@ -702,11 +702,11 @@ impl ECP2 {
 
     #[allow(non_snake_case)]
     pub fn mapit(h: &[u8]) -> ECP2 {
-        let mut q = BIG::new_ints(&rom::MODULUS);
-        let mut x = BIG::frombytes(h);
+        let mut q = Big::new_ints(&rom::MODULUS);
+        let mut x = Big::frombytes(h);
         x.rmod(&mut q);
         let mut Q: ECP2;
-        let one = BIG::new_int(1);
+        let one = Big::new_int(1);
 
         loop {
             let X = FP2::new_bigs(&one, &x);
@@ -717,12 +717,12 @@ impl ECP2 {
             x.inc(1);
             x.norm();
         }
-        let mut X = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
+        let mut X = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
         if ecp::SEXTIC_TWIST == SexticTwist::M_TYPE {
             X.inverse();
             X.norm();
         }
-        x = BIG::new_ints(&rom::CURVE_BNX);
+        x = Big::new_ints(&rom::CURVE_BNX);
 
         if ecp::CURVE_PAIRING_TYPE == CurvePairingType::BN {
             let mut T = Q.mul(&mut x);
@@ -772,12 +772,12 @@ impl ECP2 {
     pub fn generator() -> ECP2 {
         return ECP2::new_fp2s(
             &FP2::new_bigs(
-                &BIG::new_ints(&rom::CURVE_PXA),
-                &BIG::new_ints(&rom::CURVE_PXB),
+                &Big::new_ints(&rom::CURVE_PXA),
+                &Big::new_ints(&rom::CURVE_PXB),
             ),
             &FP2::new_bigs(
-                &BIG::new_ints(&rom::CURVE_PYA),
-                &BIG::new_ints(&rom::CURVE_PYB),
+                &Big::new_ints(&rom::CURVE_PYA),
+                &Big::new_ints(&rom::CURVE_PYB),
             ),
         );
     }
diff --git a/src/ecp4.rs b/src/ecp4.rs
index d34b0fd..b29b05d 100644
--- a/src/ecp4.rs
+++ b/src/ecp4.rs
@@ -22,7 +22,7 @@ use super::big;
 use super::ecp;
 use super::fp2::FP2;
 use super::fp4::FP4;
-use super::big::BIG;
+use super::big::Big;
 use types::{SexticTwist, SignOfX};
 //use std::str::SplitWhitespace;
 
@@ -263,22 +263,22 @@ impl ECP4 {
         for i in 0..mb {
             t[i] = b[i]
         }
-        let mut ra = BIG::frombytes(&t);
+        let mut ra = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = b[i + mb]
         }
-        let mut rb = BIG::frombytes(&t);
+        let mut rb = Big::frombytes(&t);
 
         let mut ra4 = FP2::new_bigs(&ra, &rb);
 
         for i in 0..mb {
             t[i] = b[i + 2 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 3 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         let mut rb4 = FP2::new_bigs(&ra, &rb);
 
@@ -287,22 +287,22 @@ impl ECP4 {
         for i in 0..mb {
             t[i] = b[i + 4 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 5 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         ra4.copy(&FP2::new_bigs(&ra, &rb));
 
         for i in 0..mb {
             t[i] = b[i + 6 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 7 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         rb4.copy(&FP2::new_bigs(&ra, &rb));
 
@@ -327,7 +327,7 @@ impl ECP4 {
         //x.norm();
         let mut r = FP4::new_copy(x);
         r.sqr();
-        let mut b = FP4::new_fp2(&FP2::new_big(&BIG::new_ints(&rom::CURVE_B)));
+        let mut b = FP4::new_fp2(&FP2::new_big(&Big::new_ints(&rom::CURVE_B)));
         if ecp::SEXTIC_TWIST == SexticTwist::D_TYPE {
             b.div_i();
         }
@@ -506,7 +506,7 @@ impl ECP4 {
     }
 
     pub fn frob_constants() -> [FP2; 3] {
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
 
         let mut f0 = FP2::new_copy(&f);
         f0.sqr();
@@ -546,10 +546,10 @@ impl ECP4 {
     }
 
     /* self*=e */
-    pub fn mul(&self, e: &BIG) -> ECP4 {
+    pub fn mul(&self, e: &Big) -> ECP4 {
         /* fixed size windows */
-        let mut mt = BIG::new();
-        let mut t = BIG::new();
+        let mut mt = Big::new();
+        let mut t = Big::new();
         let mut P = ECP4::new();
         let mut Q = ECP4::new();
         let mut C = ECP4::new();
@@ -627,7 +627,7 @@ impl ECP4 {
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
 
-    pub fn mul8(Q: &mut [ECP4], u: &[BIG]) -> ECP4 {
+    pub fn mul8(Q: &mut [ECP4], u: &[Big]) -> ECP4 {
         let mut W = ECP4::new();
         let mut P = ECP4::new();
 
@@ -652,17 +652,17 @@ impl ECP4 {
             ECP4::new(),
         ];
 
-        let mut mt = BIG::new();
-
-        let mut t: [BIG; 8] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
-            BIG::new_copy(&u[4]),
-            BIG::new_copy(&u[5]),
-            BIG::new_copy(&u[6]),
-            BIG::new_copy(&u[7]),
+        let mut mt = Big::new();
+
+        let mut t: [Big; 8] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
+            Big::new_copy(&u[4]),
+            Big::new_copy(&u[5]),
+            Big::new_copy(&u[6]),
+            Big::new_copy(&u[7]),
         ];
 
         const CT: usize = 1 + big::NLEN * (big::BASEBITS as usize);
@@ -788,22 +788,22 @@ impl ECP4 {
         return ECP4::new_fp4s(
             &FP4::new_fp2s(
                 &FP2::new_bigs(
-                    &BIG::new_ints(&rom::CURVE_PXAA),
-                    &BIG::new_ints(&rom::CURVE_PXAB),
+                    &Big::new_ints(&rom::CURVE_PXAA),
+                    &Big::new_ints(&rom::CURVE_PXAB),
                 ),
                 &FP2::new_bigs(
-                    &BIG::new_ints(&rom::CURVE_PXBA),
-                    &BIG::new_ints(&rom::CURVE_PXBB),
+                    &Big::new_ints(&rom::CURVE_PXBA),
+                    &Big::new_ints(&rom::CURVE_PXBB),
                 ),
             ),
             &FP4::new_fp2s(
                 &FP2::new_bigs(
-                    &BIG::new_ints(&rom::CURVE_PYAA),
-                    &BIG::new_ints(&rom::CURVE_PYAB),
+                    &Big::new_ints(&rom::CURVE_PYAA),
+                    &Big::new_ints(&rom::CURVE_PYAB),
                 ),
                 &FP2::new_bigs(
-                    &BIG::new_ints(&rom::CURVE_PYBA),
-                    &BIG::new_ints(&rom::CURVE_PYBB),
+                    &Big::new_ints(&rom::CURVE_PYBA),
+                    &Big::new_ints(&rom::CURVE_PYBB),
                 ),
             ),
         );
@@ -811,11 +811,11 @@ impl ECP4 {
 
     #[allow(non_snake_case)]
     pub fn mapit(h: &[u8]) -> ECP4 {
-        let mut q = BIG::new_ints(&rom::MODULUS);
-        let mut x = BIG::frombytes(h);
+        let mut q = Big::new_ints(&rom::MODULUS);
+        let mut x = Big::frombytes(h);
         x.rmod(&mut q);
         let mut Q: ECP4;
-        let one = BIG::new_int(1);
+        let one = Big::new_int(1);
 
         loop {
             let X = FP4::new_fp2(&FP2::new_bigs(&one, &x));
@@ -828,7 +828,7 @@ impl ECP4 {
         }
 
         let f = ECP4::frob_constants();
-        x = BIG::new_ints(&rom::CURVE_BNX);
+        x = Big::new_ints(&rom::CURVE_BNX);
 
         let mut xQ = Q.mul(&mut x);
         let mut x2Q = xQ.mul(&mut x);
diff --git a/src/ecp8.rs b/src/ecp8.rs
index a6d32a4..18c8a30 100644
--- a/src/ecp8.rs
+++ b/src/ecp8.rs
@@ -23,7 +23,7 @@ use super::ecp;
 use super::fp2::FP2;
 use super::fp4::FP4;
 use super::fp8::FP8;
-use super::big::BIG;
+use super::big::Big;
 use types::{SexticTwist, SignOfX};
 
 pub struct ECP8 {
@@ -298,22 +298,22 @@ impl ECP8 {
         for i in 0..mb {
             t[i] = b[i]
         }
-        let mut ra = BIG::frombytes(&t);
+        let mut ra = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = b[i + mb]
         }
-        let mut rb = BIG::frombytes(&t);
+        let mut rb = Big::frombytes(&t);
 
         let mut ra4 = FP2::new_bigs(&ra, &rb);
 
         for i in 0..mb {
             t[i] = b[i + 2 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 3 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         let mut rb4 = FP2::new_bigs(&ra, &rb);
 
@@ -322,22 +322,22 @@ impl ECP8 {
         for i in 0..mb {
             t[i] = b[i + 4 * mb]
         }
-        let mut ra = BIG::frombytes(&t);
+        let mut ra = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = b[i + 5 * mb]
         }
-        let mut rb = BIG::frombytes(&t);
+        let mut rb = Big::frombytes(&t);
 
         ra4.copy(&FP2::new_bigs(&ra, &rb));
 
         for i in 0..mb {
             t[i] = b[i + 6 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 7 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         rb4.copy(&FP2::new_bigs(&ra, &rb));
 
@@ -348,22 +348,22 @@ impl ECP8 {
         for i in 0..mb {
             t[i] = b[i + 8 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 9 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         ra4.copy(&FP2::new_bigs(&ra, &rb));
 
         for i in 0..mb {
             t[i] = b[i + 10 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 11 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         rb4.copy(&FP2::new_bigs(&ra, &rb));
 
@@ -372,22 +372,22 @@ impl ECP8 {
         for i in 0..mb {
             t[i] = b[i + 12 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 13 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         ra4.copy(&FP2::new_bigs(&ra, &rb));
 
         for i in 0..mb {
             t[i] = b[i + 14 * mb]
         }
-        ra.copy(&BIG::frombytes(&t));
+        ra.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = b[i + 15 * mb]
         }
-        rb.copy(&BIG::frombytes(&t));
+        rb.copy(&Big::frombytes(&t));
 
         rb4.copy(&FP2::new_bigs(&ra, &rb));
 
@@ -413,7 +413,7 @@ impl ECP8 {
     pub fn rhs(x: &FP8) -> FP8 {
         let mut r = FP8::new_copy(x);
         r.sqr();
-        let mut b = FP8::new_fp4(&FP4::new_fp2(&FP2::new_big(&BIG::new_ints(&rom::CURVE_B))));
+        let mut b = FP8::new_fp4(&FP4::new_fp2(&FP2::new_big(&Big::new_ints(&rom::CURVE_B))));
         if ecp::SEXTIC_TWIST == SexticTwist::D_TYPE {
             b.div_i();
         }
@@ -592,7 +592,7 @@ impl ECP8 {
     }
 
     pub fn frob_constants() -> [FP2; 3] {
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
 
         let mut f0 = FP2::new_copy(&f);
         f0.sqr();
@@ -648,10 +648,10 @@ impl ECP8 {
     }
 
     /* self*=e */
-    pub fn mul(&self, e: &BIG) -> ECP8 {
+    pub fn mul(&self, e: &Big) -> ECP8 {
         /* fixed size windows */
-        let mut mt = BIG::new();
-        let mut t = BIG::new();
+        let mut mt = Big::new();
+        let mut t = Big::new();
         let mut P = ECP8::new();
         let mut Q = ECP8::new();
         let mut C = ECP8::new();
@@ -729,7 +729,7 @@ impl ECP8 {
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
 
-    pub fn mul16(Q: &mut [ECP8], u: &[BIG]) -> ECP8 {
+    pub fn mul16(Q: &mut [ECP8], u: &[Big]) -> ECP8 {
         let mut W = ECP8::new();
         let mut P = ECP8::new();
 
@@ -774,25 +774,25 @@ impl ECP8 {
             ECP8::new(),
         ];
 
-        let mut mt = BIG::new();
-
-        let mut t: [BIG; 16] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
-            BIG::new_copy(&u[4]),
-            BIG::new_copy(&u[5]),
-            BIG::new_copy(&u[6]),
-            BIG::new_copy(&u[7]),
-            BIG::new_copy(&u[8]),
-            BIG::new_copy(&u[9]),
-            BIG::new_copy(&u[10]),
-            BIG::new_copy(&u[11]),
-            BIG::new_copy(&u[12]),
-            BIG::new_copy(&u[13]),
-            BIG::new_copy(&u[14]),
-            BIG::new_copy(&u[15]),
+        let mut mt = Big::new();
+
+        let mut t: [Big; 16] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
+            Big::new_copy(&u[4]),
+            Big::new_copy(&u[5]),
+            Big::new_copy(&u[6]),
+            Big::new_copy(&u[7]),
+            Big::new_copy(&u[8]),
+            Big::new_copy(&u[9]),
+            Big::new_copy(&u[10]),
+            Big::new_copy(&u[11]),
+            Big::new_copy(&u[12]),
+            Big::new_copy(&u[13]),
+            Big::new_copy(&u[14]),
+            Big::new_copy(&u[15]),
         ];
 
         const CT: usize = 1 + big::NLEN * (big::BASEBITS as usize);
@@ -1031,44 +1031,44 @@ impl ECP8 {
             &FP8::new_fp4s(
                 &FP4::new_fp2s(
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PXAAA),
-                        &BIG::new_ints(&rom::CURVE_PXAAB),
+                        &Big::new_ints(&rom::CURVE_PXAAA),
+                        &Big::new_ints(&rom::CURVE_PXAAB),
                     ),
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PXABA),
-                        &BIG::new_ints(&rom::CURVE_PXABB),
+                        &Big::new_ints(&rom::CURVE_PXABA),
+                        &Big::new_ints(&rom::CURVE_PXABB),
                     ),
                 ),
                 &FP4::new_fp2s(
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PXBAA),
-                        &BIG::new_ints(&rom::CURVE_PXBAB),
+                        &Big::new_ints(&rom::CURVE_PXBAA),
+                        &Big::new_ints(&rom::CURVE_PXBAB),
                     ),
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PXBBA),
-                        &BIG::new_ints(&rom::CURVE_PXBBB),
+                        &Big::new_ints(&rom::CURVE_PXBBA),
+                        &Big::new_ints(&rom::CURVE_PXBBB),
                     ),
                 ),
             ),
             &FP8::new_fp4s(
                 &FP4::new_fp2s(
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PYAAA),
-                        &BIG::new_ints(&rom::CURVE_PYAAB),
+                        &Big::new_ints(&rom::CURVE_PYAAA),
+                        &Big::new_ints(&rom::CURVE_PYAAB),
                     ),
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PYABA),
-                        &BIG::new_ints(&rom::CURVE_PYABB),
+                        &Big::new_ints(&rom::CURVE_PYABA),
+                        &Big::new_ints(&rom::CURVE_PYABB),
                     ),
                 ),
                 &FP4::new_fp2s(
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PYBAA),
-                        &BIG::new_ints(&rom::CURVE_PYBAB),
+                        &Big::new_ints(&rom::CURVE_PYBAA),
+                        &Big::new_ints(&rom::CURVE_PYBAB),
                     ),
                     &FP2::new_bigs(
-                        &BIG::new_ints(&rom::CURVE_PYBBA),
-                        &BIG::new_ints(&rom::CURVE_PYBBB),
+                        &Big::new_ints(&rom::CURVE_PYBBA),
+                        &Big::new_ints(&rom::CURVE_PYBBB),
                     ),
                 ),
             ),
@@ -1077,11 +1077,11 @@ impl ECP8 {
 
     #[allow(non_snake_case)]
     pub fn mapit(h: &[u8]) -> ECP8 {
-        let mut q = BIG::new_ints(&rom::MODULUS);
-        let mut x = BIG::frombytes(h);
+        let mut q = Big::new_ints(&rom::MODULUS);
+        let mut x = Big::frombytes(h);
         x.rmod(&mut q);
         let mut Q: ECP8;
-        let one = BIG::new_int(1);
+        let one = Big::new_int(1);
 
         loop {
             let X = FP8::new_fp4(&FP4::new_fp2(&FP2::new_bigs(&one, &x)));
@@ -1094,7 +1094,7 @@ impl ECP8 {
         }
 
         let f = ECP8::frob_constants();
-        x = BIG::new_ints(&rom::CURVE_BNX);
+        x = Big::new_ints(&rom::CURVE_BNX);
 
         let mut xQ = Q.mul(&mut x);
         let mut x2Q = xQ.mul(&mut x);
diff --git a/src/ff.rs b/src/ff.rs
index 4737ee8..5855d88 100644
--- a/src/ff.rs
+++ b/src/ff.rs
@@ -18,20 +18,20 @@ under the License.
 */
 
 use super::big;
-use super::dbig::DBIG;
-use super::big::BIG;
+use super::dbig::DBig;
+use super::big::Big;
 use super::super::arch::Chunk;
 use rand::RAND;
 
 use super::super::arch::DChunk;
 
 /* Finite field support - for RSA, DH etc. */
-/* RSA/DH modulus length as multiple of BIGBITS */
+/* RSA/DH modulus length as multiple of BigBITS */
 
 pub use super::rom::FFLEN;
 //use std::str::SplitWhitespace;
 
-pub const FF_BITS: usize = (big::BIGBITS * FFLEN); /* Finite Field Size in bits - must be 256.2^n */
+pub const FF_BITS: usize = (big::BigBITS * FFLEN); /* Finite Field Size in bits - must be 256.2^n */
 pub const HFLEN: usize = (FFLEN / 2); /* Useful for half-size RSA private key operations */
 
 pub const P_MBITS: usize = (big::MODBYTES as usize) * 8;
@@ -40,16 +40,16 @@ pub const P_FEXCESS: Chunk = (1 << (big::BASEBITS * big::NLEN - P_MBITS - 1));
 pub const P_TBITS: usize = (P_MBITS % big::BASEBITS);
 
 pub struct FF {
-    v: Vec<BIG>,
+    v: Vec<Big>,
     length: usize,
 }
 
 impl FF {
-    pub fn excess(a: &BIG) -> Chunk {
+    pub fn excess(a: &Big) -> Chunk {
         return ((a.w[big::NLEN - 1] & P_OMASK) >> (P_TBITS)) + 1;
     }
 
-    pub fn pexceed(a: &BIG, b: &BIG) -> bool {
+    pub fn pexceed(a: &Big, b: &Big) -> bool {
         let ea = FF::excess(a);
         let eb = FF::excess(b);
         if ((ea + 1) as DChunk) * ((eb + 1) as DChunk) > P_FEXCESS as DChunk {
@@ -58,7 +58,7 @@ impl FF {
         return false;
     }
 
-    pub fn sexceed(a: &BIG) -> bool {
+    pub fn sexceed(a: &Big) -> bool {
         let ea = FF::excess(a);
         if ((ea + 1) as DChunk) * ((ea + 1) as DChunk) > P_FEXCESS as DChunk {
             return true;
@@ -73,7 +73,7 @@ impl FF {
             length: 0,
         };
         for _ in 0..n {
-            f.v.push(BIG::new());
+            f.v.push(Big::new());
         }
         f.length = n;
         return f;
@@ -142,9 +142,9 @@ impl FF {
         return true;
     }
 
-    /* shift right by BIGBITS-bit words */
+    /* shift right by BigBITS-bit words */
     pub fn shrw(&mut self, n: usize) {
-        let mut t = BIG::new();
+        let mut t = Big::new();
         for i in 0..n {
             t.copy(&self.v[i + n]);
             self.v[i].copy(&t);
@@ -152,9 +152,9 @@ impl FF {
         }
     }
 
-    /* shift left by BIGBITS-bit words */
+    /* shift left by BigBITS-bit words */
     pub fn shlw(&mut self, n: usize) {
-        let mut t = BIG::new();
+        let mut t = Big::new();
         for i in 0..n {
             t.copy(&self.v[i]);
             self.v[n + i].copy(&t);
@@ -176,7 +176,7 @@ impl FF {
         let mut i = a.length - 1;
 
         loop {
-            let j = BIG::comp(&a.v[i], &b.v[i]);
+            let j = Big::comp(&a.v[i], &b.v[i]);
             if j != 0 {
                 return j;
             }
@@ -204,7 +204,7 @@ impl FF {
     }
 
     pub fn rsinc(&mut self, n: usize) {
-        let mut t = BIG::new();
+        let mut t = Big::new();
         for i in 0..n {
             t.copy(&self.v[i]);
             self.v[n + i].add(&t);
@@ -333,7 +333,7 @@ impl FF {
 
     pub fn frombytes(x: &mut FF, b: &[u8]) {
         for i in 0..x.length {
-            x.v[i] = BIG::frombytearray(b, (x.length - i - 1) * (big::MODBYTES as usize))
+            x.v[i] = Big::frombytearray(b, (x.length - i - 1) * (big::MODBYTES as usize))
         }
     }
 
@@ -357,9 +357,9 @@ impl FF {
         n: usize,
     ) {
         if n == 1 {
-            let xx = BIG::new_copy(&x.v[xp]);
-            let yy = BIG::new_copy(&y.v[yp]);
-            let mut d = BIG::mul(&xx, &yy);
+            let xx = Big::new_copy(&x.v[xp]);
+            let yy = Big::new_copy(&y.v[yp]);
+            let mut d = Big::mul(&xx, &yy);
             self.v[vp + 1] = d.split(8 * big::MODBYTES);
             self.v[vp].dcopy(&d);
             return;
@@ -384,8 +384,8 @@ impl FF {
 
     fn karsqr(&mut self, vp: usize, x: &FF, xp: usize, t: *mut FF, tp: usize, n: usize) {
         if n == 1 {
-            let xx = BIG::new_copy(&x.v[xp]);
-            let mut d = BIG::sqr(&xx);
+            let xx = Big::new_copy(&x.v[xp]);
+            let mut d = Big::sqr(&xx);
             self.v[vp + 1].copy(&d.split(8 * big::MODBYTES));
             self.v[vp].dcopy(&d);
             return;
@@ -416,7 +416,7 @@ impl FF {
     ) {
         if n == 1 {
             /* only calculate bottom half of product */
-            self.v[vp].copy(&BIG::smul(&x.v[xp], &y.v[yp]));
+            self.v[vp].copy(&Big::smul(&x.v[xp], &y.v[yp]));
             return;
         }
         let nd2 = n / 2;
@@ -548,7 +548,7 @@ impl FF {
         x.copy(&self);
         x.norm();
         m.dsucopy(&b);
-        let mut k = big::BIGBITS * n;
+        let mut k = big::BigBITS * n;
 
         while FF::comp(&x, &m) >= 0 {
             x.sub(&m);
@@ -641,7 +641,7 @@ impl FF {
     pub fn nres(&mut self, m: &FF) {
         let n = m.length;
         if n == 1 {
-            let mut d = DBIG::new_scopy(&(self.v[0]));
+            let mut d = DBig::new_scopy(&(self.v[0]));
             d.shl(big::NLEN * (big::BASEBITS as usize));
             self.v[0].copy(&d.dmod(&(m.v[0])));
         } else {
@@ -654,8 +654,8 @@ impl FF {
     pub fn redc(&mut self, m: &FF, md: &FF) {
         let n = m.length;
         if n == 1 {
-            let mut d = DBIG::new_scopy(&(self.v[0]));
-            self.v[0].copy(&BIG::monty(
+            let mut d = DBig::new_scopy(&(self.v[0]));
+            self.v[0].copy(&Big::monty(
                 &(m.v[0]),
                 ((1 as Chunk) << big::BASEBITS) - md.v[0].w[0],
                 &mut d,
@@ -720,11 +720,11 @@ impl FF {
     pub fn random(&mut self, rng: &mut RAND) {
         let n = self.length;
         for i in 0..n {
-            self.v[i].copy(&BIG::random(rng))
+            self.v[i].copy(&Big::random(rng))
         }
         /* make sure top bit is 1 */
         while self.v[n - 1].nbits() < (big::MODBYTES as usize) * 8 {
-            self.v[n - 1].copy(&BIG::random(rng));
+            self.v[n - 1].copy(&Big::random(rng));
         }
     }
 
@@ -734,7 +734,7 @@ impl FF {
         let mut d = FF::new_int(2 * n);
 
         for i in 0..2 * n {
-            d.v[i].copy(&BIG::random(rng));
+            d.v[i].copy(&Big::random(rng));
         }
         self.copy(&d.dmod(p));
     }
@@ -746,8 +746,8 @@ impl FF {
         }
         let n = p.length;
         if n == 1 {
-            let mut d = BIG::mul(&self.v[0], &y.v[0]);
-            self.v[0].copy(&BIG::monty(
+            let mut d = Big::mul(&self.v[0], &y.v[0]);
+            self.v[0].copy(&Big::monty(
                 &(p.v[0]),
                 ((1 as Chunk) << big::BASEBITS) - nd.v[0].w[0],
                 &mut d,
@@ -765,8 +765,8 @@ impl FF {
         }
         let n = p.length;
         if n == 1 {
-            let mut d = BIG::sqr(&self.v[0]);
-            self.v[0].copy(&BIG::monty(
+            let mut d = Big::sqr(&self.v[0]);
+            self.v[0].copy(&Big::monty(
                 &(p.v[0]),
                 ((1 as Chunk) << big::BASEBITS) - nd.v[0].w[0],
                 &mut d,
@@ -793,7 +793,7 @@ impl FF {
 
         let mut i = 8 * (big::MODBYTES as usize) * n - 1;
         loop {
-            let b = (e.v[i / (big::BIGBITS as usize)]).bit(i % (big::BIGBITS as usize)) as isize;
+            let b = (e.v[i / (big::BigBITS as usize)]).bit(i % (big::BigBITS as usize)) as isize;
             self.copy(&r0);
             self.modmul(&r1, p, &nd);
 
@@ -812,7 +812,7 @@ impl FF {
     }
 
     /* this =this^e mod p using side-channel resistant Montgomery Ladder, for short e */
-    pub fn skpows(&mut self, e: &BIG, p: &FF) {
+    pub fn skpows(&mut self, e: &Big, p: &FF) {
         let n = p.length;
         let mut r0 = FF::new_int(n);
         let mut r1 = FF::new_int(n);
@@ -892,7 +892,7 @@ impl FF {
         let mut i = 8 * (big::MODBYTES as usize) * n - 1;
         loop {
             self.modsqr(p, &nd);
-            let b = (e.v[i / (big::BIGBITS as usize)]).bit(i % (big::BIGBITS as usize)) as isize;
+            let b = (e.v[i / (big::BigBITS as usize)]).bit(i % (big::BigBITS as usize)) as isize;
             if b == 1 {
                 self.modmul(&w, p, &nd)
             }
@@ -905,7 +905,7 @@ impl FF {
     }
 
     /* double exponentiation r=x^e.y^f mod p */
-    pub fn pow2(&mut self, e: &BIG, y: &FF, f: &BIG, p: &FF) {
+    pub fn pow2(&mut self, e: &Big, y: &FF, f: &Big, p: &FF) {
         let n = p.length;
         let mut xn = FF::new_int(n);
         let mut yn = FF::new_int(n);
diff --git a/src/fp.rs b/src/fp.rs
index 57345c1..205d8d6 100644
--- a/src/fp.rs
+++ b/src/fp.rs
@@ -18,8 +18,8 @@ under the License.
 */
 
 use super::big;
-use super::big::BIG;
-use super::dbig::DBIG;
+use super::big::Big;
+use super::dbig::DBig;
 use super::rom;
 use super::super::arch::Chunk;
 use super::super::arch;
@@ -28,7 +28,7 @@ use std::str::FromStr;
 
 #[derive(Copy, Clone)]
 pub struct FP {
-    pub x: BIG,
+    pub x: Big,
     pub xes: i32,
 }
 
@@ -63,7 +63,7 @@ impl FP {
     /* Constructors */
     pub fn new() -> FP {
         FP {
-            x: BIG::new(),
+            x: Big::new(),
             xes: 1,
         }
     }
@@ -82,7 +82,7 @@ impl FP {
         return f;
     }
 
-    pub fn new_big(y: &BIG) -> FP {
+    pub fn new_big(y: &Big) -> FP {
         let mut f = FP::new();
         f.x.copy(y);
         f.nres();
@@ -91,8 +91,8 @@ impl FP {
 
     pub fn nres(&mut self) {
         if MODTYPE != ModType::PSEUDO_MERSENNE && MODTYPE != ModType::GENERALISED_MERSENNE {
-            let r=BIG::new_ints(&rom::R2MODP);
-            let mut d=BIG::mul(&(self.x),&r);
+            let r=Big::new_ints(&rom::R2MODP);
+            let mut d=Big::mul(&(self.x),&r);
             self.x.copy(&FP::modulo(&mut d));
             self.xes = 2;
         } else {
@@ -104,7 +104,7 @@ impl FP {
         let xes = i32::from_str(iter.next().unwrap()).unwrap();
         let x = iter.next().unwrap();
         FP {
-            x: BIG::from_hex(x.to_string()),
+            x: Big::from_hex(x.to_string()),
             xes
         }
     }
@@ -121,21 +121,21 @@ impl FP {
     }
 
 /* convert back to regular form */
-    pub fn redc(&mut self) -> BIG {
+    pub fn redc(&mut self) -> Big {
         if MODTYPE != ModType::PSEUDO_MERSENNE && MODTYPE != ModType::GENERALISED_MERSENNE {
-            let mut d=DBIG::new_scopy(&(self.x));
+            let mut d=DBig::new_scopy(&(self.x));
             return FP::modulo(&mut d);
         } else {
-            let r = BIG::new_copy(&(self.x));
+            let r = Big::new_copy(&(self.x));
             return r;
         }
     }
 
-    /* reduce a DBIG to a BIG using the appropriate form of the modulus */
+    /* reduce a DBig to a Big using the appropriate form of the modulus */
     /* dd */
-    pub fn modulo(d: &mut DBIG) -> BIG {
+    pub fn modulo(d: &mut DBig) -> Big {
         if MODTYPE==ModType::PSEUDO_MERSENNE {
-            let mut b=BIG::new();
+            let mut b=Big::new();
             let mut t=d.split(MODBITS);
             b.dcopy(&d);
             let v = t.pmul(rom::MCONST as isize);
@@ -149,13 +149,13 @@ impl FP {
             t.norm();
             return t;
         }
-    
+
         if MODTYPE==ModType::MONTGOMERY_FRIENDLY {
-            let mut b = BIG::new();
+            let mut b = Big::new();
             for i in 0..big::NLEN {
                 let x = d.w[i];
 
-                let tuple = BIG::muladd(x, rom::MCONST - 1, x, d.w[big::NLEN + i - 1]);
+                let tuple = Big::muladd(x, rom::MCONST - 1, x, d.w[big::NLEN + i - 1]);
                 d.w[big::NLEN + i] += tuple.0;
                 d.w[big::NLEN + i - 1] = tuple.1;
             }
@@ -171,16 +171,16 @@ impl FP {
 
         if MODTYPE == ModType::GENERALISED_MERSENNE {
             // GoldiLocks Only
-            let mut b = BIG::new();
+            let mut b = Big::new();
             let t = d.split(MODBITS);
             let rm2 = (MODBITS / 2) as usize;
             b.dcopy(&d);
             b.add(&t);
-            let mut dd = DBIG::new_scopy(&t);
+            let mut dd = DBig::new_scopy(&t);
             dd.shl(rm2);
 
             let mut tt = dd.split(MODBITS);
-            let lo = BIG::new_dcopy(&dd);
+            let lo = Big::new_dcopy(&dd);
             b.add(&tt);
             b.add(&lo);
             b.norm();
@@ -196,10 +196,10 @@ impl FP {
             return b;
         }
         if MODTYPE == ModType::NOT_SPECIAL {
-            let m = BIG::new_ints(&rom::MODULUS);
-            return BIG::monty(&m, rom::MCONST, d);
+            let m = Big::new_ints(&rom::MODULUS);
+            return Big::monty(&m, rom::MCONST, d);
         }
-        return BIG::new();
+        return Big::new();
     }
 
     /* convert to string */
@@ -210,8 +210,8 @@ impl FP {
 
     /* reduce this mod Modulus */
     pub fn reduce(&mut self) {
-        let mut m = BIG::new_ints(&rom::MODULUS);
-        let mut r = BIG::new_copy(&m);
+        let mut m = Big::new_ints(&rom::MODULUS);
+        let mut r = Big::new_copy(&m);
         let mut sb: usize;
         self.x.norm();
         if self.xes > 16 {
@@ -227,7 +227,7 @@ impl FP {
         m.fshl(sb);
 
         while sb > 0 {
-            let sr = BIG::ssn(&mut r, &self.x, &mut m);
+            let sr = Big::ssn(&mut r, &self.x, &mut m);
             self.x.cmove(&r, 1 - sr);
             sb = sb - 1;
         }
@@ -248,8 +248,8 @@ impl FP {
         self.xes = b.xes;
     }
 
-    /* copy from BIG b */
-    pub fn bcopy(&mut self, b: &BIG) {
+    /* copy from Big b */
+    pub fn bcopy(&mut self, b: &Big) {
         self.x.copy(&b);
         self.nres();
     }
@@ -293,7 +293,7 @@ impl FP {
             self.reduce()
         }
 
-        let mut d = BIG::mul(&(self.x), &(b.x));
+        let mut d = Big::mul(&(self.x), &(b.x));
         self.x.copy(&FP::modulo(&mut d));
         self.xes = 2;
     }
@@ -315,7 +315,7 @@ impl FP {
     // find approximation to quotient of a/m
     // Out by at most 2.
     // Note that MAXXES is bounded to be 2-bits less than half a word
-    fn quo(n: &BIG, m: &BIG) -> isize {
+    fn quo(n: &Big, m: &Big) -> isize {
         let hb = arch::CHUNK / 2;
 
         if TBITS < hb {
@@ -332,7 +332,7 @@ impl FP {
 
     /* this = -this mod Modulus */
     pub fn neg(&mut self) {
-        let mut p = BIG::new_ints(&rom::MODULUS);
+        let mut p = Big::new_ints(&rom::MODULUS);
         let sb = FP::logb2((self.xes - 1) as u32);
 
         p.fshl(sb);
@@ -378,7 +378,7 @@ impl FP {
             self.reduce()
         }
 
-        let mut d = BIG::sqr(&(self.x));
+        let mut d = Big::sqr(&(self.x));
         self.x.copy(&FP::modulo(&mut d));
         self.xes = 2
     }
@@ -419,7 +419,7 @@ impl FP {
         if self.x.parity() == 0 {
             self.x.fshr(1);
         } else {
-            let p = BIG::new_ints(&rom::MODULUS);
+            let p = Big::new_ints(&rom::MODULUS);
             self.x.add(&p);
             self.x.norm();
             self.x.fshr(1);
@@ -592,7 +592,7 @@ impl FP {
         } else {
             // Constant time inversion using Fermat's little theorem.
             // Fermat's little theorem says for a prime p and for any a < p, a^p = a % p => a^(p-1) = 1 % p => a^(p-2) = a^-1 % p
-            let mut m2 = BIG::new_ints(&rom::MODULUS);
+            let mut m2 = Big::new_ints(&rom::MODULUS);
             m2.dec(2);
             m2.norm();
             let inv = self.pow(&mut m2);
@@ -606,14 +606,14 @@ impl FP {
         let mut s = FP::new_copy(a);
         f.reduce();
         s.reduce();
-        if BIG::comp(&(f.x), &(s.x)) == 0 {
+        if Big::comp(&(f.x), &(s.x)) == 0 {
             return true;
         }
         return false;
     }
 
     /* return self^e mod Modulus */
-    pub fn pow(&mut self, e: &mut BIG) -> FP {
+    pub fn pow(&mut self, e: &mut Big) -> FP {
         let mut tb: [FP; 16] = [
             FP::new(),
             FP::new(),
@@ -636,7 +636,7 @@ impl FP {
         let mut w: [i8; CT] = [0; CT];
 
         self.norm();
-        let mut t = BIG::new_copy(e);
+        let mut t = Big::new_copy(e);
         t.norm();
         let nb = 1 + (t.nbits() + 3) / 4;
 
@@ -679,7 +679,7 @@ impl FP {
             if MODTYPE == ModType::PSEUDO_MERSENNE || MODTYPE == ModType::GENERALISED_MERSENNE {
                 v = i.fpow();
             } else {
-                let mut p = BIG::new_ints(&rom::MODULUS);
+                let mut p = Big::new_ints(&rom::MODULUS);
                 p.dec(5);
                 p.norm();
                 p.shr(3);
@@ -699,7 +699,7 @@ impl FP {
                 r = self.fpow();
                 r.mul(self);
             } else {
-                let mut p = BIG::new_ints(&rom::MODULUS);
+                let mut p = Big::new_ints(&rom::MODULUS);
                 p.inc(1);
                 p.norm();
                 p.shr(2);
@@ -710,7 +710,7 @@ impl FP {
     }
     /* return jacobi symbol (this/Modulus) */
     pub fn jacobi(&mut self) -> isize {
-        let mut p = BIG::new_ints(&rom::MODULUS);
+        let mut p = Big::new_ints(&rom::MODULUS);
         let mut w = self.redc();
         return w.jacobi(&mut p);
     }
diff --git a/src/fp12.rs b/src/fp12.rs
index 9c06a3e..311fe87 100644
--- a/src/fp12.rs
+++ b/src/fp12.rs
@@ -20,7 +20,7 @@ under the License.
 use super::big;
 use super::fp2::FP2;
 use super::fp4::FP4;
-use super::big::BIG;
+use super::big::Big;
 use super::rom;
 use types::SexticTwist;
 use std::str::SplitWhitespace;
@@ -425,7 +425,7 @@ impl FP12 {
                     z2.copy(&self.b);
                     z2.mul(&y.b);
                 }
-            } else { 
+            } else {
                z2.copy(&self.b);
                z2.mul(&y.b);
             }
@@ -442,7 +442,7 @@ impl FP12 {
 
             t0.copy(&z0); t0.neg();
             t1.copy(&z2); t1.neg();
- 
+
             z1.add(&t0);
             self.b.copy(&z1); self.b.add(&t1);
 
@@ -451,7 +451,7 @@ impl FP12 {
 
             t0.copy(&self.a); t0.add(&self.c); t0.norm();
             t1.copy(&y.a); t1.add(&y.c); t1.norm();
-	
+
             t0.mul(&t1);
             z2.add(&t0);
 
@@ -477,7 +477,7 @@ impl FP12 {
                     t0.copy(&self.c);
                     t0.mul(&y.c);
                 }
-            } else { 
+            } else {
                 t0.copy(&self.c);
                 t0.mul(&y.c);
             }
@@ -495,7 +495,7 @@ impl FP12 {
                 self.smul(&y);
                 return;
             }
-            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m 
+            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m
                 let mut z0=FP4::new_copy(&self.a);
                 let mut z2=FP4::new_copy(&self.b);
                 let mut z3=FP4::new_copy(&self.b);
@@ -539,7 +539,7 @@ impl FP12 {
                 let mut z3 = FP4::new();
                 let mut t0 = FP4::new_copy(&self.a);
                 let mut t1 = FP4::new();
-	
+
                 z0.mul(&y.a);
                 t0.add(&self.b); t0.norm();
 
@@ -562,7 +562,7 @@ impl FP12 {
                 t0.mul(&t1);
                 z2.add(&t0);
                 t0.copy(&self.c);
-			
+
                 t0.pmul(&y.c.getb());
                 t0.times_i();
                 t1.copy(&t0); t1.neg();
@@ -574,7 +574,7 @@ impl FP12 {
                 z3.norm();
                 z3.times_i();
                 self.a.copy(&z0); self.a.add(&z3);
-           }	
+           }
         }
         self.stype=DENSE;
         self.norm();
@@ -582,7 +582,7 @@ impl FP12 {
 
     /* Special case of multiplication arises from special form of ATE pairing line function */
     pub fn smul(&mut self, y: &FP12) {
-        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {	
+        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {
             let mut w1=FP2::new_copy(&self.a.geta());
             let mut w2=FP2::new_copy(&self.a.getb());
             let mut w3=FP2::new_copy(&self.b.geta());
@@ -626,7 +626,7 @@ impl FP12 {
 	    self.a.set_fp2s(&w1,&tc);
 	    self.b.set_fp2s(&td,&te);
 	    self.c.set_fp2(&w3);
-           
+
             self.a.norm();
             self.b.norm();
         } else {
@@ -767,21 +767,21 @@ impl FP12 {
         for i in 0..mb {
             t[i] = w[i]
         }
-        let mut a = BIG::frombytes(&t);
+        let mut a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + mb]
         }
-        let mut b = BIG::frombytes(&t);
+        let mut b = Big::frombytes(&t);
         let mut c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 2 * mb]
         }
-        a = BIG::frombytes(&t);
+        a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 3 * mb]
         }
-        b = BIG::frombytes(&t);
+        b = Big::frombytes(&t);
         let mut d = FP2::new_bigs(&a, &b);
 
         let e = FP4::new_fp2s(&c, &d);
@@ -789,21 +789,21 @@ impl FP12 {
         for i in 0..mb {
             t[i] = w[i + 4 * mb]
         }
-        a = BIG::frombytes(&t);
+        a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 5 * mb]
         }
-        b = BIG::frombytes(&t);
+        b = Big::frombytes(&t);
         c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 6 * mb]
         }
-        a = BIG::frombytes(&t);
+        a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 7 * mb]
         }
-        b = BIG::frombytes(&t);
+        b = Big::frombytes(&t);
         d = FP2::new_bigs(&a, &b);
 
         let f = FP4::new_fp2s(&c, &d);
@@ -811,22 +811,22 @@ impl FP12 {
         for i in 0..mb {
             t[i] = w[i + 8 * mb]
         }
-        a = BIG::frombytes(&t);
+        a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 9 * mb]
         }
-        b = BIG::frombytes(&t);
+        b = Big::frombytes(&t);
 
         c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 10 * mb]
         }
-        a = BIG::frombytes(&t);
+        a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 11 * mb]
         }
-        b = BIG::frombytes(&t);
+        b = Big::frombytes(&t);
         d = FP2::new_bigs(&a, &b);
 
         let g = FP4::new_fp2s(&c, &d);
@@ -920,12 +920,12 @@ impl FP12 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP12 {
+    pub fn pow(&self, e: &Big) -> FP12 {
         let mut r = FP12::new_copy(self);
         r.norm();
-        let mut e1 = BIG::new_copy(e);
+        let mut e1 = Big::new_copy(e);
         e1.norm();
-        let mut e3 = BIG::new_copy(&e1);
+        let mut e3 = Big::new_copy(&e1);
         e3.pmul(3);
         e3.norm();
         let mut w = FP12::new_copy(&r);
@@ -962,20 +962,20 @@ impl FP12 {
         self.copy(&r[0]);
     }
 
-    pub fn compow(&mut self, e: &BIG, r: &BIG) -> FP4 {
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::MODULUS);
+    pub fn compow(&mut self, e: &Big, r: &Big) -> FP4 {
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::MODULUS);
 
         let mut g1 = FP12::new_copy(self);
         let mut g2 = FP12::new_copy(self);
 
-        let mut m = BIG::new_copy(&q);
+        let mut m = Big::new_copy(&q);
         m.rmod(&r);
 
-        let mut a = BIG::new_copy(&e);
+        let mut a = Big::new_copy(&e);
         a.rmod(&mut m);
 
-        let mut b = BIG::new_copy(&e);
+        let mut b = Big::new_copy(&e);
         b.div(&mut m);
 
         let mut c = g1.trace();
@@ -1002,7 +1002,7 @@ impl FP12 {
     // Bos & Costello https://eprint.iacr.org/2013/458.pdf
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
-    pub fn pow4(q: &[FP12], u: &[BIG]) -> FP12 {
+    pub fn pow4(q: &[FP12], u: &[Big]) -> FP12 {
         let mut g: [FP12; 8] = [
             FP12::new(),
             FP12::new(),
@@ -1020,12 +1020,12 @@ impl FP12 {
         let mut w: [i8; CT] = [0; CT];
         let mut s: [i8; CT] = [0; CT];
 
-        let mut mt = BIG::new();
-        let mut t: [BIG; 4] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
+        let mut mt = Big::new();
+        let mut t: [Big; 4] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
         ];
 
         for i in 0..4 {
diff --git a/src/fp16.rs b/src/fp16.rs
index c579db4..2c4e976 100644
--- a/src/fp16.rs
+++ b/src/fp16.rs
@@ -19,7 +19,7 @@ under the License.
 
 use super::fp2::FP2;
 use super::fp8::FP8;
-use super::big::BIG;
+use super::big::Big;
 //use std::str::SplitWhitespace;
 
 #[derive(Copy, Clone)]
@@ -349,10 +349,10 @@ impl FP16 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP16 {
+    pub fn pow(&self, e: &Big) -> FP16 {
         let mut w = FP16::new_copy(self);
         w.norm();
-        let mut z = BIG::new_copy(&e);
+        let mut z = Big::new_copy(&e);
         let mut r = FP16::new_int(1);
         z.norm();
         loop {
@@ -401,7 +401,7 @@ impl FP16 {
     }
 
     /* r=x^n using XTR method on traces of FP24s */
-    pub fn xtr_pow(&self, n: &BIG) -> FP16 {
+    pub fn xtr_pow(&self, n: &Big) -> FP16 {
         let mut sf = FP16::new_copy(self);
         sf.norm();
         let mut a = FP16::new_int(3);
@@ -412,7 +412,7 @@ impl FP16 {
         let mut r = FP16::new();
 
         let par = n.parity();
-        let mut v = BIG::new_copy(n);
+        let mut v = Big::new_copy(n);
         v.norm();
         v.fshr(1);
         if par == 0 {
@@ -450,10 +450,10 @@ impl FP16 {
     }
 
     /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP12s. See Stam thesis. */
-    pub fn xtr_pow2(&mut self, ck: &FP16, ckml: &FP16, ckm2l: &FP16, a: &BIG, b: &BIG) -> FP16 {
-        let mut e = BIG::new_copy(a);
-        let mut d = BIG::new_copy(b);
-        let mut w = BIG::new();
+    pub fn xtr_pow2(&mut self, ck: &FP16, ckml: &FP16, ckm2l: &FP16, a: &Big, b: &Big) -> FP16 {
+        let mut e = Big::new_copy(a);
+        let mut d = Big::new_copy(b);
+        let mut w = Big::new();
         d.norm();
         e.norm();
 
@@ -471,12 +471,12 @@ impl FP16 {
             f2 += 1;
         }
 
-        while BIG::comp(&d, &e) != 0 {
-            if BIG::comp(&d, &e) > 0 {
+        while Big::comp(&d, &e) != 0 {
+            if Big::comp(&d, &e) > 0 {
                 w.copy(&e);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&d, &w) <= 0 {
+                if Big::comp(&d, &w) <= 0 {
                     w.copy(&d);
                     d.copy(&e);
                     e.rsub(&w);
@@ -531,11 +531,11 @@ impl FP16 {
                     }
                 }
             }
-            if BIG::comp(&d, &e) < 0 {
+            if Big::comp(&d, &e) < 0 {
                 w.copy(&d);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&e, &w) <= 0 {
+                if Big::comp(&e, &w) <= 0 {
                     e.sub(&d);
                     e.norm();
                     t.copy(&cv);
diff --git a/src/fp2.rs b/src/fp2.rs
index c848f19..060b9de 100644
--- a/src/fp2.rs
+++ b/src/fp2.rs
@@ -19,8 +19,8 @@ under the License.
 
 use super::fp;
 use super::fp::FP;
-use super::big::BIG;
-use super::dbig::DBIG;
+use super::big::Big;
+use super::dbig::DBig;
 use super::rom;
 use std::str::SplitWhitespace;
 use std::fmt;
@@ -78,7 +78,7 @@ impl FP2 {
         return f;
     }
 
-    pub fn new_bigs(c: &BIG, d: &BIG) -> FP2 {
+    pub fn new_bigs(c: &Big, d: &Big) -> FP2 {
         let mut f = FP2::new();
         f.a.copy(&FP::new_big(c));
         f.b.copy(&FP::new_big(d));
@@ -92,7 +92,7 @@ impl FP2 {
         return f;
     }
 
-    pub fn new_big(c: &BIG) -> FP2 {
+    pub fn new_big(c: &Big) -> FP2 {
         let mut f = FP2::new();
         f.a.copy(&FP::new_big(c));
         f.b.zero();
@@ -133,12 +133,12 @@ impl FP2 {
     }
 
     /* extract a */
-    pub fn geta(&mut self) -> BIG {
+    pub fn geta(&mut self) -> Big {
         return self.a.redc();
     }
 
     /* extract b */
-    pub fn getb(&mut self) -> BIG {
+    pub fn getb(&mut self) -> Big {
         return self.b.redc();
     }
 
@@ -248,24 +248,24 @@ impl FP2 {
             }
         }
 
-        let p = BIG::new_ints(&rom::MODULUS);
-        let mut pr = DBIG::new();
+        let p = Big::new_ints(&rom::MODULUS);
+        let mut pr = DBig::new();
 
         pr.ucopy(&p);
 
-        let mut c = BIG::new_copy(&(self.a.x));
-        let mut d = BIG::new_copy(&(y.a.x));
+        let mut c = Big::new_copy(&(self.a.x));
+        let mut d = Big::new_copy(&(y.a.x));
 
-        let mut a = BIG::mul(&self.a.x, &y.a.x);
-        let mut b = BIG::mul(&self.b.x, &y.b.x);
+        let mut a = Big::mul(&self.a.x, &y.a.x);
+        let mut b = Big::mul(&self.b.x, &y.b.x);
 
         c.add(&self.b.x);
         c.norm();
         d.add(&y.b.x);
         d.norm();
 
-        let mut e = BIG::mul(&c, &d);
-        let mut f = DBIG::new_copy(&a);
+        let mut e = Big::mul(&c, &d);
+        let mut f = DBig::new_copy(&a);
         f.add(&b);
         b.rsub(&pr);
 
diff --git a/src/fp24.rs b/src/fp24.rs
index 5f154b3..3deb850 100644
--- a/src/fp24.rs
+++ b/src/fp24.rs
@@ -22,7 +22,7 @@ use super::ecp;
 use super::fp2::FP2;
 use super::fp4::FP4;
 use super::fp8::FP8;
-use super::big::BIG;
+use super::big::Big;
 use super::rom;
 use types::{SexticTwist};
 //use std::str::SplitWhitespace;
@@ -418,7 +418,7 @@ impl FP24 {
                     z2.copy(&self.b);
                     z2.mul(&y.b);
                 }
-            } else { 
+            } else {
                z2.copy(&self.b);
                z2.mul(&y.b);
             }
@@ -435,7 +435,7 @@ impl FP24 {
 
             t0.copy(&z0); t0.neg();
             t1.copy(&z2); t1.neg();
- 
+
             z1.add(&t0);
             self.b.copy(&z1); self.b.add(&t1);
 
@@ -444,7 +444,7 @@ impl FP24 {
 
             t0.copy(&self.a); t0.add(&self.c); t0.norm();
             t1.copy(&y.a); t1.add(&y.c); t1.norm();
-	
+
             t0.mul(&t1);
             z2.add(&t0);
 
@@ -470,7 +470,7 @@ impl FP24 {
                     t0.copy(&self.c);
                     t0.mul(&y.c);
                 }
-            } else { 
+            } else {
                 t0.copy(&self.c);
                 t0.mul(&y.c);
             }
@@ -488,7 +488,7 @@ impl FP24 {
                 self.smul(&y);
                 return;
             }
-            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m 
+            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m
                 let mut z0=FP8::new_copy(&self.a);
                 let mut z2=FP8::new_copy(&self.b);
                 let mut z3=FP8::new_copy(&self.b);
@@ -532,7 +532,7 @@ impl FP24 {
                 let mut z3 = FP8::new();
                 let mut t0 = FP8::new_copy(&self.a);
                 let mut t1 = FP8::new();
-	
+
                 z0.mul(&y.a);
                 t0.add(&self.b); t0.norm();
 
@@ -555,7 +555,7 @@ impl FP24 {
                 t0.mul(&t1);
                 z2.add(&t0);
                 t0.copy(&self.c);
-			
+
                 t0.pmul(&y.c.getb());
                 t0.times_i();
                 t1.copy(&t0); t1.neg();
@@ -567,7 +567,7 @@ impl FP24 {
                 z3.norm();
                 z3.times_i();
                 self.a.copy(&z0); self.a.add(&z3);
-           }	
+           }
         }
         self.stype=DENSE;
         self.norm();
@@ -576,7 +576,7 @@ impl FP24 {
 
     /* Special case of multiplication arises from special form of ATE pairing line function */
     pub fn smul(&mut self, y: &FP24) {
-        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {	
+        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {
             let mut w1=FP4::new_copy(&self.a.geta());
             let mut w2=FP4::new_copy(&self.a.getb());
             let mut w3=FP4::new_copy(&self.b.geta());
@@ -769,21 +769,21 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i]
         }
-        let mut a = BIG::frombytes(&t);
+        let mut a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + mb]
         }
-        let mut b = BIG::frombytes(&t);
+        let mut b = Big::frombytes(&t);
         let mut c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 2 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 3 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         let mut d = FP2::new_bigs(&a, &b);
 
         let mut ea = FP4::new_fp2s(&c, &d);
@@ -791,21 +791,21 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i + 4 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 5 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 6 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 7 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         let mut eb = FP4::new_fp2s(&c, &d);
@@ -815,21 +815,21 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i + 8 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 9 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 10 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 11 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -837,21 +837,21 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i + 12 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 13 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 14 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 15 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -861,22 +861,22 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i + 16 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 17 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 18 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 19 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -884,22 +884,22 @@ impl FP24 {
         for i in 0..mb {
             t[i] = w[i + 20 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 21 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 22 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 23 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -1028,12 +1028,12 @@ impl FP24 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP24 {
+    pub fn pow(&self, e: &Big) -> FP24 {
         let mut r = FP24::new_copy(self);
         r.norm();
-        let mut e1 = BIG::new_copy(e);
+        let mut e1 = Big::new_copy(e);
         e1.norm();
-        let mut e3 = BIG::new_copy(&e1);
+        let mut e3 = Big::new_copy(&e1);
         e3.pmul(3);
         e3.norm();
         let mut w = FP24::new_copy(&r);
@@ -1070,20 +1070,20 @@ impl FP24 {
         self.copy(&r[0]);
     }
 
-    pub fn compow(&mut self, e: &BIG, r: &BIG) -> FP8 {
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::MODULUS);
+    pub fn compow(&mut self, e: &Big, r: &Big) -> FP8 {
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::MODULUS);
 
         let mut g1 = FP24::new_copy(self);
         let mut g2 = FP24::new_copy(self);
 
-        let mut m = BIG::new_copy(&q);
+        let mut m = Big::new_copy(&q);
         m.rmod(&r);
 
-        let mut a = BIG::new_copy(&e);
+        let mut a = Big::new_copy(&e);
         a.rmod(&mut m);
 
-        let mut b = BIG::new_copy(&e);
+        let mut b = Big::new_copy(&e);
         b.div(&mut m);
 
         let mut c = g1.trace();
@@ -1110,7 +1110,7 @@ impl FP24 {
     // Bos & Costello https://eprint.iacr.org/2013/458.pdf
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
-    pub fn pow8(q: &[FP24], u: &[BIG]) -> FP24 {
+    pub fn pow8(q: &[FP24], u: &[Big]) -> FP24 {
         let mut g1: [FP24; 8] = [
             FP24::new(),
             FP24::new(),
@@ -1140,16 +1140,16 @@ impl FP24 {
         let mut w2: [i8; CT] = [0; CT];
         let mut s2: [i8; CT] = [0; CT];
 
-        let mut mt = BIG::new();
-        let mut t: [BIG; 8] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
-            BIG::new_copy(&u[4]),
-            BIG::new_copy(&u[5]),
-            BIG::new_copy(&u[6]),
-            BIG::new_copy(&u[7]),
+        let mut mt = Big::new();
+        let mut t: [Big; 8] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
+            Big::new_copy(&u[4]),
+            Big::new_copy(&u[5]),
+            Big::new_copy(&u[6]),
+            Big::new_copy(&u[7]),
         ];
 
         for i in 0..8 {
@@ -1180,7 +1180,7 @@ impl FP24 {
         g1[7].mul(&q[3]); // q[0].q[1].q[2].q[3]
 
         // Use Frobenius
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
         for i in 0..8 {
             g2[i].copy(&g1[i]);
             g2[i].frob(&f, 4);
diff --git a/src/fp4.rs b/src/fp4.rs
index 1db4b73..d2d890b 100644
--- a/src/fp4.rs
+++ b/src/fp4.rs
@@ -19,7 +19,7 @@ under the License.
 
 use super::fp::FP;
 use super::fp2::FP2;
-use super::big::BIG;
+use super::big::Big;
 use std::str::SplitWhitespace;
 
 #[derive(Copy, Clone)]
@@ -69,7 +69,7 @@ impl FP4 {
         f.b.zero();
         return f;
     }
-	
+
     pub fn set_fp2s(&mut self,c: &FP2, d: &FP2) {
         self.a.copy(&c);
 	self.b.copy(&d);
@@ -360,10 +360,10 @@ impl FP4 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP4 {
+    pub fn pow(&self, e: &Big) -> FP4 {
         let mut w = FP4::new_copy(self);
         w.norm();
-        let mut z = BIG::new_copy(&e);
+        let mut z = Big::new_copy(&e);
         let mut r = FP4::new_int(1);
         z.norm();
         loop {
@@ -412,7 +412,7 @@ impl FP4 {
     }
 
     /* r=x^n using XTR method on traces of FP12s */
-    pub fn xtr_pow(&self, n: &BIG) -> FP4 {
+    pub fn xtr_pow(&self, n: &Big) -> FP4 {
         let mut sf = FP4::new_copy(self);
         sf.norm();
         let mut a = FP4::new_int(3);
@@ -423,7 +423,7 @@ impl FP4 {
         let mut r = FP4::new();
 
         let par = n.parity();
-        let mut v = BIG::new_copy(n);
+        let mut v = Big::new_copy(n);
         v.norm();
         v.fshr(1);
         if par == 0 {
@@ -461,10 +461,10 @@ impl FP4 {
     }
 
     /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP12s. See Stam thesis. */
-    pub fn xtr_pow2(&mut self, ck: &FP4, ckml: &FP4, ckm2l: &FP4, a: &BIG, b: &BIG) -> FP4 {
-        let mut e = BIG::new_copy(a);
-        let mut d = BIG::new_copy(b);
-        let mut w = BIG::new();
+    pub fn xtr_pow2(&mut self, ck: &FP4, ckml: &FP4, ckm2l: &FP4, a: &Big, b: &Big) -> FP4 {
+        let mut e = Big::new_copy(a);
+        let mut d = Big::new_copy(b);
+        let mut w = Big::new();
         e.norm();
         d.norm();
 
@@ -482,12 +482,12 @@ impl FP4 {
             f2 += 1;
         }
 
-        while BIG::comp(&d, &e) != 0 {
-            if BIG::comp(&d, &e) > 0 {
+        while Big::comp(&d, &e) != 0 {
+            if Big::comp(&d, &e) > 0 {
                 w.copy(&e);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&d, &w) <= 0 {
+                if Big::comp(&d, &w) <= 0 {
                     w.copy(&d);
                     d.copy(&e);
                     e.rsub(&w);
@@ -542,11 +542,11 @@ impl FP4 {
                     }
                 }
             }
-            if BIG::comp(&d, &e) < 0 {
+            if Big::comp(&d, &e) < 0 {
                 w.copy(&d);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&e, &w) <= 0 {
+                if Big::comp(&e, &w) <= 0 {
                     e.sub(&d);
                     e.norm();
                     t.copy(&cv);
diff --git a/src/fp48.rs b/src/fp48.rs
index c72ee4c..ff64d4c 100644
--- a/src/fp48.rs
+++ b/src/fp48.rs
@@ -23,7 +23,7 @@ use super::fp2::FP2;
 use super::fp4::FP4;
 use super::fp8::FP8;
 use super::fp16::FP16;
-use super::big::BIG;
+use super::big::Big;
 use super::rom;
 use types::SexticTwist;
 //use std::str::SplitWhitespace;
@@ -418,7 +418,7 @@ impl FP48 {
                     z2.copy(&self.b);
                     z2.mul(&y.b);
                 }
-            } else { 
+            } else {
                z2.copy(&self.b);
                z2.mul(&y.b);
             }
@@ -435,7 +435,7 @@ impl FP48 {
 
             t0.copy(&z0); t0.neg();
             t1.copy(&z2); t1.neg();
- 
+
             z1.add(&t0);
             self.b.copy(&z1); self.b.add(&t1);
 
@@ -444,7 +444,7 @@ impl FP48 {
 
             t0.copy(&self.a); t0.add(&self.c); t0.norm();
             t1.copy(&y.a); t1.add(&y.c); t1.norm();
-	
+
             t0.mul(&t1);
             z2.add(&t0);
 
@@ -470,7 +470,7 @@ impl FP48 {
                     t0.copy(&self.c);
                     t0.mul(&y.c);
                 }
-            } else { 
+            } else {
                 t0.copy(&self.c);
                 t0.mul(&y.c);
             }
@@ -488,7 +488,7 @@ impl FP48 {
                 self.smul(&y);
                 return;
             }
-            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m 
+            if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE { // dense by sparser - 13m
                 let mut z0=FP16::new_copy(&self.a);
                 let mut z2=FP16::new_copy(&self.b);
                 let mut z3=FP16::new_copy(&self.b);
@@ -532,7 +532,7 @@ impl FP48 {
                 let mut z3 = FP16::new();
                 let mut t0 = FP16::new_copy(&self.a);
                 let mut t1 = FP16::new();
-	
+
                 z0.mul(&y.a);
                 t0.add(&self.b); t0.norm();
 
@@ -555,7 +555,7 @@ impl FP48 {
                 t0.mul(&t1);
                 z2.add(&t0);
                 t0.copy(&self.c);
-			
+
                 t0.pmul(&y.c.getb());
                 t0.times_i();
                 t1.copy(&t0); t1.neg();
@@ -567,7 +567,7 @@ impl FP48 {
                 z3.norm();
                 z3.times_i();
                 self.a.copy(&z0); self.a.add(&z3);
-           }	
+           }
         }
         self.stype=DENSE;
         self.norm();
@@ -576,7 +576,7 @@ impl FP48 {
 
     /* Special case of multiplication arises from special form of ATE pairing line function */
     pub fn smul(&mut self, y: &FP48) {
-        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {	
+        if ecp::SEXTIC_TWIST==SexticTwist::D_TYPE {
             let mut w1=FP8::new_copy(&self.a.geta());
             let mut w2=FP8::new_copy(&self.a.getb());
             let mut w3=FP8::new_copy(&self.b.geta());
@@ -773,21 +773,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i]
         }
-        let mut a = BIG::frombytes(&t);
+        let mut a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + mb]
         }
-        let mut b = BIG::frombytes(&t);
+        let mut b = Big::frombytes(&t);
         let mut c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 2 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 3 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         let mut d = FP2::new_bigs(&a, &b);
 
         let mut ea = FP4::new_fp2s(&c, &d);
@@ -795,21 +795,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 4 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 5 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 6 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 7 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         let mut eb = FP4::new_fp2s(&c, &d);
@@ -819,21 +819,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 8 * mb]
         }
-        let mut a = BIG::frombytes(&t);
+        let mut a = Big::frombytes(&t);
         for i in 0..mb {
             t[i] = w[i + 9 * mb]
         }
-        let mut b = BIG::frombytes(&t);
+        let mut b = Big::frombytes(&t);
         let mut c = FP2::new_bigs(&a, &b);
 
         for i in 0..mb {
             t[i] = w[i + 10 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 11 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         let mut d = FP2::new_bigs(&a, &b);
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -841,21 +841,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 12 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 13 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 14 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 15 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -867,21 +867,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 16 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 17 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 18 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 19 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -889,21 +889,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 20 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 21 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 22 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 23 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -913,21 +913,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 24 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 25 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 26 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 27 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -935,21 +935,21 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 28 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 29 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 30 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 31 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -961,22 +961,22 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 32 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 33 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 34 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 35 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -984,22 +984,22 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 36 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 37 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 38 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 39 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -1009,22 +1009,22 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 40 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 41 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 42 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 43 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         ea.copy(&FP4::new_fp2s(&c, &d));
@@ -1032,22 +1032,22 @@ impl FP48 {
         for i in 0..mb {
             t[i] = w[i + 44 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 45 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
 
         c.copy(&FP2::new_bigs(&a, &b));
 
         for i in 0..mb {
             t[i] = w[i + 46 * mb]
         }
-        a.copy(&BIG::frombytes(&t));
+        a.copy(&Big::frombytes(&t));
         for i in 0..mb {
             t[i] = w[i + 47 * mb]
         }
-        b.copy(&BIG::frombytes(&t));
+        b.copy(&Big::frombytes(&t));
         d.copy(&FP2::new_bigs(&a, &b));
 
         eb.copy(&FP4::new_fp2s(&c, &d));
@@ -1280,12 +1280,12 @@ impl FP48 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP48 {
+    pub fn pow(&self, e: &Big) -> FP48 {
         let mut r = FP48::new_copy(self);
         r.norm();
-        let mut e1 = BIG::new_copy(e);
+        let mut e1 = Big::new_copy(e);
         e1.norm();
-        let mut e3 = BIG::new_copy(&e1);
+        let mut e3 = Big::new_copy(&e1);
         e3.pmul(3);
         e3.norm();
         let mut w = FP48::new_copy(&r);
@@ -1322,20 +1322,20 @@ impl FP48 {
         self.copy(&r[0]);
     }
 
-    pub fn compow(&mut self, e: &BIG, r: &BIG) -> FP16 {
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::MODULUS);
+    pub fn compow(&mut self, e: &Big, r: &Big) -> FP16 {
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::MODULUS);
 
         let mut g1 = FP48::new_copy(self);
         let mut g2 = FP48::new_copy(self);
 
-        let mut m = BIG::new_copy(&q);
+        let mut m = Big::new_copy(&q);
         m.rmod(&r);
 
-        let mut a = BIG::new_copy(&e);
+        let mut a = Big::new_copy(&e);
         a.rmod(&mut m);
 
-        let mut b = BIG::new_copy(&e);
+        let mut b = Big::new_copy(&e);
         b.div(&mut m);
 
         let mut c = g1.trace();
@@ -1362,7 +1362,7 @@ impl FP48 {
     // Bos & Costello https://eprint.iacr.org/2013/458.pdf
     // Faz-Hernandez & Longa & Sanchez  https://eprint.iacr.org/2013/158.pdf
     // Side channel attack secure
-    pub fn pow16(q: &[FP48], u: &[BIG]) -> FP48 {
+    pub fn pow16(q: &[FP48], u: &[Big]) -> FP48 {
         let mut g1: [FP48; 8] = [
             FP48::new(),
             FP48::new(),
@@ -1416,24 +1416,24 @@ impl FP48 {
         let mut w4: [i8; CT] = [0; CT];
         let mut s4: [i8; CT] = [0; CT];
 
-        let mut mt = BIG::new();
-        let mut t: [BIG; 16] = [
-            BIG::new_copy(&u[0]),
-            BIG::new_copy(&u[1]),
-            BIG::new_copy(&u[2]),
-            BIG::new_copy(&u[3]),
-            BIG::new_copy(&u[4]),
-            BIG::new_copy(&u[5]),
-            BIG::new_copy(&u[6]),
-            BIG::new_copy(&u[7]),
-            BIG::new_copy(&u[8]),
-            BIG::new_copy(&u[9]),
-            BIG::new_copy(&u[10]),
-            BIG::new_copy(&u[11]),
-            BIG::new_copy(&u[12]),
-            BIG::new_copy(&u[13]),
-            BIG::new_copy(&u[14]),
-            BIG::new_copy(&u[15]),
+        let mut mt = Big::new();
+        let mut t: [Big; 16] = [
+            Big::new_copy(&u[0]),
+            Big::new_copy(&u[1]),
+            Big::new_copy(&u[2]),
+            Big::new_copy(&u[3]),
+            Big::new_copy(&u[4]),
+            Big::new_copy(&u[5]),
+            Big::new_copy(&u[6]),
+            Big::new_copy(&u[7]),
+            Big::new_copy(&u[8]),
+            Big::new_copy(&u[9]),
+            Big::new_copy(&u[10]),
+            Big::new_copy(&u[11]),
+            Big::new_copy(&u[12]),
+            Big::new_copy(&u[13]),
+            Big::new_copy(&u[14]),
+            Big::new_copy(&u[15]),
         ];
 
         for i in 0..16 {
@@ -1464,7 +1464,7 @@ impl FP48 {
         g1[7].mul(&q[3]); // q[0].q[1].q[2].q[3]
 
         // Use Frobenius
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
         for i in 0..8 {
             g2[i].copy(&g1[i]);
             g2[i].frob(&f, 4);
diff --git a/src/fp8.rs b/src/fp8.rs
index dfc84d1..1fcc336 100644
--- a/src/fp8.rs
+++ b/src/fp8.rs
@@ -20,7 +20,7 @@ under the License.
 use super::fp::FP;
 use super::fp2::FP2;
 use super::fp4::FP4;
-use super::big::BIG;
+use super::big::Big;
 //use std::str::SplitWhitespace;
 
 #[derive(Copy, Clone)]
@@ -358,10 +358,10 @@ impl FP8 {
     }
 
     /* self=self^e */
-    pub fn pow(&self, e: &BIG) -> FP8 {
+    pub fn pow(&self, e: &Big) -> FP8 {
         let mut w = FP8::new_copy(self);
         w.norm();
-        let mut z = BIG::new_copy(&e);
+        let mut z = Big::new_copy(&e);
         let mut r = FP8::new_int(1);
         z.norm();
         loop {
@@ -411,7 +411,7 @@ impl FP8 {
     }
 
     /* r=x^n using XTR method on traces of FP24s */
-    pub fn xtr_pow(&self, n: &BIG) -> FP8 {
+    pub fn xtr_pow(&self, n: &Big) -> FP8 {
         let mut sf = FP8::new_copy(self);
         sf.norm();
         let mut a = FP8::new_int(3);
@@ -422,7 +422,7 @@ impl FP8 {
         let mut r = FP8::new();
 
         let par = n.parity();
-        let mut v = BIG::new_copy(n);
+        let mut v = Big::new_copy(n);
         v.norm();
         v.fshr(1);
         if par == 0 {
@@ -460,10 +460,10 @@ impl FP8 {
     }
 
     /* r=ck^a.cl^n using XTR double exponentiation method on traces of FP12s. See Stam thesis. */
-    pub fn xtr_pow2(&mut self, ck: &FP8, ckml: &FP8, ckm2l: &FP8, a: &BIG, b: &BIG) -> FP8 {
-        let mut e = BIG::new_copy(a);
-        let mut d = BIG::new_copy(b);
-        let mut w = BIG::new();
+    pub fn xtr_pow2(&mut self, ck: &FP8, ckml: &FP8, ckm2l: &FP8, a: &Big, b: &Big) -> FP8 {
+        let mut e = Big::new_copy(a);
+        let mut d = Big::new_copy(b);
+        let mut w = Big::new();
         e.norm();
         d.norm();
 
@@ -481,12 +481,12 @@ impl FP8 {
             f2 += 1;
         }
 
-        while BIG::comp(&d, &e) != 0 {
-            if BIG::comp(&d, &e) > 0 {
+        while Big::comp(&d, &e) != 0 {
+            if Big::comp(&d, &e) > 0 {
                 w.copy(&e);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&d, &w) <= 0 {
+                if Big::comp(&d, &w) <= 0 {
                     w.copy(&d);
                     d.copy(&e);
                     e.rsub(&w);
@@ -541,11 +541,11 @@ impl FP8 {
                     }
                 }
             }
-            if BIG::comp(&d, &e) < 0 {
+            if Big::comp(&d, &e) < 0 {
                 w.copy(&d);
                 w.imul(4);
                 w.norm();
-                if BIG::comp(&e, &w) <= 0 {
+                if Big::comp(&e, &w) <= 0 {
                     e.sub(&d);
                     e.norm();
                     t.copy(&cv);
diff --git a/src/mpin.rs b/src/mpin.rs
index 6d7e9ca..ba272d1 100644
--- a/src/mpin.rs
+++ b/src/mpin.rs
@@ -25,7 +25,7 @@ use super::ecp::ECP;
 use super::ecp2::ECP2;
 use super::fp4::FP4;
 use super::fp12::FP12;
-use super::big::BIG;
+use super::big::Big;
 use super::pair;
 use super::big;
 use super::rom;
@@ -193,10 +193,10 @@ pub fn today() -> usize {
 /* these next two functions help to implement elligator squared - http://eprint.iacr.org/2014/043 */
 /* maps a random u to a point on the curve */
 #[allow(non_snake_case)]
-fn emap(u: &BIG, cb: isize) -> ECP {
+fn emap(u: &Big, cb: isize) -> ECP {
     let mut P: ECP;
-    let mut x = BIG::new_copy(u);
-    let mut p = BIG::new_ints(&rom::MODULUS);
+    let mut x = Big::new_copy(u);
+    let mut p = Big::new_ints(&rom::MODULUS);
     x.rmod(&mut p);
     loop {
         P = ECP::new_bigint(&x, cb);
@@ -211,7 +211,7 @@ fn emap(u: &BIG, cb: isize) -> ECP {
 
 /* returns u derived from P. Random value in range 1 to return value should then be added to u */
 #[allow(non_snake_case)]
-fn unmap(u: &mut BIG, P: &mut ECP) -> isize {
+fn unmap(u: &mut Big, P: &mut ECP) -> isize {
     let s = P.gets();
     let mut R: ECP;
     let mut r = 0;
@@ -243,19 +243,19 @@ pub fn encoding(rng: &mut RAND, e: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = e[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = e[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let mut P = ECP::new_bigs(&u, &v);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let p = BIG::new_ints(&rom::MODULUS);
-    u = BIG::randomnum(&p, rng);
+    let p = Big::new_ints(&rom::MODULUS);
+    u = Big::randomnum(&p, rng);
 
     let mut su = rng.getbyte() as isize;
     su %= 2;
@@ -291,11 +291,11 @@ pub fn decoding(d: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = d[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = d[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let su = (d[0] & 1) as isize;
     let sv = ((d[0] >> 1) & 1) as isize;
@@ -351,8 +351,8 @@ pub fn recombine_g2(w1: &[u8], w2: &[u8], w: &mut [u8]) -> isize {
 
 /* create random secret S */
 pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
-    let mut sc = BIG::randomnum(&r, rng);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
+    let mut sc = Big::randomnum(&r, rng);
     sc.tobytes(s);
     return 0;
 }
@@ -362,7 +362,7 @@ pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
 pub fn get_server_secret(s: &[u8], sst: &mut [u8]) -> isize {
     let mut Q = ECP2::generator();
 
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     Q = pair::g2mul(&mut Q, &mut sc);
     Q.tobytes(sst);
     return 0;
@@ -382,14 +382,14 @@ pub fn get_g1_multiple(
     g: &[u8],
     w: &mut [u8],
 ) -> isize {
-    let mut sx: BIG;
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sx: Big;
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
     let mut P: ECP;
 
@@ -501,7 +501,7 @@ pub fn get_client_permit(sha: usize, date: usize, s: &[u8], cid: &[u8], ctt: &mu
     hashit(sha, date, cid, &mut h);
     let mut P = ECP::mapit(&h);
 
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     pair::g1mul(&mut P, &mut sc).tobytes(ctt, false);
     return 0;
 }
@@ -521,15 +521,15 @@ pub fn client_1(
     xcid: Option<&mut [u8]>,
     permit: Option<&[u8]>,
 ) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
-    let mut sx: BIG;
+    let mut sx: Big;
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
 
     const RM: usize = big::MODBYTES as usize;
@@ -604,14 +604,14 @@ pub fn server_1(sha: usize, date: usize, cid: &[u8], hid: &mut [u8], htid: Optio
 /* Implement step 2 on client side of MPin protocol */
 #[allow(non_snake_case)]
 pub fn client_2(x: &[u8], y: &[u8], sec: &mut [u8]) -> isize {
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
     let mut P = ECP::frombytes(sec);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let mut px = BIG::frombytes(x);
-    let py = BIG::frombytes(y);
+    let mut px = Big::frombytes(x);
+    let py = Big::frombytes(y);
     px.add(&py);
     px.rmod(&mut r);
 
@@ -637,8 +637,8 @@ pub fn get_y(sha: usize, timevalue: usize, xcid: &[u8], y: &mut [u8]) {
 
     hashit(sha, timevalue, xcid, &mut h);
 
-    let mut sy = BIG::frombytes(&h);
-    let mut q = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sy = Big::frombytes(&h);
+    let mut q = Big::new_ints(&rom::CURVE_ORDER);
     sy.rmod(&mut q);
     sy.tobytes(y);
 }
@@ -682,7 +682,7 @@ pub fn server_2(
         return INVALID_POINT;
     }
 
-    let mut sy = BIG::frombytes(&y);
+    let mut sy = Big::frombytes(&y);
     let mut P: ECP;
     if date != 0 {
         if let Some(rhtid) = htid {
@@ -864,9 +864,9 @@ pub fn client_key(
 ) -> isize {
     let mut g1 = FP12::frombytes(&g1);
     let mut g2 = FP12::frombytes(&g2);
-    let mut z = BIG::frombytes(&r);
-    let mut x = BIG::frombytes(&x);
-    let h = BIG::frombytes(&h);
+    let mut z = Big::frombytes(&r);
+    let mut x = Big::frombytes(&x);
+    let h = Big::frombytes(&h);
 
     let mut W = ECP::frombytes(&wcid);
     if W.is_infinity() {
@@ -875,7 +875,7 @@ pub fn client_key(
 
     W = pair::g1mul(&mut W, &mut x);
 
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
 
     z.add(&h); //new
     z.rmod(&mut r);
@@ -928,8 +928,8 @@ pub fn server_key(
         return INVALID_POINT;
     }
 
-    let mut w = BIG::frombytes(&w);
-    let mut h = BIG::frombytes(&h);
+    let mut w = Big::frombytes(&w);
+    let mut h = Big::frombytes(&h);
     A = pair::g1mul(&mut A, &mut h); // new
     R.add(&mut A);
 
diff --git a/src/mpin192.rs b/src/mpin192.rs
index 276a560..e133dcd 100644
--- a/src/mpin192.rs
+++ b/src/mpin192.rs
@@ -25,7 +25,7 @@ use super::ecp::ECP;
 use super::ecp4::ECP4;
 use super::fp8::FP8;
 use super::fp24::FP24;
-use super::big::BIG;
+use super::big::Big;
 use super::pair192;
 use super::big;
 use super::rom;
@@ -209,10 +209,10 @@ pub fn today() -> usize {
 /* these next two functions help to implement elligator squared - http://eprint.iacr.org/2014/043 */
 /* maps a random u to a point on the curve */
 #[allow(non_snake_case)]
-fn emap(u: &BIG, cb: isize) -> ECP {
+fn emap(u: &Big, cb: isize) -> ECP {
     let mut P: ECP;
-    let mut x = BIG::new_copy(u);
-    let mut p = BIG::new_ints(&rom::MODULUS);
+    let mut x = Big::new_copy(u);
+    let mut p = Big::new_ints(&rom::MODULUS);
     x.rmod(&mut p);
     loop {
         P = ECP::new_bigint(&x, cb);
@@ -227,7 +227,7 @@ fn emap(u: &BIG, cb: isize) -> ECP {
 
 /* returns u derived from P. Random value in range 1 to return value should then be added to u */
 #[allow(non_snake_case)]
-fn unmap(u: &mut BIG, P: &mut ECP) -> isize {
+fn unmap(u: &mut Big, P: &mut ECP) -> isize {
     let s = P.gets();
     let mut R: ECP;
     let mut r = 0;
@@ -259,19 +259,19 @@ pub fn encoding(rng: &mut RAND, e: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = e[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = e[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let mut P = ECP::new_bigs(&u, &v);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let p = BIG::new_ints(&rom::MODULUS);
-    u = BIG::randomnum(&p, rng);
+    let p = Big::new_ints(&rom::MODULUS);
+    u = Big::randomnum(&p, rng);
 
     let mut su = rng.getbyte() as isize;
     su %= 2;
@@ -307,11 +307,11 @@ pub fn decoding(d: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = d[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = d[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let su = (d[0] & 1) as isize;
     let sv = ((d[0] >> 1) & 1) as isize;
@@ -367,8 +367,8 @@ pub fn recombine_g2(w1: &[u8], w2: &[u8], w: &mut [u8]) -> isize {
 
 /* create random secret S */
 pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
-    let mut sc = BIG::randomnum(&r, rng);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
+    let mut sc = Big::randomnum(&r, rng);
     sc.tobytes(s);
     return 0;
 }
@@ -377,7 +377,7 @@ pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
 #[allow(non_snake_case)]
 pub fn get_server_secret(s: &[u8], sst: &mut [u8]) -> isize {
     let mut Q = ECP4::generator();
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     Q = pair192::g2mul(&mut Q, &mut sc);
     Q.tobytes(sst);
     return 0;
@@ -397,14 +397,14 @@ pub fn get_g1_multiple(
     g: &[u8],
     w: &mut [u8],
 ) -> isize {
-    let mut sx: BIG;
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sx: Big;
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
     let mut P: ECP;
 
@@ -516,7 +516,7 @@ pub fn get_client_permit(sha: usize, date: usize, s: &[u8], cid: &[u8], ctt: &mu
     hashit(sha, date, cid, &mut h);
     let mut P = ECP::mapit(&h);
 
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     pair192::g1mul(&mut P, &mut sc).tobytes(ctt, false);
     return 0;
 }
@@ -536,15 +536,15 @@ pub fn client_1(
     xcid: Option<&mut [u8]>,
     permit: Option<&[u8]>,
 ) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
-    let mut sx: BIG;
+    let mut sx: Big;
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
 
     const RM: usize = big::MODBYTES as usize;
@@ -619,14 +619,14 @@ pub fn server_1(sha: usize, date: usize, cid: &[u8], hid: &mut [u8], htid: Optio
 /* Implement step 2 on client side of MPin protocol */
 #[allow(non_snake_case)]
 pub fn client_2(x: &[u8], y: &[u8], sec: &mut [u8]) -> isize {
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
     let mut P = ECP::frombytes(sec);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let mut px = BIG::frombytes(x);
-    let py = BIG::frombytes(y);
+    let mut px = Big::frombytes(x);
+    let py = Big::frombytes(y);
     px.add(&py);
     px.rmod(&mut r);
 
@@ -652,8 +652,8 @@ pub fn get_y(sha: usize, timevalue: usize, xcid: &[u8], y: &mut [u8]) {
 
     hashit(sha, timevalue, xcid, &mut h);
 
-    let mut sy = BIG::frombytes(&h);
-    let mut q = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sy = Big::frombytes(&h);
+    let mut q = Big::new_ints(&rom::CURVE_ORDER);
     sy.rmod(&mut q);
     sy.tobytes(y);
 }
@@ -697,7 +697,7 @@ pub fn server_2(
         return INVALID_POINT;
     }
 
-    let mut sy = BIG::frombytes(&y);
+    let mut sy = Big::frombytes(&y);
     let mut P: ECP;
     if date != 0 {
         if let Some(rhtid) = htid {
@@ -879,9 +879,9 @@ pub fn client_key(
 ) -> isize {
     let mut g1 = FP24::frombytes(&g1);
     let mut g2 = FP24::frombytes(&g2);
-    let mut z = BIG::frombytes(&r);
-    let mut x = BIG::frombytes(&x);
-    let h = BIG::frombytes(&h);
+    let mut z = Big::frombytes(&r);
+    let mut x = Big::frombytes(&x);
+    let h = Big::frombytes(&h);
 
     let mut W = ECP::frombytes(&wcid);
     if W.is_infinity() {
@@ -890,7 +890,7 @@ pub fn client_key(
 
     W = pair192::g1mul(&mut W, &mut x);
 
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
 
     z.add(&h); //new
     z.rmod(&mut r);
@@ -943,8 +943,8 @@ pub fn server_key(
         return INVALID_POINT;
     }
 
-    let mut w = BIG::frombytes(&w);
-    let mut h = BIG::frombytes(&h);
+    let mut w = Big::frombytes(&w);
+    let mut h = Big::frombytes(&h);
     A = pair192::g1mul(&mut A, &mut h); // new
     R.add(&mut A);
 
diff --git a/src/mpin256.rs b/src/mpin256.rs
index b4928e9..4892ff5 100644
--- a/src/mpin256.rs
+++ b/src/mpin256.rs
@@ -25,7 +25,7 @@ use super::ecp::ECP;
 use super::ecp8::ECP8;
 use super::fp16::FP16;
 use super::fp48::FP48;
-use super::big::BIG;
+use super::big::Big;
 use super::pair256;
 use super::big;
 use super::rom;
@@ -241,10 +241,10 @@ pub fn today() -> usize {
 /* these next two functions help to implement elligator squared - http://eprint.iacr.org/2014/043 */
 /* maps a random u to a point on the curve */
 #[allow(non_snake_case)]
-fn emap(u: &BIG, cb: isize) -> ECP {
+fn emap(u: &Big, cb: isize) -> ECP {
     let mut P: ECP;
-    let mut x = BIG::new_copy(u);
-    let mut p = BIG::new_ints(&rom::MODULUS);
+    let mut x = Big::new_copy(u);
+    let mut p = Big::new_ints(&rom::MODULUS);
     x.rmod(&mut p);
     loop {
         P = ECP::new_bigint(&x, cb);
@@ -259,7 +259,7 @@ fn emap(u: &BIG, cb: isize) -> ECP {
 
 /* returns u derived from P. Random value in range 1 to return value should then be added to u */
 #[allow(non_snake_case)]
-fn unmap(u: &mut BIG, P: &mut ECP) -> isize {
+fn unmap(u: &mut Big, P: &mut ECP) -> isize {
     let s = P.gets();
     let mut R: ECP;
     let mut r = 0;
@@ -291,19 +291,19 @@ pub fn encoding(rng: &mut RAND, e: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = e[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = e[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let mut P = ECP::new_bigs(&u, &v);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let p = BIG::new_ints(&rom::MODULUS);
-    u = BIG::randomnum(&p, rng);
+    let p = Big::new_ints(&rom::MODULUS);
+    u = Big::randomnum(&p, rng);
 
     let mut su = rng.getbyte() as isize;
     su %= 2;
@@ -339,11 +339,11 @@ pub fn decoding(d: &mut [u8]) -> isize {
     for i in 0..EFS {
         t[i] = d[i + 1]
     }
-    let mut u = BIG::frombytes(&t);
+    let mut u = Big::frombytes(&t);
     for i in 0..EFS {
         t[i] = d[i + EFS + 1]
     }
-    let mut v = BIG::frombytes(&t);
+    let mut v = Big::frombytes(&t);
 
     let su = (d[0] & 1) as isize;
     let sv = ((d[0] >> 1) & 1) as isize;
@@ -399,8 +399,8 @@ pub fn recombine_g2(w1: &[u8], w2: &[u8], w: &mut [u8]) -> isize {
 
 /* create random secret S */
 pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
-    let mut sc = BIG::randomnum(&r, rng);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
+    let mut sc = Big::randomnum(&r, rng);
     sc.tobytes(s);
     return 0;
 }
@@ -410,7 +410,7 @@ pub fn random_generate(rng: &mut RAND, s: &mut [u8]) -> isize {
 pub fn get_server_secret(s: &[u8], sst: &mut [u8]) -> isize {
     let mut Q = ECP8::generator();
 
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     Q = pair256::g2mul(&mut Q, &mut sc);
     Q.tobytes(sst);
     return 0;
@@ -430,14 +430,14 @@ pub fn get_g1_multiple(
     g: &[u8],
     w: &mut [u8],
 ) -> isize {
-    let mut sx: BIG;
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sx: Big;
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
     let mut P: ECP;
 
@@ -549,7 +549,7 @@ pub fn get_client_permit(sha: usize, date: usize, s: &[u8], cid: &[u8], ctt: &mu
     hashit(sha, date, cid, &mut h);
     let mut P = ECP::mapit(&h);
 
-    let mut sc = BIG::frombytes(s);
+    let mut sc = Big::frombytes(s);
     pair256::g1mul(&mut P, &mut sc).tobytes(ctt, false);
     return 0;
 }
@@ -569,15 +569,15 @@ pub fn client_1(
     xcid: Option<&mut [u8]>,
     permit: Option<&[u8]>,
 ) -> isize {
-    let r = BIG::new_ints(&rom::CURVE_ORDER);
+    let r = Big::new_ints(&rom::CURVE_ORDER);
 
-    let mut sx: BIG;
+    let mut sx: Big;
 
     if let Some(rd) = rng {
-        sx = BIG::randomnum(&r, rd);
+        sx = Big::randomnum(&r, rd);
         sx.tobytes(x);
     } else {
-        sx = BIG::frombytes(x);
+        sx = Big::frombytes(x);
     }
 
     const RM: usize = big::MODBYTES as usize;
@@ -652,14 +652,14 @@ pub fn server_1(sha: usize, date: usize, cid: &[u8], hid: &mut [u8], htid: Optio
 /* Implement step 2 on client side of MPin protocol */
 #[allow(non_snake_case)]
 pub fn client_2(x: &[u8], y: &[u8], sec: &mut [u8]) -> isize {
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
     let mut P = ECP::frombytes(sec);
     if P.is_infinity() {
         return INVALID_POINT;
     }
 
-    let mut px = BIG::frombytes(x);
-    let py = BIG::frombytes(y);
+    let mut px = Big::frombytes(x);
+    let py = Big::frombytes(y);
     px.add(&py);
     px.rmod(&mut r);
 
@@ -685,8 +685,8 @@ pub fn get_y(sha: usize, timevalue: usize, xcid: &[u8], y: &mut [u8]) {
 
     hashit(sha, timevalue, xcid, &mut h);
 
-    let mut sy = BIG::frombytes(&h);
-    let mut q = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut sy = Big::frombytes(&h);
+    let mut q = Big::new_ints(&rom::CURVE_ORDER);
     sy.rmod(&mut q);
     sy.tobytes(y);
 }
@@ -730,7 +730,7 @@ pub fn server_2(
         return INVALID_POINT;
     }
 
-    let mut sy = BIG::frombytes(&y);
+    let mut sy = Big::frombytes(&y);
     let mut P: ECP;
     if date != 0 {
         if let Some(rhtid) = htid {
@@ -912,9 +912,9 @@ pub fn client_key(
 ) -> isize {
     let mut g1 = FP48::frombytes(&g1);
     let mut g2 = FP48::frombytes(&g2);
-    let mut z = BIG::frombytes(&r);
-    let mut x = BIG::frombytes(&x);
-    let h = BIG::frombytes(&h);
+    let mut z = Big::frombytes(&r);
+    let mut x = Big::frombytes(&x);
+    let h = Big::frombytes(&h);
 
     let mut W = ECP::frombytes(&wcid);
     if W.is_infinity() {
@@ -923,7 +923,7 @@ pub fn client_key(
 
     W = pair256::g1mul(&mut W, &mut x);
 
-    let mut r = BIG::new_ints(&rom::CURVE_ORDER);
+    let mut r = Big::new_ints(&rom::CURVE_ORDER);
 
     z.add(&h); //new
     z.rmod(&mut r);
@@ -976,8 +976,8 @@ pub fn server_key(
         return INVALID_POINT;
     }
 
-    let mut w = BIG::frombytes(&w);
-    let mut h = BIG::frombytes(&h);
+    let mut w = Big::frombytes(&w);
+    let mut h = Big::frombytes(&h);
     A = pair256::g1mul(&mut A, &mut h); // new
     R.add(&mut A);
 
diff --git a/src/pair.rs b/src/pair.rs
index 2050296..b85efaa 100644
--- a/src/pair.rs
+++ b/src/pair.rs
@@ -25,8 +25,8 @@ use super::ecp2::ECP2;
 use super::fp4::FP4;
 use super::fp12;
 use super::fp12::FP12;
-use super::big::BIG;
-use super::dbig::DBIG;
+use super::big::Big;
+use super::dbig::DBig;
 use super::ecp;
 use super::rom;
 use types::{SexticTwist, CurvePairingType, SignOfX};
@@ -139,8 +139,8 @@ fn lineadd(A: &mut ECP2, B: &ECP2, qx: &FP, qy: &FP) -> FP12 {
 
 /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
 #[allow(non_snake_case)]
-fn lbits(n3: &mut BIG,n: &mut BIG) -> usize {
-    n.copy(&BIG::new_ints(&rom::CURVE_BNX));
+fn lbits(n3: &mut Big,n: &mut Big) -> usize {
+    n.copy(&Big::new_ints(&rom::CURVE_BNX));
     if ecp::CURVE_PAIRING_TYPE==CurvePairingType::BN {
         n.pmul(6);
         if ecp::SIGN_OF_X==SignOfX::POSITIVEX {
@@ -180,9 +180,9 @@ pub fn miller(r:&[FP12]) -> FP12 {
 /* Accumulate another set of line functions for n-pairing */
 #[allow(non_snake_case)]
 pub fn another(r:&mut [FP12],P1: &ECP2,Q1: &ECP) {
-    let mut f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut n = Big::new();
+    let mut n3 = Big::new();
     let mut K = ECP2::new();
 
 
@@ -240,15 +240,15 @@ pub fn another(r:&mut [FP12],P1: &ECP2,Q1: &ECP) {
         let lv2=lineadd(&mut A,&K,&qx,&qy);
         lv.smul(&lv2);
 	r[0].ssmul(&lv);
-    } 
+    }
 }
 
 #[allow(non_snake_case)]
 /* Optimal R-ate pairing */
 pub fn ate(P1: &ECP2, Q1: &ECP) -> FP12 {
-    let mut f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut n = Big::new();
+    let mut n3 = Big::new();
     let mut K = ECP2::new();
 
     if ecp::CURVE_PAIRING_TYPE == CurvePairingType::BN {
@@ -256,7 +256,7 @@ pub fn ate(P1: &ECP2, Q1: &ECP) -> FP12 {
             f.inverse();
             f.norm();
         }
-    } 
+    }
     let mut P = ECP2::new();
     P.copy(P1);
     P.affine();
@@ -320,9 +320,9 @@ pub fn ate(P1: &ECP2, Q1: &ECP) -> FP12 {
 #[allow(non_snake_case)]
 /* Optimal R-ate double pairing e(P,Q).e(R,S) */
 pub fn ate2(P1: &ECP2, Q1: &ECP, R1: &ECP2, S1: &ECP) -> FP12 {
-    let mut f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut n = Big::new();
+    let mut n3 = Big::new();
     let mut K = ECP2::new();
 
     if ecp::CURVE_PAIRING_TYPE == CurvePairingType::BN {
@@ -330,7 +330,7 @@ pub fn ate2(P1: &ECP2, Q1: &ECP, R1: &ECP2, S1: &ECP) -> FP12 {
             f.inverse();
             f.norm();
         }
-    } 
+    }
 
     let mut P = ECP2::new();
     P.copy(P1);
@@ -425,8 +425,8 @@ pub fn ate2(P1: &ECP2, Q1: &ECP, R1: &ECP2, S1: &ECP) -> FP12 {
 
 /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */
 pub fn fexp(m: &FP12) -> FP12 {
-    let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut x = BIG::new_ints(&rom::CURVE_BNX);
+    let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut x = Big::new_ints(&rom::CURVE_BNX);
     let mut r = FP12::new_copy(m);
 
     /* Easy part of final exp */
@@ -560,32 +560,32 @@ pub fn fexp(m: &FP12) -> FP12 {
 
 #[allow(non_snake_case)]
 /* GLV method */
-fn glv(e: &BIG) -> [BIG; 2] {
-    let mut u: [BIG; 2] = [BIG::new(), BIG::new()];
+fn glv(e: &Big) -> [Big; 2] {
+    let mut u: [Big; 2] = [Big::new(), Big::new()];
     if ecp::CURVE_PAIRING_TYPE == CurvePairingType::BN {
-        let mut t = BIG::new();
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut v: [BIG; 2] = [BIG::new(), BIG::new()];
+        let mut t = Big::new();
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut v: [Big; 2] = [Big::new(), Big::new()];
 
         for i in 0..2 {
-            t.copy(&BIG::new_ints(&rom::CURVE_W[i])); // why not just t=new BIG(ROM.CURVE_W[i]);
-            let mut d: DBIG = BIG::mul(&t, e);
+            t.copy(&Big::new_ints(&rom::CURVE_W[i])); // why not just t=new Big(ROM.CURVE_W[i]);
+            let mut d: DBig = Big::mul(&t, e);
             v[i].copy(&d.div(&q));
         }
         u[0].copy(&e);
         for i in 0..2 {
             for j in 0..2 {
-                t = BIG::new_ints(&rom::CURVE_SB[j][i]);
-                t = BIG::modmul(&mut v[j], &mut t, &q);
+                t = Big::new_ints(&rom::CURVE_SB[j][i]);
+                t = Big::modmul(&mut v[j], &mut t, &q);
                 u[i].add(&q);
                 u[i].sub(&t);
                 u[i].rmod(&q);
             }
         }
     } else {
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let x = BIG::new_ints(&rom::CURVE_BNX);
-        let x2 = BIG::smul(&x, &x);
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let x = Big::new_ints(&rom::CURVE_BNX);
+        let x2 = Big::smul(&x, &x);
         u[0].copy(&e);
         u[0].rmod(&x2);
         u[1].copy(&e);
@@ -597,32 +597,32 @@ fn glv(e: &BIG) -> [BIG; 2] {
 
 #[allow(non_snake_case)]
 /* Galbraith & Scott Method */
-pub fn gs(e: &BIG) -> [BIG; 4] {
-    let mut u: [BIG; 4] = [BIG::new(), BIG::new(), BIG::new(), BIG::new()];
+pub fn gs(e: &Big) -> [Big; 4] {
+    let mut u: [Big; 4] = [Big::new(), Big::new(), Big::new(), Big::new()];
     if ecp::CURVE_PAIRING_TYPE == CurvePairingType::BN {
-        let mut t = BIG::new();
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
+        let mut t = Big::new();
+        let q = Big::new_ints(&rom::CURVE_ORDER);
 
-        let mut v: [BIG; 4] = [BIG::new(), BIG::new(), BIG::new(), BIG::new()];
+        let mut v: [Big; 4] = [Big::new(), Big::new(), Big::new(), Big::new()];
         for i in 0..4 {
-            t.copy(&BIG::new_ints(&rom::CURVE_WB[i]));
-            let mut d: DBIG = BIG::mul(&t, e);
+            t.copy(&Big::new_ints(&rom::CURVE_WB[i]));
+            let mut d: DBig = Big::mul(&t, e);
             v[i].copy(&d.div(&q));
         }
         u[0].copy(&e);
         for i in 0..4 {
             for j in 0..4 {
-                t = BIG::new_ints(&rom::CURVE_BB[j][i]);
-                t = BIG::modmul(&mut v[j], &mut t, &q);
+                t = Big::new_ints(&rom::CURVE_BB[j][i]);
+                t = Big::modmul(&mut v[j], &mut t, &q);
                 u[i].add(&q);
                 u[i].sub(&t);
                 u[i].rmod(&q);
             }
         }
     } else {
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let x = BIG::new_ints(&rom::CURVE_BNX);
-        let mut w = BIG::new_copy(&e);
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let x = Big::new_ints(&rom::CURVE_BNX);
+        let mut w = Big::new_copy(&e);
         for i in 0..3 {
             u[i].copy(&w);
             u[i].rmod(&x);
@@ -630,10 +630,10 @@ pub fn gs(e: &BIG) -> [BIG; 4] {
         }
         u[3].copy(&w);
         if ecp::SIGN_OF_X == SignOfX::NEGATIVEX {
-            let mut t = BIG::new();
-            t.copy(&BIG::modneg(&mut u[1], &q));
+            let mut t = Big::new();
+            t.copy(&Big::modneg(&mut u[1], &q));
             u[1].copy(&t);
-            t.copy(&BIG::modneg(&mut u[3], &q));
+            t.copy(&Big::modneg(&mut u[3], &q));
             u[3].copy(&t);
         }
     }
@@ -642,20 +642,20 @@ pub fn gs(e: &BIG) -> [BIG; 4] {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G1 */
-pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
+pub fn g1mul(P: &ECP, e: &mut Big) -> ECP {
     let mut R = ECP::new();
     if rom::USE_GLV {
         R.copy(P);
         let mut Q = ECP::new();
         Q.copy(P);
         Q.affine();
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut cru = FP::new_big(&BIG::new_ints(&rom::CURVE_CRU));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut cru = FP::new_big(&Big::new_ints(&rom::CURVE_CRU));
         let mut u = glv(e);
         Q.mulx(&mut cru);
 
         let mut np = u[0].nbits();
-        let mut t: BIG = BIG::modneg(&mut u[0], &q);
+        let mut t: Big = Big::modneg(&mut u[0], &q);
         let mut nn = t.nbits();
         if nn < np {
             u[0].copy(&t);
@@ -663,7 +663,7 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
         }
 
         np = u[1].nbits();
-        t = BIG::modneg(&mut u[1], &q);
+        t = Big::modneg(&mut u[1], &q);
         nn = t.nbits();
         if nn < np {
             u[1].copy(&t);
@@ -680,12 +680,12 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G2 */
-pub fn g2mul(P: &ECP2, e: &BIG) -> ECP2 {
+pub fn g2mul(P: &ECP2, e: &Big) -> ECP2 {
     let mut R = ECP2::new();
     if rom::USE_GS_G2 {
         let mut Q: [ECP2; 4] = [ECP2::new(), ECP2::new(), ECP2::new(), ECP2::new()];
-        let mut f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
+        let mut f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
         let mut u = gs(e);
         let mut T = ECP2::new();
 
@@ -694,7 +694,7 @@ pub fn g2mul(P: &ECP2, e: &BIG) -> ECP2 {
             f.norm();
         }
 
-        let mut t = BIG::new();
+        let mut t = Big::new();
         Q[0].copy(&P);
         for i in 1..4 {
             T.copy(&Q[i - 1]);
@@ -703,7 +703,7 @@ pub fn g2mul(P: &ECP2, e: &BIG) -> ECP2 {
         }
         for i in 0..4 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);
@@ -721,13 +721,13 @@ pub fn g2mul(P: &ECP2, e: &BIG) -> ECP2 {
 
 /* f=f^e */
 /* Note that this method requires a lot of RAM! Better to use compressed XTR method, see FP4.java */
-pub fn gtpow(d: &FP12, e: &BIG) -> FP12 {
+pub fn gtpow(d: &FP12, e: &Big) -> FP12 {
     let mut r = FP12::new();
     if rom::USE_GS_GT {
         let mut g: [FP12; 4] = [FP12::new(), FP12::new(), FP12::new(), FP12::new()];
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut t = BIG::new();
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut t = Big::new();
         let mut u = gs(e);
         let mut w = FP12::new();
 
@@ -739,7 +739,7 @@ pub fn gtpow(d: &FP12, e: &BIG) -> FP12 {
         }
         for i in 0..4 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);
diff --git a/src/pair192.rs b/src/pair192.rs
index 4310b6b..a7c2993 100644
--- a/src/pair192.rs
+++ b/src/pair192.rs
@@ -26,7 +26,7 @@ use super::fp4::FP4;
 use super::fp8::FP8;
 use super::fp24;
 use super::fp24::FP24;
-use super::big::BIG;
+use super::big::Big;
 use super::ecp;
 use super::rom;
 use types::{SexticTwist, SignOfX};
@@ -137,8 +137,8 @@ fn lineadd(A: &mut ECP4, B: &ECP4, qx: &FP, qy: &FP) -> FP24 {
 
 /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
 #[allow(non_snake_case)]
-fn lbits(n3: &mut BIG,n: &mut BIG) -> usize {
-    n.copy(&BIG::new_ints(&rom::CURVE_BNX));
+fn lbits(n3: &mut Big,n: &mut Big) -> usize {
+    n.copy(&Big::new_ints(&rom::CURVE_BNX));
     n3.copy(&n);
     n3.pmul(3);
     n3.norm();
@@ -169,9 +169,9 @@ pub fn miller(r:&[FP24]) -> FP24 {
 /* Accumulate another set of line functions for n-pairing */
 #[allow(non_snake_case)]
 pub fn another(r:&mut [FP24],P1: &ECP4,Q1: &ECP) {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
-    
+    let mut n = Big::new();
+    let mut n3 = Big::new();
+
 // P is needed in affine form for line function, Q for (Qx,Qy) extraction
     let mut P = ECP4::new();
     P.copy(P1);
@@ -210,8 +210,8 @@ pub fn another(r:&mut [FP24],P1: &ECP4,Q1: &ECP) {
 #[allow(non_snake_case)]
 /* Optimal R-ate pairing */
 pub fn ate(P1: &ECP4, Q1: &ECP) -> FP24 {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut n = Big::new();
+    let mut n3 = Big::new();
 
     let mut P = ECP4::new();
     P.copy(P1);
@@ -260,8 +260,8 @@ pub fn ate(P1: &ECP4, Q1: &ECP) -> FP24 {
 #[allow(non_snake_case)]
 /* Optimal R-ate double pairing e(P,Q).e(R,S) */
 pub fn ate2(P1: &ECP4, Q1: &ECP, R1: &ECP4, S1: &ECP) -> FP24 {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut n = Big::new();
+    let mut n3 = Big::new();
 
     let mut P = ECP4::new();
     P.copy(P1);
@@ -328,8 +328,8 @@ pub fn ate2(P1: &ECP4, Q1: &ECP, R1: &ECP4, S1: &ECP) -> FP24 {
 
 /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */
 pub fn fexp(m: &FP24) -> FP24 {
-    let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut x = BIG::new_ints(&rom::CURVE_BNX);
+    let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut x = Big::new_ints(&rom::CURVE_BNX);
     let mut r = FP24::new_copy(m);
 
     /* Easy part of final exp */
@@ -426,12 +426,12 @@ pub fn fexp(m: &FP24) -> FP24 {
 
 #[allow(non_snake_case)]
 /* GLV method */
-fn glv(e: &BIG) -> [BIG; 2] {
-    let mut u: [BIG; 2] = [BIG::new(), BIG::new()];
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
-    let mut x = BIG::new_ints(&rom::CURVE_BNX);
-    let x2 = BIG::smul(&x, &x);
-    x.copy(&BIG::smul(&x2, &x2));
+fn glv(e: &Big) -> [Big; 2] {
+    let mut u: [Big; 2] = [Big::new(), Big::new()];
+    let q = Big::new_ints(&rom::CURVE_ORDER);
+    let mut x = Big::new_ints(&rom::CURVE_BNX);
+    let x2 = Big::smul(&x, &x);
+    x.copy(&Big::smul(&x2, &x2));
     u[0].copy(&e);
     u[0].rmod(&x);
     u[1].copy(&e);
@@ -443,20 +443,20 @@ fn glv(e: &BIG) -> [BIG; 2] {
 
 #[allow(non_snake_case)]
 /* Galbraith & Scott Method */
-pub fn gs(e: &BIG) -> [BIG; 8] {
-    let mut u: [BIG; 8] = [
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
+pub fn gs(e: &Big) -> [Big; 8] {
+    let mut u: [Big; 8] = [
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
     ];
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
-    let x = BIG::new_ints(&rom::CURVE_BNX);
-    let mut w = BIG::new_copy(&e);
+    let q = Big::new_ints(&rom::CURVE_ORDER);
+    let x = Big::new_ints(&rom::CURVE_BNX);
+    let mut w = Big::new_copy(&e);
     for i in 0..7 {
         u[i].copy(&w);
         u[i].rmod(&x);
@@ -464,14 +464,14 @@ pub fn gs(e: &BIG) -> [BIG; 8] {
     }
     u[7].copy(&w);
     if ecp::SIGN_OF_X == SignOfX::NEGATIVEX {
-        let mut t = BIG::new();
-        t.copy(&BIG::modneg(&mut u[1], &q));
+        let mut t = Big::new();
+        t.copy(&Big::modneg(&mut u[1], &q));
         u[1].copy(&t);
-        t.copy(&BIG::modneg(&mut u[3], &q));
+        t.copy(&Big::modneg(&mut u[3], &q));
         u[3].copy(&t);
-        t.copy(&BIG::modneg(&mut u[5], &q));
+        t.copy(&Big::modneg(&mut u[5], &q));
         u[5].copy(&t);
-        t.copy(&BIG::modneg(&mut u[7], &q));
+        t.copy(&Big::modneg(&mut u[7], &q));
         u[7].copy(&t);
     }
     return u;
@@ -479,20 +479,20 @@ pub fn gs(e: &BIG) -> [BIG; 8] {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G1 */
-pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
+pub fn g1mul(P: &ECP, e: &mut Big) -> ECP {
     let mut R = ECP::new();
     if rom::USE_GLV {
         R.copy(P);
         let mut Q = ECP::new();
         Q.copy(P);
         Q.affine();
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut cru = FP::new_big(&BIG::new_ints(&rom::CURVE_CRU));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut cru = FP::new_big(&Big::new_ints(&rom::CURVE_CRU));
         let mut u = glv(e);
         Q.mulx(&mut cru);
 
         let mut np = u[0].nbits();
-        let mut t: BIG = BIG::modneg(&mut u[0], &q);
+        let mut t: Big = Big::modneg(&mut u[0], &q);
         let mut nn = t.nbits();
         if nn < np {
             u[0].copy(&t);
@@ -500,7 +500,7 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
         }
 
         np = u[1].nbits();
-        t = BIG::modneg(&mut u[1], &q);
+        t = Big::modneg(&mut u[1], &q);
         nn = t.nbits();
         if nn < np {
             u[1].copy(&t);
@@ -517,7 +517,7 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G2 */
-pub fn g2mul(P: &ECP4, e: &BIG) -> ECP4 {
+pub fn g2mul(P: &ECP4, e: &Big) -> ECP4 {
     let mut R = ECP4::new();
     if rom::USE_GS_G2 {
         let mut Q: [ECP4; 8] = [
@@ -530,13 +530,13 @@ pub fn g2mul(P: &ECP4, e: &BIG) -> ECP4 {
             ECP4::new(),
             ECP4::new(),
         ];
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
+        let q = Big::new_ints(&rom::CURVE_ORDER);
         let mut u = gs(e);
         let mut T = ECP4::new();
 
         let f = ECP4::frob_constants();
 
-        let mut t = BIG::new();
+        let mut t = Big::new();
         Q[0].copy(&P);
         for i in 1..8 {
             T.copy(&Q[i - 1]);
@@ -545,7 +545,7 @@ pub fn g2mul(P: &ECP4, e: &BIG) -> ECP4 {
         }
         for i in 0..8 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);
@@ -563,7 +563,7 @@ pub fn g2mul(P: &ECP4, e: &BIG) -> ECP4 {
 
 /* f=f^e */
 /* Note that this method requires a lot of RAM! Better to use compressed XTR method, see FP4.java */
-pub fn gtpow(d: &FP24, e: &BIG) -> FP24 {
+pub fn gtpow(d: &FP24, e: &Big) -> FP24 {
     let mut r = FP24::new();
     if rom::USE_GS_GT {
         let mut g: [FP24; 8] = [
@@ -576,9 +576,9 @@ pub fn gtpow(d: &FP24, e: &BIG) -> FP24 {
             FP24::new(),
             FP24::new(),
         ];
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut t = BIG::new();
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut t = Big::new();
         let mut u = gs(e);
         let mut w = FP24::new();
 
@@ -590,7 +590,7 @@ pub fn gtpow(d: &FP24, e: &BIG) -> FP24 {
         }
         for i in 0..8 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);
diff --git a/src/pair256.rs b/src/pair256.rs
index 7cdca72..f25676c 100644
--- a/src/pair256.rs
+++ b/src/pair256.rs
@@ -26,7 +26,7 @@ use super::fp8::FP8;
 use super::fp16::FP16;
 use super::fp48;
 use super::fp48::FP48;
-use super::big::BIG;
+use super::big::Big;
 use super::ecp;
 use super::rom;
 use types::{SignOfX, SexticTwist};
@@ -137,8 +137,8 @@ fn lineadd(A: &mut ECP8, B: &ECP8, qx: &FP, qy: &FP) -> FP48 {
 
 /* prepare ate parameter, n=6u+2 (BN) or n=u (BLS), n3=3*n */
 #[allow(non_snake_case)]
-fn lbits(n3: &mut BIG,n: &mut BIG) -> usize {
-    n.copy(&BIG::new_ints(&rom::CURVE_BNX));
+fn lbits(n3: &mut Big,n: &mut Big) -> usize {
+    n.copy(&Big::new_ints(&rom::CURVE_BNX));
     n3.copy(&n);
     n3.pmul(3);
     n3.norm();
@@ -169,8 +169,8 @@ pub fn miller(r:&[FP48]) -> FP48 {
 /* Accumulate another set of line functions for n-pairing */
 #[allow(non_snake_case)]
 pub fn another(r:&mut [FP48],P1: &ECP8,Q1: &ECP) {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut n = Big::new();
+    let mut n3 = Big::new();
 
 // P is needed in affine form for line function, Q for (Qx,Qy) extraction
     let mut P = ECP8::new();
@@ -210,8 +210,8 @@ pub fn another(r:&mut [FP48],P1: &ECP8,Q1: &ECP) {
 #[allow(non_snake_case)]
 /* Optimal R-ate pairing */
 pub fn ate(P1: &ECP8, Q1: &ECP) -> FP48 {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut n = Big::new();
+    let mut n3 = Big::new();
 
     let mut P = ECP8::new();
     P.copy(P1);
@@ -258,8 +258,8 @@ pub fn ate(P1: &ECP8, Q1: &ECP) -> FP48 {
 #[allow(non_snake_case)]
 /* Optimal R-ate double pairing e(P,Q).e(R,S) */
 pub fn ate2(P1: &ECP8, Q1: &ECP, R1: &ECP8, S1: &ECP) -> FP48 {
-    let mut n = BIG::new();
-    let mut n3 = BIG::new();
+    let mut n = Big::new();
+    let mut n3 = Big::new();
 
     let mut P = ECP8::new();
     P.copy(P1);
@@ -326,8 +326,8 @@ pub fn ate2(P1: &ECP8, Q1: &ECP, R1: &ECP8, S1: &ECP) -> FP48 {
 
 /* final exponentiation - keep separate for multi-pairings and to avoid thrashing stack */
 pub fn fexp(m: &FP48) -> FP48 {
-    let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-    let mut x = BIG::new_ints(&rom::CURVE_BNX);
+    let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+    let mut x = Big::new_ints(&rom::CURVE_BNX);
     let mut r = FP48::new_copy(m);
 
     /* Easy part of final exp */
@@ -509,13 +509,13 @@ pub fn fexp(m: &FP48) -> FP48 {
 
 #[allow(non_snake_case)]
 /* GLV method */
-fn glv(e: &BIG) -> [BIG; 2] {
-    let mut u: [BIG; 2] = [BIG::new(), BIG::new()];
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
-    let mut x = BIG::new_ints(&rom::CURVE_BNX);
-    let mut x2 = BIG::smul(&x, &x);
-    x.copy(&BIG::smul(&x2, &x2));
-    x2.copy(&BIG::smul(&x, &x));
+fn glv(e: &Big) -> [Big; 2] {
+    let mut u: [Big; 2] = [Big::new(), Big::new()];
+    let q = Big::new_ints(&rom::CURVE_ORDER);
+    let mut x = Big::new_ints(&rom::CURVE_BNX);
+    let mut x2 = Big::smul(&x, &x);
+    x.copy(&Big::smul(&x2, &x2));
+    x2.copy(&Big::smul(&x, &x));
     u[0].copy(&e);
     u[0].rmod(&x2);
     u[1].copy(&e);
@@ -527,28 +527,28 @@ fn glv(e: &BIG) -> [BIG; 2] {
 
 #[allow(non_snake_case)]
 /* Galbraith & Scott Method */
-pub fn gs(e: &BIG) -> [BIG; 16] {
-    let mut u: [BIG; 16] = [
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
-        BIG::new(),
+pub fn gs(e: &Big) -> [Big; 16] {
+    let mut u: [Big; 16] = [
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
+        Big::new(),
     ];
-    let q = BIG::new_ints(&rom::CURVE_ORDER);
-    let x = BIG::new_ints(&rom::CURVE_BNX);
-    let mut w = BIG::new_copy(&e);
+    let q = Big::new_ints(&rom::CURVE_ORDER);
+    let x = Big::new_ints(&rom::CURVE_BNX);
+    let mut w = Big::new_copy(&e);
     for i in 0..15 {
         u[i].copy(&w);
         u[i].rmod(&x);
@@ -556,22 +556,22 @@ pub fn gs(e: &BIG) -> [BIG; 16] {
     }
     u[15].copy(&w);
     if ecp::SIGN_OF_X == SignOfX::NEGATIVEX {
-        let mut t = BIG::new();
-        t.copy(&BIG::modneg(&mut u[1], &q));
+        let mut t = Big::new();
+        t.copy(&Big::modneg(&mut u[1], &q));
         u[1].copy(&t);
-        t.copy(&BIG::modneg(&mut u[3], &q));
+        t.copy(&Big::modneg(&mut u[3], &q));
         u[3].copy(&t);
-        t.copy(&BIG::modneg(&mut u[5], &q));
+        t.copy(&Big::modneg(&mut u[5], &q));
         u[5].copy(&t);
-        t.copy(&BIG::modneg(&mut u[7], &q));
+        t.copy(&Big::modneg(&mut u[7], &q));
         u[7].copy(&t);
-        t.copy(&BIG::modneg(&mut u[9], &q));
+        t.copy(&Big::modneg(&mut u[9], &q));
         u[9].copy(&t);
-        t.copy(&BIG::modneg(&mut u[11], &q));
+        t.copy(&Big::modneg(&mut u[11], &q));
         u[11].copy(&t);
-        t.copy(&BIG::modneg(&mut u[13], &q));
+        t.copy(&Big::modneg(&mut u[13], &q));
         u[13].copy(&t);
-        t.copy(&BIG::modneg(&mut u[15], &q));
+        t.copy(&Big::modneg(&mut u[15], &q));
         u[15].copy(&t);
     }
     return u;
@@ -579,20 +579,20 @@ pub fn gs(e: &BIG) -> [BIG; 16] {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G1 */
-pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
+pub fn g1mul(P: &ECP, e: &mut Big) -> ECP {
     let mut R = ECP::new();
     if rom::USE_GLV {
         R.copy(P);
         let mut Q = ECP::new();
         Q.copy(P);
         Q.affine();
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut cru = FP::new_big(&BIG::new_ints(&rom::CURVE_CRU));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut cru = FP::new_big(&Big::new_ints(&rom::CURVE_CRU));
         let mut u = glv(e);
         Q.mulx(&mut cru);
 
         let mut np = u[0].nbits();
-        let mut t: BIG = BIG::modneg(&mut u[0], &q);
+        let mut t: Big = Big::modneg(&mut u[0], &q);
         let mut nn = t.nbits();
         if nn < np {
             u[0].copy(&t);
@@ -600,7 +600,7 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
         }
 
         np = u[1].nbits();
-        t = BIG::modneg(&mut u[1], &q);
+        t = Big::modneg(&mut u[1], &q);
         nn = t.nbits();
         if nn < np {
             u[1].copy(&t);
@@ -617,7 +617,7 @@ pub fn g1mul(P: &ECP, e: &mut BIG) -> ECP {
 
 #[allow(non_snake_case)]
 /* Multiply P by e in group G2 */
-pub fn g2mul(P: &ECP8, e: &BIG) -> ECP8 {
+pub fn g2mul(P: &ECP8, e: &Big) -> ECP8 {
     let mut R = ECP8::new();
     if rom::USE_GS_G2 {
         let mut Q: [ECP8; 16] = [
@@ -638,13 +638,13 @@ pub fn g2mul(P: &ECP8, e: &BIG) -> ECP8 {
             ECP8::new(),
             ECP8::new(),
         ];
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
+        let q = Big::new_ints(&rom::CURVE_ORDER);
         let mut u = gs(e);
         let mut T = ECP8::new();
 
         let f = ECP8::frob_constants();
 
-        let mut t = BIG::new();
+        let mut t = Big::new();
         Q[0].copy(&P);
         for i in 1..16 {
             T.copy(&Q[i - 1]);
@@ -653,7 +653,7 @@ pub fn g2mul(P: &ECP8, e: &BIG) -> ECP8 {
         }
         for i in 0..16 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);
@@ -671,7 +671,7 @@ pub fn g2mul(P: &ECP8, e: &BIG) -> ECP8 {
 
 /* f=f^e */
 /* Note that this method requires a lot of RAM! Better to use compressed XTR method, see FP4.java */
-pub fn gtpow(d: &FP48, e: &BIG) -> FP48 {
+pub fn gtpow(d: &FP48, e: &Big) -> FP48 {
     let mut r = FP48::new();
     if rom::USE_GS_GT {
         let mut g: [FP48; 16] = [
@@ -692,9 +692,9 @@ pub fn gtpow(d: &FP48, e: &BIG) -> FP48 {
             FP48::new(),
             FP48::new(),
         ];
-        let f = FP2::new_bigs(&BIG::new_ints(&rom::FRA), &BIG::new_ints(&rom::FRB));
-        let q = BIG::new_ints(&rom::CURVE_ORDER);
-        let mut t = BIG::new();
+        let f = FP2::new_bigs(&Big::new_ints(&rom::FRA), &Big::new_ints(&rom::FRB));
+        let q = Big::new_ints(&rom::CURVE_ORDER);
+        let mut t = Big::new();
         let mut u = gs(e);
         let mut w = FP48::new();
 
@@ -706,7 +706,7 @@ pub fn gtpow(d: &FP48, e: &BIG) -> FP48 {
         }
         for i in 0..16 {
             let np = u[i].nbits();
-            t.copy(&BIG::modneg(&mut u[i], &q));
+            t.copy(&Big::modneg(&mut u[i], &q));
             let nn = t.nbits();
             if nn < np {
                 u[i].copy(&t);