Made generated d to be between phi(n)/2 and phi(n)

+ fixed bit/byte mismatch for key size input