test against file data in testVerify()

 - use the signature for a message supplied in the file to test
   checkvalid() as otherwise we are only testing that the implementation
   is consistent with itself (also speeds up the test)
some speed improvements taken from the previous PR

 - use bcpowmod() in expmod() as it is much faster that the recursion
 - reduce duplicate calculations in various methods
Fixed the signing test by matching just the signature against the signature output