hash -> hashbuf
BN -> BN()
bn -> BN, BN -> BN()
fix precision error by handling BNs correctly